From e6753e12c6a493e0059567d594099c581bdb394b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 26 九月 2024 18:45:24 +0800
Subject: [PATCH] 预测项列表

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java |    3 ++-
 iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml                                          |   27 +++++++++++++++++++++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleItemServiceImpl.java         |    3 ---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java         |    3 ---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java        |   11 ++++++++---
 5 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleItemServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleItemServiceImpl.java
index 07d21e5..52b4efe 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleItemServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/DmModuleItemServiceImpl.java
@@ -7,7 +7,6 @@
 import com.iailab.module.model.mcs.pre.service.DmModuleItemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
@@ -23,14 +22,12 @@
     private DmModuleItemDao dmModuleItemDao;
     
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public void saveModuleItem(DmModuleItemEntity moduleItem) {
         moduleItem.setId(UUID.randomUUID().toString());
         dmModuleItemDao.insert(moduleItem);
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public void update(DmModuleItemEntity moduleItem) {
         dmModuleItemDao.updateById(moduleItem);
     }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
index 9310d7a..059ae27 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmItemOutputServiceImpl.java
@@ -9,7 +9,6 @@
 import com.iailab.module.model.mdk.vo.MmItemOutputVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
@@ -27,14 +26,12 @@
     private MmItemOutputDao mmItemOutputDao;
     
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public void saveMmItemOutput(MmItemOutputEntity mmItemOutput) {
         mmItemOutput.setId(UUID.randomUUID().toString());
         mmItemOutputDao.insert(mmItemOutput);
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
     public void update(MmItemOutputEntity mmItemOutput) {
         mmItemOutputDao.updateById(mmItemOutput);
     }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
index f26796c..cf92cf3 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmModelArithSettingsServiceImpl.java
@@ -1,5 +1,6 @@
 package com.iailab.module.model.mcs.pre.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.iailab.framework.common.service.impl.BaseServiceImpl;
@@ -23,7 +24,7 @@
 
     @Autowired
     private MmModelArithSettingsDao mmModelArithSettingsDao;
-    
+
     @Override
     public void saveList(List<MmModelArithSettingsEntity> list) {
         QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper();
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
index d229a5a..344df0c 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/service/impl/MmPredictItemServiceImpl.java
@@ -1,5 +1,6 @@
 package com.iailab.module.model.mcs.pre.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -61,7 +62,7 @@
     public PageResult<MmPredictItemRespVO> queryPage(MmPredictItemPageReqVO reqVO) {
         IPage<MmPredictItemRespVO> page = mmPredictItemDao.selectPage(reqVO);
 
-        return  new PageResult<MmPredictItemRespVO>(page.getRecords(), page.getTotal());
+        return new PageResult<MmPredictItemRespVO>(page.getRecords(), page.getTotal());
     }
 
     @Override
@@ -69,6 +70,7 @@
         return mmPredictItemDao.queryList(params);
     }
 
+    @DSTransactional(rollbackFor = Exception.class)
     @Override
     public void add(MmPredictItemDTO mmPredictItemDto) {
         MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem();
@@ -119,6 +121,7 @@
         mmItemOutputService.saveMmItemOutput(mmItemOutput);
     }
 
+    @DSTransactional(rollbackFor = Exception.class)
     @Override
     public void update(MmPredictItemDTO mmPredictItemDto) {
         MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem();
@@ -145,15 +148,16 @@
             mmPredictMergeItemService.update(mMmPredictMergeItem);
         }
         DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem();
-        if(!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null){
+        if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) {
             dmModuleItemService.update(dmModuleItem);
         }
         MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput();
-        if(!"".equals(mmItemOutput.getId()) && dmModuleItem.getId() != null){
+        if (!"".equals(mmItemOutput.getId()) && dmModuleItem.getId() != null) {
             mmItemOutputService.update(mmItemOutput);
         }
     }
 
+    @DSTransactional(rollbackFor = Exception.class)
     @Override
     public void deleteBatch(String[] itemIds) {
         mmPredictItemDao.deleteBatchIds(Arrays.asList(itemIds));
@@ -175,6 +179,7 @@
             mmPredictItemDto.setMmPredictModel(mmPredictModel);
             mmPredictItemDto.setMmModelArithSettingsList(mmModelArithSettingsService.getByModelid(mmPredictModel.getId()));
             mmPredictItemDto.setMmModelParamList(mmModelParamService.getByModelid(mmPredictModel.getId()));
+            mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity());
         } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) {
             mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id));
         }
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml
new file mode 100644
index 0000000..822a969
--- /dev/null
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/mapper/mcs/MmModelArithSettings.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.iailab.module.model.mcs.pre.dao.MmModelArithSettingsDao">
+    <select id="getMmModelArithSettings" resultType="com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity"
+            parameterType="map">
+        SELECT
+            id,
+            modelid,
+            `key`,
+            `value`,
+            name,
+            valuetype
+        FROM t_mm_model_arith_settings
+        WHERE
+            modelid = #{modelid}
+    </select>
+    <insert id="insertList" parameterType="list">
+        INSERT INTO
+        t_mm_model_arith_settings
+        ( id, modelid, `key`, `value`, name, valuetype )
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+            (#{item.id}, #{item.modelid}, #{item.key}, #{item.value}, #{item.name}, #{item.valuetype})
+        </foreach>
+    </insert>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3