From d5bb894f9be2e0a3b62d475b60b44f2ab138528c Mon Sep 17 00:00:00 2001 From: guoyujie <guoyujie@ng.com> Date: 星期四, 12 六月 2025 16:48:35 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override --- north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java | 68 ++++++++++++++++++++++++++++++++++ 1 files changed, 68 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..ee61c06 --- /dev/null +++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicOtherMoneyService.java @@ -0,0 +1,68 @@ +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; + } + + public List<BasicOtherMoney> findAllByState() { + return basicOtherMoneyMapper.selectList( + new QueryWrapper<BasicOtherMoney>(). + eq("state",1). + like("`column`","S")); + } +} -- Gitblit v1.8.0