Просмотр исходного кода

文件列表,排序改为以 update_time 降序

tsurumure 3 месяцев назад
Родитель
Сommit
36272bb9ce

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

@@ -164,7 +164,7 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
     public Map<String, Object> multipartUpload(MultipartFile multipartFile, String upload_id, Integer upload_chunk_index) {
 
         // 按用户加锁
-        RLock lock = redissonClient.getLock("multipartUpload:" + SecurityUtil.getUserId());
+        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
         try { lock.tryLock(3, TimeUnit.SECONDS);
 
             if (multipartFile.isEmpty()) throw new CustException("file 上传文件不能为空");

+ 3 - 1
src/main/java/com/backendsys/utils/v2/TableSupport.java

@@ -13,7 +13,9 @@ public class TableSupport {
     public static final String REASONABLE = "reasonable";               // 分页参数合理化
 
     /**
-     * 封装分页对象
+     * 封装分页对象,要注意:
+     * - 如果 dao.xml 已定义了 orderBy,则会以 xml 的排序为准 (order_by_column、is_asc 将无效)
+     * - 如果 dao.xml 存在 JOIN 关联表,则 order_by_column 需要带着表参数,像 (f.create_time) (建议还是自定义去写排序)
      */
     public static PageDomain getPageDomain() {
         PageDomain pageDomain = new PageDomain();

+ 1 - 1
src/main/resources/mapper/upload/SysFileDao.xml

@@ -72,7 +72,7 @@
                 AND f.target = #{target}
             </if>
         </where>
-        ORDER BY f.create_time DESC
+        ORDER BY f.update_time DESC
     </select>
 
     <update id="updateFile" parameterType="com.backendsys.modules.upload.entity.SysFile"