Forráskód Böngészése

修复文件分类批量更新

tsurumure 3 hónapja
szülő
commit
a5ec0544fe

+ 9 - 1
src/main/java/com/backendsys/modules/upload/service/impl/SysFileMultipartServiceImpl.java

@@ -261,7 +261,15 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
 
         }
 
-        // 设置封面
+        // 如果是图片类型,就设置封面
+        /*
+            图片Icon (png / jpg / jpeg / gif / bmp / webp)
+            视频 Icon (mp4 / avi / mov / flv / 3gp / mpeg / wmv)
+            Word Icon (doc / docx)
+            Excel Icon (xls / xlsx)
+            PDF Icon (pdf)
+            其他 Icon
+         */
         setThumbUrl(sysFileEntity, UPLOAD_THUMB_SIZE.get(), UPLOAD_THUMB_SIZE.get(), StyleEnums.THUMB_BACKGROUND.getValue());
 
         // [db] 更新分块记录

+ 14 - 7
src/main/resources/mapper/upload/SysFileCategoryDao.xml

@@ -41,14 +41,21 @@
 
     <!-- 批量插入 -->
     <insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO sys_file_category (user_id, category_name, sort, status) VALUES
+        INSERT INTO sys_file_category
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="item.user_id != null">user_id,</if>
+            <if test="item.category_name != null and item.category_name != ''">category_name,</if>
+            <if test="item.sort != null">sort,</if>
+            <if test="item.status != null">status,</if>
+        </trim>
+        VALUES
         <foreach collection="list" item="item" separator=",">
-            (
-                #{item.user_id},
-                #{item.category_name},
-                #{item.sort},
-                #{item.status}
-            )
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.user_id != null">#{item.user_id},</if>
+                <if test="item.category_name != null and item.category_name != ''">#{item.category_name},</if>
+                <if test="item.sort != null">#{item.sort},</if>
+                <if test="item.status != null">#{item.status},</if>
+            </trim>
         </foreach>
     </insert>