Bläddra i källkod

质检附件上传排序

cr 1 månad sedan
förälder
incheckning
65f55c20bd

+ 10 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -4417,9 +4417,17 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "nodeId", value = "nodeId", required = true),
 
     })
-    public R addBussFile(Integer classify,Long contractId,@RequestParam("file") MultipartFile[] files, String nodeId, Integer type,BladeUser b) {
+    public R addBussFile(Integer classify,Long contractId,@RequestParam("files")MultipartFile[] files, String nodeId, Integer type,BladeUser b) {
         List<TableFile> fileList = new ArrayList<>();
         if (files != null && files.length >= 1) {
+            String sql1 = "SELECT sort FROM m_table_file WHERE tab_id = ? AND type = ? AND classify = ? AND contract_id = ? ORDER BY sort DESC LIMIT 1";
+            Integer sortValue;
+            try {
+                sortValue=jdbcTemplate.queryForObject(sql1, Integer.class, nodeId, type, classify, contractId);
+                sortValue=sortValue+1;
+            }catch (Exception e){
+                sortValue=0;
+            }
             for (int i = 0; i < files.length; i++) {
                 R<BladeFile> bladeFile = iossClient.addFileInfo(files[i]);
                 BladeFile bladeFile1 = bladeFile.getData();
@@ -4438,7 +4446,7 @@ public class ExcelTabController extends BladeController {
                 tableFile.setIsDeleted(0);
                 tableFile.setExtension(fileExtension);
                 tableFile.setClassify(classify);
-                //tableFile.setSort();
+                tableFile.setSort(sortValue+i);
                 fileList.add(tableFile);
             }
             tableFileService.saveOrUpdateBatch(fileList);