From e1d063d2de617910dad7e5f0481d9bfcd49e7651 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期六, 05 七月 2025 17:29:46 +0800 Subject: [PATCH] art:vue模板修改,重置按钮 primary 改为 info --- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamBaseHFCodeServiceImpl.java | 91 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 91 insertions(+), 0 deletions(-) diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamBaseHFCodeServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamBaseHFCodeServiceImpl.java new file mode 100644 index 0000000..05468ff --- /dev/null +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamBaseHFCodeServiceImpl.java @@ -0,0 +1,91 @@ +package org.jeecg.modules.eam.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.constant.enums.EnableDisableEnum; +import org.jeecg.common.exception.JeecgBootException; +import org.jeecg.common.util.SimpleVersionGenerateUtil; +import org.jeecg.modules.eam.entity.EamBaseHFCode; +import org.jeecg.modules.eam.mapper.EamBaseHFCodeMapper; +import org.jeecg.modules.eam.service.IEamBaseHFCodeService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @Description: HFCode缁存姢 + * @Author: jeecg-boot + * @Date: 2025-07-05 + * @Version: V1.0 + */ +@Service +public class EamBaseHFCodeServiceImpl extends ServiceImpl<EamBaseHFCodeMapper, EamBaseHFCode> implements IEamBaseHFCodeService { + + @Override + public boolean checkDuplicate(String category, String id) { + LambdaQueryWrapper<EamBaseHFCode> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(EamBaseHFCode::getHfCategory, category); + queryWrapper.eq(EamBaseHFCode::getDelFlag, CommonConstant.DEL_FLAG_0); + queryWrapper.eq(EamBaseHFCode::getHfStatus, EnableDisableEnum.ENABLE.name()); + if(StringUtils.isNotBlank(id)) { + queryWrapper.ne(EamBaseHFCode::getId, id); + } + List<EamBaseHFCode> list = super.getBaseMapper().selectList(queryWrapper); + return CollectionUtil.isEmpty(list); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addEamBaseHFCode(EamBaseHFCode entity) { + if(!checkDuplicate(entity.getHfCategory(), null)) { + throw new JeecgBootException("閲嶅娣诲姞锛�"); + } + entity.setHfVersion(SimpleVersionGenerateUtil.getInitVersion()); + entity.setDelFlag(CommonConstant.DEL_FLAG_0); + entity.setHfStatus(EnableDisableEnum.ENABLE.name()); + super.getBaseMapper().insert(entity); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean editEamBaseHFCode(EamBaseHFCode entity) { + EamBaseHFCode eamBaseHFCode = this.getBaseMapper().selectById(entity.getId()); + if(eamBaseHFCode == null) { + throw new JeecgBootException("瑕佺紪杈戠殑鏁版嵁涓嶅瓨鍦紒"); + } + if(!checkDuplicate(entity.getHfCategory(), entity.getId())) { + throw new JeecgBootException("閲嶅娣诲姞锛�"); + } + this.getBaseMapper().updateById(entity); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean upgradeEamBaseHFCode(EamBaseHFCode entity) { + EamBaseHFCode eamBaseHFCode = this.getBaseMapper().selectById(entity.getId()); + if(eamBaseHFCode == null) { + throw new JeecgBootException("瑕佸崌鐗堢殑鏁版嵁涓嶅瓨鍦紒"); + } + if(!checkDuplicate(entity.getHfCategory(), entity.getId())) { + throw new JeecgBootException("閲嶅娣诲姞锛�"); + } + //绂佺敤鍘熸潵鐨凥F缂栫爜 + eamBaseHFCode.setHfStatus(EnableDisableEnum.DISABLE.name()); + this.getBaseMapper().updateById(eamBaseHFCode); + //鏂板涓�涓柊鐨勭増鏈� + entity.setId(null); + entity.setCreateBy(null); + entity.setCreateTime(null); + entity.setDelFlag(CommonConstant.DEL_FLAG_0); + entity.setHfVersion(SimpleVersionGenerateUtil.addVersion(entity.getHfVersion())); + entity.setHfStatus(EnableDisableEnum.ENABLE.name()); + super.getBaseMapper().insert(entity); + return true; + } +} -- Gitblit v1.9.3