From 94c169d9c7809ae78927608ef55c61d24459fdab Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期四, 12 十二月 2024 10:47:59 +0800 Subject: [PATCH] 项目打包bug --- iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/ProjectDao.xml | 23 ----------- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java | 8 ++- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java | 4 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MpkFileService.java | 2 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java | 2 - iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml | 30 +++++++++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java | 4 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java | 2 + 8 files changed, 42 insertions(+), 33 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java index 32aae26..382c140 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java @@ -118,10 +118,10 @@ } @GetMapping("packageModel") - public void packageModel(String ids ,String projectId,String log ,String projectName,String version,String zipFileName,HttpServletResponse response) throws IOException { + public void packageModel(String projectId,String log ,String projectName,String version,String zipFileName,HttpServletResponse response) throws IOException { byte[] data; try { - data = mpkFileService.packageModel(Arrays.asList(ids.split(",")),projectId,projectName,zipFileName,log,version); + data = mpkFileService.packageModel(projectId,projectName,zipFileName,log,version); } catch (InterruptedException e) { throw new RuntimeException("模型打包失败",e); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java index 3e61336..b2494af 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java @@ -32,4 +32,6 @@ List<MpkFileDTO> getProjectModel(@Param("params") Map<String, Object> params); List<MpkFileDTO> list(@Param("params") Map<String, Object> params); + + List<MpkFileDTO> selectByProjectId(@Param("projectId") String projectId); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java index 672f35a..9c0b3c7 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java @@ -18,6 +18,4 @@ @TenantDS @Mapper public interface ProjectDao extends BaseDao<ProjectEntity> { - - IPage<ProjectDTO> getPageList(IPage<ProjectEntity> page, @Param("params") Map<String, Object> params); } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MpkFileService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MpkFileService.java index b33499c..873be96 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MpkFileService.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MpkFileService.java @@ -32,7 +32,7 @@ byte[] generatorCode(String id, String remark, String zipFileName); - byte[] packageModel(List<String> ids,String projectId,String projectName,String fileName,String log,String version) throws IOException, InterruptedException; + byte[] packageModel(String projectId,String projectName,String fileName,String log,String version) throws IOException, InterruptedException; Map<String,String> savePyFile(MultipartFile file) throws IOException; diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java index 47ec99b..ba86a21 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java @@ -363,12 +363,12 @@ @Override @DSTransactional(rollbackFor = Exception.class) - public byte[] packageModel(List<String> ids, String projectId, String projectName, String zipFileName, String logs, String version) throws IOException, InterruptedException { + public byte[] packageModel(String projectId, String projectName, String zipFileName, String logs, String version) throws IOException { Long tenantId = TenantContextHolder.getTenantId(); // 备份文件 租户隔离 String mpkTenantBakFilePath = mpkBakFilePath + File.separator + tenantId; - List<MpkFileDTO> entities = baseDao.selectByIds(ids); + List<MpkFileDTO> entities = baseDao.selectByProjectId(projectId); //模板数据 // Map<String, Object> map = new HashMap<>(); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java index 86cd3a5..6095b8c 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ProjectServiceImpl.java @@ -49,9 +49,9 @@ @Override public PageData<ProjectDTO> page(Map<String, Object> params) { - IPage<ProjectDTO> page = baseDao.getPageList( + IPage<ProjectEntity> page = baseDao.selectPage( getPage(params, null, false), - params + getWrapper(params) ); return getPageData(page, ProjectDTO.class); @@ -166,10 +166,12 @@ public QueryWrapper<ProjectEntity> getWrapper(Map<String, Object> params){ String id = (String)params.get("id"); String projectName = (String)params.get("projectName"); + String projectCode = (String)params.get("projectCode"); QueryWrapper<ProjectEntity> wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), "id", id) - .like(StringUtils.isNotBlank(projectName),"project_name",projectName); + .like(StringUtils.isNotBlank(projectName),"project_name",projectName) + .like(StringUtils.isNotBlank(projectCode),"project_code",projectCode); return wrapper; } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml index 6c672b9..9a67ab3 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml @@ -182,4 +182,34 @@ LEFT JOIN t_mpk_method_setting t5 ON t4.id = t5.method_id LEFT JOIN t_mpk_setting_select t6 ON t5.id = t6.setting_id </select> + <select id="selectByProjectId" resultMap="mpkFile" parameterType="java.lang.String"> + SELECT + a.*, + b.id method_id, + b.method_name, + b.data_length, + b.model, + b.result_key, + c.id setting_id, + c.setting_key, + c.name setting_name, + c.value, + c.type, + c.value_type, + c.max, + c.min, + d.id select_id, + d.select_key, + d.name select_name + FROM + t_mpk_file a + LEFT JOIN t_mpk_project_model p ON a.id = p.model_id + LEFT JOIN t_mpk_model_method b ON a.id = b.mpk_file_id + LEFT JOIN t_mpk_method_setting c ON b.id = c.method_id + LEFT JOIN t_mpk_setting_select d ON c.id = d.setting_id + LEFT JOIN t_mpk_file_menu e ON e.name = a.menu_name + LEFT JOIN t_mpk_file_group f ON f.menu_id = e.id and f.name = a.group_name + WHERE p.project_id = #{projectId} + ORDER BY b.sort,c.sort,d.sort,e.sort,f.sort,a.create_date + </select> </mapper> \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/ProjectDao.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/ProjectDao.xml index e707de7..a29d5d1 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/ProjectDao.xml +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/ProjectDao.xml @@ -12,27 +12,4 @@ <result property="pyName" column="py_name"/> </collection> </resultMap> - - <select id="getPageList" resultMap="projectModel" resultType="com.iailab.module.model.mpk.dto.ProjectDTO"> - SELECT - t1.id, - t1.project_name, - t1.project_code, - t1.create_time, - t2.model_id, - t3.py_name - FROM - t_mpk_project t1 - LEFT JOIN t_mpk_project_model t2 on t1.id = t2.project_id - LEFT JOIN t_mpk_file t3 ON t2.model_id = t3.id - <where> - <if test="params.projectName != null and params.projectName != ''"> - and t1.project_name like CONCAT('%',#{params.projectName},'%') - </if> - <if test="params.projectCode != null and params.projectCode != ''"> - and t1.project_code like CONCAT('%',#{params.projectCode},'%') - </if> - </where> - order by t1.create_time desc - </select> </mapper> \ No newline at end of file -- Gitblit v1.9.3