package org.jeecg.modules.system.service.impl;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import org.apache.commons.lang3.StringUtils;
|
import org.jeecg.modules.system.entity.SysBusinessCodeSeq;
|
import org.jeecg.modules.system.mapper.SysBusinessCodeSeqMapper;
|
import org.jeecg.modules.system.service.ISysBusinessCodeSeqService;
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import java.util.List;
|
|
/**
|
* @Description: 业务编码生成序列
|
* @Author: jeecg-boot
|
* @Date: 2025-03-19
|
* @Version: V1.0
|
*/
|
@Service
|
public class SysBusinessCodeSeqServiceImpl extends ServiceImpl<SysBusinessCodeSeqMapper, SysBusinessCodeSeq> implements ISysBusinessCodeSeqService {
|
|
@Override
|
public SysBusinessCodeSeq queryByParams(String ruleId, String prefix, String yearValue, String monthValue, String dayValue) {
|
LambdaQueryWrapper<SysBusinessCodeSeq> queryWrapper = new LambdaQueryWrapper<>();
|
queryWrapper.eq(SysBusinessCodeSeq::getRuleId, ruleId);
|
queryWrapper.orderByDesc(SysBusinessCodeSeq::getCreateTime);
|
if(StringUtils.isNotBlank(prefix)){
|
queryWrapper.eq(SysBusinessCodeSeq::getPrefix, prefix);
|
}else {
|
queryWrapper.isNull(SysBusinessCodeSeq::getPrefix);
|
}
|
|
if(StringUtils.isNotBlank(yearValue)){
|
queryWrapper.eq(SysBusinessCodeSeq::getCurrentYear, yearValue);
|
}else {
|
queryWrapper.isNull(SysBusinessCodeSeq::getCurrentYear);
|
}
|
|
if(StringUtils.isNotBlank(monthValue)){
|
queryWrapper.eq(SysBusinessCodeSeq::getCurrentMonth, monthValue);
|
}else {
|
queryWrapper.isNull(SysBusinessCodeSeq::getCurrentMonth);
|
}
|
|
if(StringUtils.isNotBlank(dayValue)){
|
queryWrapper.eq(SysBusinessCodeSeq::getCurrentDay, dayValue);
|
}else {
|
queryWrapper.isNull(SysBusinessCodeSeq::getCurrentDay);
|
}
|
List<SysBusinessCodeSeq> list = super.list(queryWrapper);
|
if(CollectionUtil.isEmpty(list)){
|
return null;
|
}
|
return list.get(0);
|
}
|
}
|