| | |
| | | package com.iailab.module.model.mpk.controller.admin; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.model.mpk.common.utils.Readtxt; |
| | | import com.iailab.module.model.mpk.dto.MpkFileDTO; |
| | | import com.iailab.module.model.mpk.service.MdkFileService; |
| | | import com.iailab.module.model.mpk.service.MpkFileService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | @RequestMapping("/model/mpk/file") |
| | | public class MpkFileController { |
| | | @Autowired |
| | | private MdkFileService mdkFileService; |
| | | private MpkFileService mpkFileService; |
| | | |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | public CommonResult<PageData<MpkFileDTO>> page(@RequestParam Map<String, Object> params) { |
| | | PageData<MpkFileDTO> page = mdkFileService.page(params); |
| | | PageData<MpkFileDTO> page = mpkFileService.page(params); |
| | | |
| | | return success(page); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | public CommonResult<MpkFileDTO> info(@PathVariable("id") String id) { |
| | | MpkFileDTO schedule = mdkFileService.get(id); |
| | | MpkFileDTO schedule = mpkFileService.get(id); |
| | | |
| | | return success(schedule); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<MpkFileDTO>> list() { |
| | | List<MpkFileDTO> list = mdkFileService.list(new HashMap<>()); |
| | | List<MpkFileDTO> list = mpkFileService.list(new HashMap<>()); |
| | | |
| | | return success(list); |
| | | } |
| | | |
| | | @PostMapping |
| | | public CommonResult save(@RequestBody MpkFileDTO dto) { |
| | | mdkFileService.save(dto); |
| | | mpkFileService.save(dto); |
| | | return CommonResult.success(); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | public CommonResult delete(String id) { |
| | | mdkFileService.delete(id); |
| | | mpkFileService.delete(id); |
| | | return CommonResult.success(); |
| | | } |
| | | |
| | | @PutMapping |
| | | public CommonResult update(@RequestBody MpkFileDTO dto) { |
| | | mdkFileService.update(dto); |
| | | mpkFileService.update(dto); |
| | | return CommonResult.success(); |
| | | } |
| | | |
| | | @GetMapping("generat") |
| | | public void generat(String id, String remark,String zipFileName, HttpServletResponse response) throws IOException { |
| | | byte[] data = mdkFileService.generatorCode(id, remark,zipFileName); |
| | | byte[] data = mpkFileService.generatorCode(id, remark,zipFileName); |
| | | |
| | | response.reset(); |
| | | response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(zipFileName, "UTF-8") + "\""); |
| | |
| | | public void packageModel(String ids ,String projectId,String log ,String projectName,String version,String zipFileName,HttpServletResponse response) throws IOException { |
| | | byte[] data; |
| | | try { |
| | | data = mdkFileService.packageModel(Arrays.asList(ids.split(",")),projectId,projectName,zipFileName,log,version); |
| | | data = mpkFileService.packageModel(Arrays.asList(ids.split(",")),projectId,projectName,zipFileName,log,version); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException("模型打包失败",e); |
| | | } |
| | |
| | | @PostMapping("/upload") |
| | | @Operation(summary = "python文件上传") |
| | | public CommonResult<Map<String,String>> importExcel(@RequestParam("file") MultipartFile file) throws Exception { |
| | | Map<String,String> result = mdkFileService.savePyFile(file); |
| | | Map<String,String> result = mpkFileService.savePyFile(file); |
| | | return success(result); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @description: 方法参数关联表 |
| | | * @author: dzd |
| | | * @date: 2024/9/13 15:49 |
| | | **/ |
| | | @Data |
| | | public class MethodSettingDTO implements Serializable { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * '方法id' |
| | | */ |
| | | private String methodId; |
| | | |
| | | /** |
| | | * key |
| | | */ |
| | | private String settingKey; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 参数默认值 |
| | | */ |
| | | private String value; |
| | | |
| | | /** |
| | | * 输入类型 |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 参数类型 |
| | | */ |
| | | private String valueType; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private Integer max; |
| | | |
| | | /** |
| | | * 最小值 |
| | | */ |
| | | private Integer min; |
| | | |
| | | private List<SettingSelectDTO> settingSelects; |
| | | } |
| | |
| | | package com.iailab.module.model.mpk.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @description: MPK模型方法 |
| | |
| | | private Integer dataLength; |
| | | |
| | | private Integer model; |
| | | |
| | | private String resultKey; |
| | | |
| | | private List<MethodSettingDTO> methodSettings; |
| | | } |
| | |
| | | |
| | | private String pyName; |
| | | |
| | | private String pyChineseName; |
| | | |
| | | private String filePath; |
| | | |
| | | private String pyType; |
| | |
| | | private String className; |
| | | |
| | | private String pyModule; |
| | | |
| | | private String icon; |
| | | |
| | | private String menuName; |
| | | |
| | | private String groupName; |
| | | |
| | | private String remark; |
| | | |
| | |
| | | |
| | | private Date createDate; |
| | | |
| | | private List<ModelMethodEntity> modelMethods; |
| | | private List<ModelMethodDTO> modelMethods; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description: 参数选项关联表 |
| | | * @author: dzd |
| | | * @date: 2024/9/13 15:49 |
| | | **/ |
| | | @Data |
| | | public class SettingSelectDTO implements Serializable { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * '参数id' |
| | | */ |
| | | private String settingId; |
| | | |
| | | /** |
| | | * key |
| | | */ |
| | | private String selectKey; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import org.checkerframework.checker.units.qual.min; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description: 方法参数关联表 |
| | | * @author: dzd |
| | | * @date: 2024/9/13 15:49 |
| | | **/ |
| | | @Data |
| | | @TableName("t_mpk_method_setting") |
| | | public class MethodSettingEntity implements Serializable { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId |
| | | private String id; |
| | | |
| | | /** |
| | | * 方法id |
| | | */ |
| | | private String methodId; |
| | | |
| | | /** |
| | | * key |
| | | */ |
| | | private String settingKey; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 参数默认值 |
| | | */ |
| | | private String value; |
| | | |
| | | /** |
| | | * 输入类型 |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 参数类型 |
| | | */ |
| | | private String valueType; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private Integer max; |
| | | |
| | | /** |
| | | * 最小值 |
| | | */ |
| | | private Integer min; |
| | | } |
| | |
| | | * 是否有model(0:否,1:是) |
| | | */ |
| | | private Integer model; |
| | | /** |
| | | * 结果key |
| | | */ |
| | | private String resultKey; |
| | | } |
| | |
| | | private String pyName; |
| | | |
| | | /** |
| | | * 模型中文名称 |
| | | */ |
| | | private String pyChineseName; |
| | | |
| | | /** |
| | | * 源文件保存路径 |
| | | */ |
| | | private String filePath; |
| | |
| | | private String pyModule; |
| | | |
| | | /** |
| | | * icon图片名 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * 所属菜单 |
| | | */ |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 所属组 |
| | | */ |
| | | private String groupName; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @description: 参数选项关联表 |
| | | * @author: dzd |
| | | * @date: 2024/9/13 15:49 |
| | | **/ |
| | | @Data |
| | | @TableName("t_mpk_setting_select") |
| | | public class SettingSelectEntity implements Serializable { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId |
| | | private String id; |
| | | |
| | | /** |
| | | * '参数id' |
| | | */ |
| | | private String settingId; |
| | | |
| | | /** |
| | | * key |
| | | */ |
| | | private String selectKey; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mpk.entity.MethodSettingEntity; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/9/14 15:10 |
| | | **/ |
| | | public interface MethodSettingService extends BaseService<MethodSettingEntity> { |
| | | } |
文件名从 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/MdkFileService.java 修改 |
| | |
| | | * @Description |
| | | * @createTime 2024年08月14日 |
| | | */ |
| | | public interface MdkFileService extends BaseService<MpkFileEntity> { |
| | | public interface MpkFileService extends BaseService<MpkFileEntity> { |
| | | |
| | | PageData<MpkFileDTO> page(Map<String, Object> params); |
| | | |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mpk.entity.SettingSelectEntity; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/9/14 15:10 |
| | | **/ |
| | | public interface SettingSelectService extends BaseService<SettingSelectEntity> { |
| | | |
| | | void deleteByMap(Map<String, Object> map); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mpk.dao.MethodSettingDao; |
| | | import com.iailab.module.model.mpk.entity.MethodSettingEntity; |
| | | import com.iailab.module.model.mpk.service.MethodSettingService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/9/14 15:12 |
| | | **/ |
| | | @Slf4j |
| | | @Service |
| | | public class MethodSettingServiceImpl extends BaseServiceImpl<MethodSettingDao, MethodSettingEntity> implements MethodSettingService { |
| | | } |
文件名从 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MdkFileServiceImpl.java 修改 |
| | |
| | | import com.iailab.module.model.mpk.common.MdkConstant; |
| | | import com.iailab.module.model.mpk.common.utils.GenUtils; |
| | | import com.iailab.module.model.mpk.dao.MpkFileDao; |
| | | import com.iailab.module.model.mpk.dto.GeneratorCodeHistoryDTO; |
| | | import com.iailab.module.model.mpk.dto.MpkFileDTO; |
| | | import com.iailab.module.model.mpk.dto.ProjectPackageHistoryDTO; |
| | | import com.iailab.module.model.mpk.entity.GeneratorCodeHistoryEntity; |
| | | import com.iailab.module.model.mpk.entity.ModelMethodEntity; |
| | | import com.iailab.module.model.mpk.entity.MpkFileEntity; |
| | | import com.iailab.module.model.mpk.entity.ProjectPackageHistoryModelEntity; |
| | | import com.iailab.module.model.mpk.dto.*; |
| | | import com.iailab.module.model.mpk.entity.*; |
| | | import com.iailab.module.model.mpk.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FileUtils; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class MdkFileServiceImpl extends BaseServiceImpl<MpkFileDao, MpkFileEntity> implements MdkFileService { |
| | | public class MpkFileServiceImpl extends BaseServiceImpl<MpkFileDao, MpkFileEntity> implements MpkFileService { |
| | | |
| | | @Autowired |
| | | private GeneratorCodeHistoryService generatorCodeHistoryService; |
| | |
| | | private ProjectPackageHistoryService projectPackageHistoryService; |
| | | @Autowired |
| | | private ModelMethodService modelMethodService; |
| | | @Autowired |
| | | private MethodSettingService methodSettingService; |
| | | @Autowired |
| | | private SettingSelectService settingSelectService; |
| | | @Autowired |
| | | private ProjectPackageHistoryModelService projectPackageHistoryModelService; |
| | | |
| | |
| | | updateById(entity); |
| | | |
| | | String mpkId = dto.getId(); |
| | | // 删除模型方法 |
| | | // 删除模型方法 会级联删除setting和select |
| | | deleteModelMethod(mpkId); |
| | | |
| | | // 添加模型方法 |
| | | insertModelMethod(dto.getModelMethods(),mpkId); |
| | | } |
| | | |
| | | private void insertModelMethod(List<ModelMethodEntity> modelMethods,String mpkId) { |
| | | private void insertModelMethod(List<ModelMethodDTO> modelMethods, String mpkId) { |
| | | List<MethodSettingDTO> methodSettingList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(modelMethods)) { |
| | | modelMethods.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | String methodId = UUID.randomUUID().toString(); |
| | | e.setId(methodId); |
| | | e.setMpkFileId(mpkId); |
| | | |
| | | e.getMethodSettings().forEach(s -> { |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setMethodId(methodId); |
| | | methodSettingList.add(s); |
| | | }); |
| | | |
| | | }); |
| | | modelMethodService.insertBatch(modelMethods); |
| | | modelMethodService.insertBatch(ConvertUtils.sourceToTarget(modelMethods, ModelMethodEntity.class)); |
| | | |
| | | //添加setting |
| | | insertMethodSetting(methodSettingList); |
| | | } |
| | | } |
| | | |
| | | private void insertMethodSetting(List<MethodSettingDTO> methodSettings) { |
| | | List<SettingSelectEntity> settingSelectList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(methodSettings)) { |
| | | methodSettings.forEach(e -> { |
| | | String settingId = UUID.randomUUID().toString(); |
| | | e.setId(settingId); |
| | | |
| | | e.getSettingSelects().forEach(s -> { |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setSettingId(settingId); |
| | | settingSelectList.add(ConvertUtils.sourceToTarget(s,SettingSelectEntity.class)); |
| | | }); |
| | | |
| | | }); |
| | | methodSettingService.insertBatch(ConvertUtils.sourceToTarget(methodSettings, MethodSettingEntity.class)); |
| | | |
| | | //添加select |
| | | settingSelectService.insertBatch(settingSelectList); |
| | | } |
| | | } |
| | | |
| | | private void deleteModelMethod(String mpkId) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("mpkFileId", mpkId); |
| | |
| | | } |
| | | } |
| | | |
| | | //删除 |
| | | deleteById(id); |
| | | |
| | | //删除备份文件 |
| | | Map<String,Object> map1 = new HashMap<>(); |
| | | map1.put("mdkId",id); |
| | |
| | | } |
| | | }); |
| | | |
| | | //删除生成历史 |
| | | //删除 会级联删除掉关联表 |
| | | deleteById(id); |
| | | |
| | | generatorCodeHistoryService.deleteByMap(map1); |
| | | //删除生成历史 |
| | | // generatorCodeHistoryService.deleteByMap(map1); |
| | | |
| | | //删除关联项目 |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("modelId",id); |
| | | projectModelService.deleteByMap(map); |
| | | // Map<String,Object> map = new HashMap<>(); |
| | | // map.put("modelId",id); |
| | | // projectModelService.deleteByMap(map); |
| | | |
| | | //删除模型方法 |
| | | deleteModelMethod(id); |
| | | // deleteModelMethod(id); |
| | | |
| | | } |
| | | |
| | |
| | | entity.setPkgName(e.getPkgName()); |
| | | entity.setPyModule(e.getPyModule()); |
| | | entity.setRemark(e.getRemark()); |
| | | List<ModelMethodEntity> methods = e.getModelMethods(); |
| | | List<ModelMethodDTO> methods = e.getModelMethods(); |
| | | if (!CollectionUtils.isEmpty(methods)) { |
| | | entity.setMethodInfo(JSON.toJSONString(methods)); |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(String id) { |
| | | |
| | | //删除 |
| | | baseDao.deleteById(id); |
| | | |
| | | //删除模型关联 |
| | | //删除备份文件 |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("projectId",id); |
| | | projectModelService.deleteByMap(map); |
| | | |
| | | //删除备份文件 |
| | | List<ProjectPackageHistoryDTO> list = projectPackageHistoryService.list(map); |
| | | list.forEach(e -> { |
| | | File file = new File(e.getFilePath()); |
| | |
| | | } |
| | | }); |
| | | |
| | | //删除 (级联删除) |
| | | baseDao.deleteById(id); |
| | | |
| | | //删除模型关联 |
| | | // projectModelService.deleteByMap(map); |
| | | |
| | | //删除打包历史 |
| | | projectPackageHistoryService.deleteByMap(map); |
| | | // projectPackageHistoryService.deleteByMap(map); |
| | | |
| | | //删除打包历史模型关联 |
| | | projectPackageHistoryModelService.deleteByMap(map); |
| | | // projectPackageHistoryModelService.deleteByMap(map); |
| | | } |
| | | |
| | | @Override |
对比新文件 |
| | |
| | | package com.iailab.module.model.mpk.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mpk.dao.SettingSelectDao; |
| | | import com.iailab.module.model.mpk.entity.SettingSelectEntity; |
| | | import com.iailab.module.model.mpk.service.SettingSelectService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2024/9/14 15:13 |
| | | **/ |
| | | @Slf4j |
| | | @Service |
| | | public class SettingSelectServiceImpl extends BaseServiceImpl<SettingSelectDao, SettingSelectEntity> implements SettingSelectService { |
| | | |
| | | |
| | | @Override |
| | | public void deleteByMap(Map<String, Object> map) { |
| | | baseDao.delete(getWrapper(map)); |
| | | } |
| | | |
| | | private QueryWrapper<SettingSelectEntity> getWrapper(Map<String, Object> params) { |
| | | String settingId = (String) params.get("settingId"); |
| | | |
| | | QueryWrapper<SettingSelectEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(settingId), "setting_id", settingId); |
| | | |
| | | return wrapper; |
| | | } |
| | | } |
| | |
| | | <resultMap id="mpkFile" type="com.iailab.module.model.mpk.dto.MpkFileDTO"> |
| | | <id property="id" column="id"/> |
| | | <result property="pyName" column="py_name"/> |
| | | <result property="pyChineseName" column="py_chinese_name"/> |
| | | <result property="filePath" column="file_path"/> |
| | | <result property="pyType" column="py_type"/> |
| | | <result property="pkgName" column="pkg_name"/> |
| | | <result property="className" column="class_name"/> |
| | | <result property="pyModule" column="py_module"/> |
| | | <result property="icon" column="icon"/> |
| | | <result property="menuName" column="menu_name"/> |
| | | <result property="groupName" column="group_name"/> |
| | | <result property="remark" column="remark"/> |
| | | <result property="creator" column="creator"/> |
| | | <result property="createDate" column="create_date"/> |
| | | <result property="updater" column="updater"/> |
| | | <result property="updateDate" column="update_date"/> |
| | | <collection property="modelMethods" ofType="com.iailab.module.model.mpk.entity.ModelMethodEntity"> |
| | | <collection property="modelMethods" ofType="com.iailab.module.model.mpk.dto.ModelMethodDTO"> |
| | | <id property="id" column="method_id"/> |
| | | <result property="methodName" column="method_name"/> |
| | | <result property="dataLength" column="data_length"/> |
| | | <result property="model" column="model"/> |
| | | <result property="resultKey" column="result_key"/> |
| | | <collection property="methodSettings" ofType="com.iailab.module.model.mpk.dto.MethodSettingDTO"> |
| | | <id property="id" column="setting_id"/> |
| | | <result property="settingKey" column="setting_key"/> |
| | | <result property="name" column="setting_name"/> |
| | | <result property="value" column="value"/> |
| | | <result property="type" column="type"/> |
| | | <result property="valueType" column="value_type"/> |
| | | <result property="max" column="max"/> |
| | | <result property="min" column="min"/> |
| | | <collection property="settingSelects" ofType="com.iailab.module.model.mpk.dto.SettingSelectDTO"> |
| | | <id property="id" column="select_id"/> |
| | | <result property="selectKey" column="select_key"/> |
| | | <result property="name" column="select_name"/> |
| | | </collection> |
| | | </collection> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | |
| | | b.id method_id, |
| | | b.method_name, |
| | | b.data_length, |
| | | b.model |
| | | 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_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 |
| | | WHERE a.id = #{id} |
| | | </select> |
| | | <select id="selectByIds" resultMap="mpkFile"> |
| | |
| | | b.id method_id, |
| | | b.method_name, |
| | | b.data_length, |
| | | b.model |
| | | 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_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 |
| | | WHERE a.id in |
| | | <foreach collection="ids" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | |
| | | </select> |
| | | <select id="getProjectModel" resultMap="mpkFile"> |
| | | SELECT |
| | | t3.*,t4.method_name,t4.data_length,t4.model |
| | | t3.*, |
| | | t4.method_name, |
| | | t4.data_length, |
| | | t4.model, |
| | | t4.result_key, |
| | | t5.id setting_id, |
| | | t5.setting_key, |
| | | t5.name setting_name, |
| | | t5.value, |
| | | t5.type, |
| | | t5.value_type, |
| | | t5.max, |
| | | t5.min, |
| | | t6.id select_id, |
| | | t6.select_key, |
| | | t6.name select_name |
| | | FROM |
| | | ( |
| | | SELECT |
| | |
| | | LIMIT #{params.offset},#{params.pageSize} |
| | | ) t3 |
| | | LEFT JOIN t_mpk_model_method t4 ON t3.id = t4.mpk_file_id |
| | | 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> |
| | | </mapper> |