iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MethodSettingService.java
@@ -1,8 +1,11 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.service.BaseService; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.dto.ModelMethodDTO; import com.iailab.module.model.mpk.entity.MethodSettingEntity; import java.util.List; import java.util.Map; /** @@ -11,4 +14,5 @@ * @date: 2024/9/14 15:10 **/ public interface MethodSettingService extends BaseService<MethodSettingEntity> { void insertList(List<MethodSettingDTO> list, String MethodId); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/SettingSelectService.java
@@ -2,6 +2,7 @@ import com.iailab.framework.common.service.BaseService; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.dto.SettingSelectDTO; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import java.util.List; @@ -16,5 +17,5 @@ void deleteByMap(Map<String, Object> map); void insertList(List<MethodSettingDTO> list, String settingId); void insertList(List<SettingSelectDTO> list, String settingId); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MethodSettingServiceImpl.java
@@ -2,14 +2,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.MethodSettingDao; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.entity.MethodSettingEntity; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import com.iailab.module.model.mpk.service.MethodSettingService; import com.iailab.module.model.mpk.service.SettingSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.List; import java.util.Map; import java.util.UUID; /** * @description: @@ -19,4 +27,21 @@ @Slf4j @Service public class MethodSettingServiceImpl extends BaseServiceImpl<MethodSettingDao, MethodSettingEntity> implements MethodSettingService { @Autowired private SettingSelectService settingSelectService; @Override public void insertList(List<MethodSettingDTO> list, String MethodId) { List<MethodSettingEntity> entityList = ConvertUtils.sourceToTarget(list, MethodSettingEntity.class); for(int i = 0; i < entityList.size(); i++){ MethodSettingEntity entity = entityList.get(i); entity.setId(UUID.randomUUID().toString()); entity.setMethodId(MethodId); entity.setSort(i); baseDao.insert(entity); if (!CollectionUtils.isEmpty(list.get(i).getSettingSelects())) { settingSelectService.insertList(list.get(i).getSettingSelects(), entity.getId()); } } } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ModelMethodServiceImpl.java
@@ -6,12 +6,14 @@ import com.iailab.module.model.mpk.dao.ModelMethodDao; import com.iailab.module.model.mpk.dto.ModelMethodDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import com.iailab.module.model.mpk.service.MethodSettingService; import com.iailab.module.model.mpk.service.ModelMethodService; import com.iailab.module.model.mpk.service.SettingSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.HashMap; import java.util.List; @@ -28,7 +30,7 @@ public class ModelMethodServiceImpl extends BaseServiceImpl<ModelMethodDao, ModelMethodEntity> implements ModelMethodService { @Autowired private SettingSelectService settingSelectService; private MethodSettingService methodSettingService; @Override public void deleteByMap(Map<String, Object> map) { @@ -52,7 +54,9 @@ entity.setMpkFileId(fileId); entity.setSort(i); baseDao.insert(entity); settingSelectService.insertList(list.get(i).getMethodSettings(), entity.getId()); if (!CollectionUtils.isEmpty(list.get(i).getMethodSettings())) { methodSettingService.insertList(list.get(i).getMethodSettings(), entity.getId()); } } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/SettingSelectServiceImpl.java
@@ -5,6 +5,7 @@ import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.SettingSelectDao; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.dto.SettingSelectDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import com.iailab.module.model.mpk.service.SettingSelectService; @@ -41,7 +42,7 @@ } @Override public void insertList(List<MethodSettingDTO> list, String settingId) { public void insertList(List<SettingSelectDTO> list, String settingId) { List<SettingSelectEntity> entityList = ConvertUtils.sourceToTarget(list, SettingSelectEntity.class); for(int i = 0; i < entityList.size(); i++){ SettingSelectEntity entity = entityList.get(i); iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mpk/MpkFileDao.xml
@@ -68,6 +68,7 @@ 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 WHERE a.id = #{id} ORDER BY b.sort,c.sort,d.sort </select> <select id="selectByIds" resultMap="mpkFile"> SELECT @@ -99,7 +100,7 @@ <foreach collection="ids" item="item" open="(" close=")" separator=","> #{item} </foreach> ORDER BY e.sort,f.sort,a.create_date ORDER BY b.sort,c.sort,d.sort,e.sort,f.sort,a.create_date </select> <select id="getProjectModelCount" resultType="java.lang.Integer" parameterType="java.lang.String"> SELECT