36 lines
1.7 KiB
Java
36 lines
1.7 KiB
Java
package com.gunshi.project.hsz.service;
|
|
|
|
import com.alibaba.excel.util.StringUtils;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.gunshi.core.result.R;
|
|
import com.gunshi.project.hsz.entity.so.WarningRulePageSo;
|
|
import com.gunshi.project.hsz.mapper.WarningRuleInfoMapper;
|
|
import com.gunshi.project.hsz.model.WarningRuleInfo;
|
|
import kotlin.jvm.internal.Lambda;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@Service
|
|
@Slf4j
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public class WarningRuleInfoService extends ServiceImpl<WarningRuleInfoMapper,WarningRuleInfo> {
|
|
public Page<WarningRuleInfo> pageQuery(WarningRulePageSo page) {
|
|
LambdaQueryWrapper<WarningRuleInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
if(!StringUtils.isBlank(page.getRuleName())){
|
|
queryWrapper.like(WarningRuleInfo::getRuleName, page.getRuleName());
|
|
}
|
|
if(!StringUtils.isBlank(page.getWarningType())){
|
|
queryWrapper.eq(WarningRuleInfo::getWarningType, page.getWarningType());
|
|
}
|
|
if(page.getDateTimeRangeSo() != null){
|
|
queryWrapper.ge(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getStart());
|
|
queryWrapper.le(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getEnd());
|
|
}
|
|
Page<WarningRuleInfo> warningRuleInfoPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
|
return warningRuleInfoPage;
|
|
}
|
|
}
|