From 096296cd7485c5583c8194d88cca700e3c4d84a0 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 01 十二月 2025 16:50:42 +0800
Subject: [PATCH] 调整基础配置信息查询方式,取消jpa

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/QuantityService.java |   58 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/QuantityService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/QuantityService.java
index b50bdb5..51c8ff2 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/QuantityService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/QuantityService.java
@@ -1,8 +1,10 @@
 package com.fzzy.igds.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.fzzy.igds.constant.RedisConst;
 import com.fzzy.igds.domain.QuantityConf;
-import com.fzzy.igds.repository.QuantityConfRepository;
+import com.fzzy.igds.mapper.QuantityConfMapper;
 import com.fzzy.igds.utils.ContextUtil;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.StringUtils;
@@ -24,12 +26,12 @@
 public class QuantityService {
 
     @Resource
-    private QuantityConfRepository quantityConfRepository;
+    private QuantityConfMapper quantityConfMapper;
     @Resource
     private RedisCache redisCache;
 
     /**
-     * JPA - 鏌ヨ閰嶇疆淇℃伅锛屾牴鎹簱鍖虹紪鐮佽幏鍙�
+     * 鏌ヨ閰嶇疆淇℃伅锛屾牴鎹簱鍖虹紪鐮佽幏鍙�
      *
      * @param companyId
      * @param deptId
@@ -39,15 +41,22 @@
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-
         if (StringUtils.isEmpty(deptId)) {
             deptId = ContextUtil.subDeptId(null);
         }
-        return quantityConfRepository.listQuantityConf(companyId, deptId);
+        
+        QueryWrapper<QuantityConf> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("company_id", companyId);
+        if(StringUtils.isNotBlank(deptId)){
+            queryWrapper.eq("dept_id", deptId);
+        }
+        queryWrapper.orderByAsc("order_num");
+
+        return quantityConfMapper.selectList(queryWrapper);
     }
 
     /**
-     * JPA - 鏌ヨ閰嶇疆淇℃伅锛屾牴鎹粍缁囩紪鐮佽幏鍙�
+     *  - 鏌ヨ閰嶇疆淇℃伅锛屾牴鎹粍缁囩紪鐮佽幏鍙�
      *
      * @param companyId
      * @return
@@ -57,11 +66,11 @@
             companyId = ContextUtil.getCompanyId();
         }
 
-        return quantityConfRepository.listQuantityConf(companyId);
+        return this.getConfList(companyId, null);
     }
 
     /**
-     * JPA - 鏇存柊淇濆瓨鏁版嵁
+     *  - 鏇存柊淇濆瓨鏁版嵁
      *
      * @param conf
      */
@@ -69,41 +78,50 @@
         if (StringUtils.isEmpty(conf.getDepotId())) {
             return;
         }
-        if (StringUtils.isEmpty(conf.getCompanyId())) {
+        if (StringUtils.isBlank(conf.getCompanyId())) {
             conf.setCompanyId(ContextUtil.getCompanyId());
         }
-        if (StringUtils.isEmpty(conf.getDeptId())) {
+        if (StringUtils.isBlank(conf.getDeptId())) {
             conf.setDeptId(ContextUtil.subDeptId(null));
+        }
+        if (null == conf.getUpdateBy()) {
             conf.setCreateBy(ContextUtil.getLoginUserName());
             conf.setCreateTime(new Date());
+            conf.setUpdateBy(ContextUtil.getLoginUserName());
+            conf.setUpdateTime(new Date());
+            quantityConfMapper.insert(conf);
+        }else {
+            conf.setUpdateBy(ContextUtil.getLoginUserName());
+            conf.setUpdateTime(new Date());
+            quantityConfMapper.updateById(conf);
         }
-        conf.setUpdateBy(ContextUtil.getLoginUserName());
-        conf.setUpdateTime(new Date());
-        quantityConfRepository.save(conf);
+
         //鍒锋柊缂撳瓨
-        setCacheQuantityConf(conf);
+        this.setCacheQuantityConf(conf);
     }
 
     /**
-     * JPA- 鏇存柊閰嶇疆鍜嬫贩涓お
+     * 鏇存柊淇℃伅
      *
      * @param conf
      */
     public void updateQuantityConfBySn(QuantityConf conf) {
-        //鏇存柊鐘舵��
-        quantityConfRepository.updateConfStatus(conf.getIp(), conf.getPort(), conf.getStatus(), conf.getSn());
 
-        setCacheQuantityConf(conf);
+        UpdateWrapper<QuantityConf> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("sn", conf.getSn()).set("ip", conf.getIp()).set("port", conf.getPort()).set("status", conf.getStatus());
+        quantityConfMapper.update(null, updateWrapper);
+
+        this.setCacheQuantityConf(conf);
     }
 
     /**
-     * JPA - 鍒犻櫎鏁版嵁
+     *  - 鍒犻櫎鏁版嵁
      *
      * @param conf
      * @return
      */
     public String delQuantityConf(QuantityConf conf) {
-        quantityConfRepository.delete(conf);
+        quantityConfMapper.deleteById(conf);
         //鍒犻櫎閰嶇疆淇℃伅
 
         flushConfCache(conf.getCompanyId(), conf.getDeptId());

--
Gitblit v1.9.3