Преглед на файлове

Merge remote-tracking branch 'origin/develop' into develop

zishan-an преди 11 месеца
родител
ревизия
7fa82ff974
променени са 2 файла, в които са добавени 22 реда и са изтрити 9 реда
  1. 14 4
      src/main/java/com/kexun/controller/FileUploadController.java
  2. 8 5
      src/main/resources/mapper/FieldDefineMapper.xml

+ 14 - 4
src/main/java/com/kexun/controller/FileUploadController.java

@@ -152,9 +152,20 @@ public class FileUploadController {
             , @RequestParam String model_name, @RequestParam String model_type, @RequestParam String model_no, @RequestParam String output_list, SysUser sysUser
     ) throws IOException {
         int type = Integer.parseInt(model_type);
+
+        String filename="";
+        String filefmt="";
+        int lastDotIndex = name.lastIndexOf(".");
+        if (lastDotIndex != -1 && lastDotIndex < name.length() - 1) {
+            filename = name.substring(0, lastDotIndex);
+            filefmt = name.substring(lastDotIndex + 1);
+        } else {
+            return Result.error("文件名中不包含点或点在末尾");
+        }
+
         if (type == 1 || type == 2) {
-            String filename = name.split("\\.")[0];
-            String filefmt = name.split("\\.")[1];
+
+
             String fullFileName = String.join("-", new String[]{filename, uid, index + "", "." + filefmt});
             String filePath = fileuploadPath + "/" + sysUser.getUserName() + "/" + filename + "." + filefmt;
             log.info("filename:" + fullFileName);
@@ -201,8 +212,7 @@ public class FileUploadController {
 
         } else {
             // http请求
-            String filename = name.split("\\.")[0];
-            String filefmt = name.split("\\.")[1];
+
             String fullFileName = String.join("-", new String[]{filename, uid, index + "", "." + filefmt});
             log.info("filename:" + fullFileName);
             File dir = new File(warPath);

+ 8 - 5
src/main/resources/mapper/FieldDefineMapper.xml

@@ -36,7 +36,10 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        d.category,
+        d
+        .
+        category
+        ,
         d.create_by,
         d.create_time,
         d.fetch_logic,
@@ -72,7 +75,7 @@
         from field_define
         where category = #{cat}
           and is_deleted = 0
-        order by create_time desc,id desc
+        order by create_time desc, id desc
 
 
     </select>
@@ -82,7 +85,7 @@
         from field_define
         WHERE name_zh LIKE concat('%', #{info}, '%')
           and is_deleted = 0
-        order by create_time desc,id desc
+        order by create_time desc, id desc
 
     </select>
 
@@ -91,7 +94,7 @@
         from field_define
         WHERE name_zh LIKE concat('%', #{info}, '%')
           and is_deleted = 0
-        order by create_time desc,id desc
+        order by create_time desc, id desc
 
     </select>
 
@@ -107,7 +110,7 @@
         from field_define d
         LEFT JOIN product_field_ref r on d.field_no = r.field_no
         where r.product_num = #{productNum}
-        <if test="oneLevel!=null">
+        <if test="oneLevel!=null and oneLevel!=''">
             and d.one_level = #{oneLevel}
         </if>
         <if test="category!=null">