From 587b438f50abb725f3dee63eaf6b586c09085f54 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 26 九月 2024 09:59:14 +0800
Subject: [PATCH] bug + 模型方法参数排序

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java |   60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
index c84413b..267f2c0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
@@ -5,9 +5,16 @@
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO;
+import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity;
+import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity;
 import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity;
+import com.iailab.module.model.mcs.pre.service.MmItemOutputService;
+import com.iailab.module.model.mcs.pre.service.MmItemTypeService;
 import com.iailab.module.model.mcs.pre.service.MmPredictItemService;
-import com.iailab.module.model.mcs.pre.vo.*;
+import com.iailab.module.model.mcs.pre.service.MmResultTableService;
+import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO;
+import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO;
+import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -17,9 +24,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
 
-import static com.iailab.framework.common.pojo.CommonResult.error;
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
 /**
@@ -33,21 +38,48 @@
     @Autowired
     private MmPredictItemService mmPredictItemService;
 
+    @Autowired
+    private MmItemTypeService mmItemTypeService;
+
+    @Autowired
+    private MmItemOutputService mmItemOutputService;
+
+    @Autowired
+    private MmResultTableService mmResultTableService;
+
     /**
      * 预测项列表
      */
     @GetMapping("/page")
-    @PreAuthorize("@ss.hasPermission('model:pre-predict:query')")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
     public CommonResult<PageResult<MmPredictItemRespVO>> page(@Validated MmPredictItemPageReqVO reqVO) {
         PageResult<MmPredictItemEntity> page = mmPredictItemService.queryPage(reqVO);
-        return success(BeanUtils.toBean(page, MmPredictItemRespVO.class));
+        PageResult<MmPredictItemRespVO> result = BeanUtils.toBean(page, MmPredictItemRespVO.class);
+        for (MmPredictItemRespVO item : result.getList()){
+
+            MmItemTypeEntity mmItemTypeEntity = mmItemTypeService.info(item.getItemtypeid());
+            item.setItemtypename(mmItemTypeEntity== null ? "" :mmItemTypeEntity.getItemtypename());
+
+            MmItemOutputEntity mmItemOutputEntity = mmItemOutputService.getByItemid(item.getId());
+            item.setTagname(mmItemOutputEntity== null ? "" :mmItemOutputEntity.getTagname());
+            item.setResulttableid(mmItemOutputEntity== null ? "" :mmItemOutputEntity.getResulttableid());
+            item.setTablename(item == null ? "" : mmResultTableService.info(item.getResulttableid()).getTablename());
+        }
+        return success(result);
+    }
+
+    @GetMapping("/list")
+    public CommonResult<List<MmPredictItemEntity>> list() {
+        List<MmPredictItemEntity> list = mmPredictItemService.list();
+
+        return success(list);
     }
 
     /**
      * 预测项信息
      */
     @GetMapping("/get/{id}")
-    @PreAuthorize("@ss.hasPermission('model:pre-predict:query')")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
     public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id){
         MmPredictItemDTO predictItem = mmPredictItemService.info(id);
         return success(predictItem);
@@ -57,12 +89,10 @@
      * 保存预测项
      */
     @PostMapping("/create")
-    @PreAuthorize("@ss.hasPermission('model:pre-predict:create')")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:create')")
     @DSTransactional(rollbackFor= Exception.class)
-    public CommonResult<Boolean> save(@RequestBody MmPredictItemEntity mmPredictItemEntity){
-        String id = UUID.randomUUID().toString();
-        mmPredictItemEntity.setId(id);
-        mmPredictItemService.add(mmPredictItemEntity);
+    public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){
+        mmPredictItemService.add(mmPredictItemDto);
         return success(true);
     }
 
@@ -70,10 +100,10 @@
      * 修改预测项
      */
     @PutMapping("/update")
-    @PreAuthorize("@ss.hasPermission('model:pre-predict:update')")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:update')")
     @DSTransactional(rollbackFor= Exception.class)
-    public CommonResult<Boolean> update(@RequestBody MmPredictItemEntity mmPredictItemEntity){
-        mmPredictItemService.update(mmPredictItemEntity);
+    public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDTO){
+        mmPredictItemService.update(mmPredictItemDTO);
         return success(true);
     }
 
@@ -81,7 +111,7 @@
      * 删除预测项
      */
     @DeleteMapping("/delete")
-    @PreAuthorize("@ss.hasPermission('model:pre-predict:delete')")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:delete')")
     @DSTransactional(rollbackFor= Exception.class)
     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         mmPredictItemService.deleteBatch(new String[]{id});

--
Gitblit v1.9.3