From 05647012a03d704cf653db6f9a5dd931d7714da5 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 10 九月 2024 09:26:37 +0800
Subject: [PATCH] 调度方案配置

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java     |    9 +++++++++
 iailab-module-model/iailab-module-model-biz/db/mysql.sql                                                                                       |   12 ++++++------
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelService.java                 |    4 ++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java        |    7 +++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java   |    1 +
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java |    7 +++++--
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelSettingEntity.java            |    3 +++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java                   |    4 ++--
 8 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/db/mysql.sql b/iailab-module-model/iailab-module-model-biz/db/mysql.sql
index fd22ec0..e0c8110 100644
--- a/iailab-module-model/iailab-module-model-biz/db/mysql.sql
+++ b/iailab-module-model/iailab-module-model-biz/db/mysql.sql
@@ -256,8 +256,8 @@
 create table t_st_schedule_scheme
 (
   `id`                varchar(36) not null COMMENT 'ID',
-  `code`              varchar(20) COMMENT '编号',
-  `name`              varchar(20) COMMENT '名称',
+  `code`              varchar(20) not null COMMENT '编号',
+  `name`              varchar(20) not null COMMENT '名称',
   `trigger_method`    varchar(20) COMMENT '触发方式',
   `trigger_condition` varchar(20) COMMENT '触发条件',
   `schedule_obj`      varchar(20) COMMENT '调整对象',
@@ -280,8 +280,8 @@
 create table t_st_schedule_model
 (
   `id`              varchar(36) not null COMMENT 'ID',
-  `model_code`      varchar(64) COMMENT '模型编号',
-  `model_name`      varchar(64) COMMENT '模型名称',
+  `model_code`      varchar(64) not null COMMENT '模型编号',
+  `model_name`      varchar(64) not null COMMENT '模型名称',
   `model_type`      varchar(64) COMMENT '模型类型',
   `class_name`      varchar(128) COMMENT '类名',
   `method_name`     varchar(64) COMMENT '方法名',
@@ -304,7 +304,7 @@
   t_st_schedule_model_param
 (
   id                  varchar(36) not null,
-  modelid             varchar(64),
+  modelid             varchar(64) not null,
   modelparamname      varchar(64),
   modelparamid        varchar(64),
   modelparamorder     integer,
@@ -320,7 +320,7 @@
   t_st_schedule_model_setting
 (
   `id`        varchar(36) not null,
-  `modelid`   varchar(64),
+  `modelid`   varchar(64) not null,
   `key`       varchar(64),
   `value`     varchar(64),
   `valuetype` varchar(64),
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
index 71e3fe6..71ad196 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
@@ -16,6 +16,8 @@
 
 import javax.validation.Valid;
 
+import java.util.List;
+
 import static com.iailab.framework.common.pojo.CommonResult.error;
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -39,6 +41,13 @@
         return success(BeanUtils.toBean(page, StScheduleModelRespVO.class));
     }
 
+    @GetMapping("/list")
+    @PreAuthorize("@ss.hasPermission('sche:model:query')")
+    public CommonResult<List<StScheduleModelRespVO>> list() {
+        List<StScheduleModelEntity> list = stScheduleModelService.list();
+        return success(BeanUtils.toBean(list, StScheduleModelRespVO.class));
+    }
+
     @GetMapping("/get")
     @Operation(summary = "获得详情")
     @PreAuthorize("@ss.hasPermission('sche:model:query')")
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelSettingEntity.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelSettingEntity.java
index d1f44ca..ab9e589 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelSettingEntity.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/entity/StScheduleModelSettingEntity.java
@@ -1,6 +1,7 @@
 package com.iailab.module.model.mcs.sche.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -31,11 +32,13 @@
     /**
      * 键
      */
+    @TableField(value = "`key`")
     private String key;
 
     /**
      * 值
      */
+    @TableField(value = "`value`")
     private String value;
 
     /**
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelService.java
index 619b1f4..688f976 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelService.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleModelService.java
@@ -6,6 +6,8 @@
 import com.iailab.module.model.mcs.sche.vo.StScheduleModelPageReqVO;
 import com.iailab.module.model.mcs.sche.vo.StScheduleModelSaveReqVO;
 
+import java.util.List;
+
 /**
  * @author PanZhibao
  * @date 2021年07月20日 14:13
@@ -14,6 +16,8 @@
 
     PageResult<StScheduleModelEntity> page(StScheduleModelPageReqVO reqVO);
 
+    List<StScheduleModelEntity> list();
+
     void create(StScheduleModelSaveReqVO reqVO);
 
     void update(StScheduleModelSaveReqVO reqVO);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
index 3680138..80c17ca 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelParamServiceImpl.java
@@ -48,6 +48,7 @@
         saveList.forEach(item -> {
             StScheduleModelParamEntity entity = BeanUtils.toBean(item, StScheduleModelParamEntity.class);
             entity.setId(UUID.randomUUID().toString());
+            entity.setModelid(modelId);
             baseDao.insert(entity);
         });
     }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
index c41ed67..35abed9 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelServiceImpl.java
@@ -16,6 +16,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 import java.util.UUID;
 
 /**
@@ -37,6 +38,12 @@
     }
 
     @Override
+    public List<StScheduleModelEntity> list() {
+
+        return baseDao.selectList(null);
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
     public void create(StScheduleModelSaveReqVO reqVO) {
         StScheduleModelEntity entity = BeanUtils.toBean(reqVO, StScheduleModelEntity.class);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
index a2caba9..d21da80 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleModelSettingServiceImpl.java
@@ -44,10 +44,13 @@
         if (CollectionUtils.isEmpty(saveList)) {
             return;
         }
-        saveList.forEach(item -> {
+        for (int i = 0; i < saveList.size(); i++) {
+            StScheduleModelSettingSaveReqVO item = saveList.get(i);
             StScheduleModelSettingEntity entity = BeanUtils.toBean(item, StScheduleModelSettingEntity.class);
             entity.setId(UUID.randomUUID().toString());
+            entity.setModelid(modelId);
+            entity.setSort(i);
             baseDao.insert(entity);
-        });
+        }
     }
 }
\ No newline at end of file
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java
index 37a8ba1..aa8e8c0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/vo/StScheduleSchemeSaveReqVO.java
@@ -20,11 +20,11 @@
 
     @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "编号不能为空")
-    private String appCode;
+    private String code;
 
     @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotNull(message = "名称不能为空")
-    private String appName;
+    private String name;
 
     @Schema(description = "触发方式")
     private String triggerMethod;

--
Gitblit v1.9.3