From 2c296fe96659899097f650a89a56a415424c34a5 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期四, 18 七月 2024 15:55:31 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java
new file mode 100644
index 0000000..4dd26b8
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java
@@ -0,0 +1,61 @@
+package com.example.erp.service.sd;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.example.erp.entity.sd.BasicOtherMoney;
+import com.example.erp.mapper.sd.BasicOtherMoneyMapper;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@DS("sd")
+public class BasicOtherMoneyService {
+    private final BasicOtherMoneyMapper basicOtherMoneyMapper;
+
+    public BasicOtherMoneyService(BasicOtherMoneyMapper basicOtherMoneyMapper) {
+        this.basicOtherMoneyMapper = basicOtherMoneyMapper;
+    }
+
+    public List<BasicOtherMoney> findAll() {
+        return basicOtherMoneyMapper.selectList(null);
+
+    }
+
+    public int deleteById(Integer id) {
+        return basicOtherMoneyMapper.deleteById(id);
+    }
+
+    public boolean save(String alias) {
+        //鍒ゆ柇鏄惁宸茬粡瀛樺湪
+        QueryWrapper<BasicOtherMoney> queryWrapperByName = new QueryWrapper<>();
+        queryWrapperByName.eq("alias", alias);
+        int count = Math.toIntExact(basicOtherMoneyMapper.selectCount(queryWrapperByName));
+        if(count>0){
+            return false;
+        }
+
+        //鏌ヨ鏈�澶х殑鍒楀悕
+        QueryWrapper<BasicOtherMoney> queryWrapper = new QueryWrapper<>();
+        queryWrapper.orderByDesc("id");
+        List<BasicOtherMoney> basicOtherMoneyList = basicOtherMoneyMapper.selectList(queryWrapper);
+        //瓒呰繃100鏉′笉鎵ц
+        if(basicOtherMoneyList.size()==100){
+            return false;
+        }
+
+        BasicOtherMoney basicOtherMoney = basicOtherMoneyList.get(0);
+        String getColumn = basicOtherMoney.getColumn()==null?
+                "0":
+                String.valueOf(basicOtherMoney.getId());
+//                basicOtherMoney.getColumn().
+//                        replace("M","").
+//                        replace("S","");
+        int  columnNum = Integer.parseInt(getColumn)+1;
+        BasicOtherMoney newBasicOtherMoney = new  BasicOtherMoney();
+        newBasicOtherMoney.setColumn("M"+String.format("%02d", columnNum));
+        newBasicOtherMoney.setAlias(alias);
+        basicOtherMoneyMapper.insert(newBasicOtherMoney);
+        return true;
+    }
+}

--
Gitblit v1.8.0