瀏覽代碼

版本管理查询接口

czh 2 年之前
父節點
當前提交
dbd1b20a6f

+ 13 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/SysVersionController.java

@@ -42,4 +42,17 @@ public class SysVersionController {
         return HttpResult.ok(sysVersionService.findPage(reqVo));
         return HttpResult.ok(sysVersionService.findPage(reqVo));
     }
     }
 
 
+    /**
+     * @param clientType 客户端类型
+     * @return HttpResult
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    @GetMapping("/findLatestVersion")
+    public HttpResult findLatestVersion(@RequestParam(value = "clientType", required = true) String clientType,
+                                        @RequestParam(value = "systemType", required = true) Integer systemType) {
+        return HttpResult.ok(sysVersionService.findLatestVersion(systemType, clientType));
+    }
+
 }
 }

+ 10 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/SysVersionDao.java

@@ -3,6 +3,7 @@ package com.sckw.system.dao;
 import com.sckw.system.model.SysVersion;
 import com.sckw.system.model.SysVersion;
 import com.sckw.system.model.vo.req.FindVersionListReqVo;
 import com.sckw.system.model.vo.req.FindVersionListReqVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -22,4 +23,13 @@ public interface SysVersionDao {
      * @date: 2023/10/10
      * @date: 2023/10/10
      */
      */
     List<SysVersion> findList(FindVersionListReqVo reqVo);
     List<SysVersion> findList(FindVersionListReqVo reqVo);
+
+    /**
+     * @param clientType 客户端类型
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    SysVersion findLatestVersion(@Param(value = "systemType") Integer systemType, @Param(value = "clientType") String clientType);
+
 }
 }

+ 35 - 4
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/SysVersionService.java

@@ -16,10 +16,7 @@ import com.sckw.system.model.vo.res.FindVersionListResVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -64,4 +61,38 @@ public class SysVersionService {
 
 
         return PageHelperUtil.getPageResult(new PageInfo<>(findVersionListResVos), list, reqVo.getPageSize());
         return PageHelperUtil.getPageResult(new PageInfo<>(findVersionListResVos), list, reqVo.getPageSize());
     }
     }
+
+
+    /**
+     * @param clientType 客户端类型
+     * @return HttpResult
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    public FindVersionListResVo findLatestVersion(Integer systemType, String clientType) {
+        SysVersion sysVersion = sysVersionDao.findLatestVersion(systemType, clientType);
+        if (Objects.isNull(sysVersion)) {
+            return null;
+        }
+
+        FindVersionListResVo findVersionListResVo = new FindVersionListResVo();
+        BeanUtils.copyProperties(sysVersion, findVersionListResVo);
+        List<Long> userIdList = new ArrayList<>();
+        userIdList.add(sysVersion.getCreateBy());
+        userIdList.add(sysVersion.getUpdateBy());
+        Map<Long, UserCacheResDto> longUserCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(userIdList);
+        UserCacheResDto userCacheResDto = longUserCacheResDtoMap.get(sysVersion.getCreateBy());
+        if (Objects.nonNull(userCacheResDto)) {
+            findVersionListResVo.setCreateByName(userCacheResDto.getName());
+        }
+
+        UserCacheResDto userCacheResDto2 = longUserCacheResDtoMap.get(sysVersion.getUpdateBy());
+        if (Objects.nonNull(userCacheResDto2)) {
+            findVersionListResVo.setUpdateByName(userCacheResDto2.getName());
+        }
+        findVersionListResVo.setFilePath(FileUtils.splice(findVersionListResVo.getFilePath()));
+        return findVersionListResVo;
+    }
+
 }
 }

+ 13 - 1
sckw-modules/sckw-system/src/main/resources/mapper/SysVersionDao.xml

@@ -6,7 +6,8 @@
   <select id="findList" resultType="com.sckw.system.model.SysVersion">
   <select id="findList" resultType="com.sckw.system.model.SysVersion">
     select *
     select *
       from sys_version
       from sys_version
-     where 1 = 1
+     where del_flag = 0
+       and status = 0
     <if test="systemType != null">
     <if test="systemType != null">
       and system_type = #{systemType}
       and system_type = #{systemType}
     </if>
     </if>
@@ -27,4 +28,15 @@
     </if>
     </if>
   </select>
   </select>
 
 
+  <select id="findLatestVersion" resultType="com.sckw.system.model.SysVersion">
+    select *
+      from sys_version
+     where del_flag = 0
+       and status = 0
+       and client_type = #{clientType}
+       and system_type = #{systemType}
+     order by update_time desc
+     limit 1
+  </select>
+
 </mapper>
 </mapper>