package com.gunshi.project.xyt.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gunshi.project.xyt.entity.so.WarnRulePageSo; import com.gunshi.project.xyt.mapper.OsmoticWarnRuleMapper; import com.gunshi.project.xyt.model.OsmoticWarnRule; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * 描述: 预警规则配置表 * author: xusan * date: 2024-07-08 17:30:37 */ @Service @Slf4j @Transactional(rollbackFor = Exception.class) public class OsmoticWarnRuleService extends ServiceImpl { public Page queryPage(WarnRulePageSo warnRulePageSo) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); if(warnRulePageSo.getType() != null){ queryWrapper.eq(OsmoticWarnRule::getType,warnRulePageSo.getType()); } if(StringUtils.isNotEmpty(warnRulePageSo.getStationCode())){ queryWrapper.like(OsmoticWarnRule::getStationCode,warnRulePageSo.getStationCode()); } queryWrapper.orderByDesc(OsmoticWarnRule::getStatus); return this.page(warnRulePageSo.getPageSo().toPage(),queryWrapper); } }