2025-12-29 17:13:09 +08:00
|
|
|
package com.gunshi.project.ss.service;
|
2025-11-20 16:22:07 +08:00
|
|
|
|
|
|
|
|
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;
|
2025-12-29 17:13:09 +08:00
|
|
|
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
|
|
|
|
import com.gunshi.project.ss.mapper.WarningRuleInfoMapper;
|
|
|
|
|
import com.gunshi.project.ss.model.WarningCondition;
|
|
|
|
|
import com.gunshi.project.ss.model.WarningRuleInfo;
|
2025-11-20 16:22:07 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2025-11-26 18:00:57 +08:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2025-11-20 16:22:07 +08:00
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
2025-11-26 18:00:57 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
2025-11-20 16:22:07 +08:00
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class WarningRuleInfoService extends ServiceImpl<WarningRuleInfoMapper,WarningRuleInfo> {
|
2025-11-26 18:00:57 +08:00
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WarningConditionService warningConditionService;
|
|
|
|
|
|
|
|
|
|
|
2025-11-20 16:22:07 +08:00
|
|
|
public Page<WarningRuleInfo> pageQuery(WarningRulePageSo page) {
|
|
|
|
|
LambdaQueryWrapper<WarningRuleInfo> queryWrapper = new LambdaQueryWrapper<>();
|
2026-02-27 16:33:33 +08:00
|
|
|
// if(!StringUtils.isBlank(page.getRuleName())){
|
|
|
|
|
// queryWrapper.like(WarningRuleInfo::getRuleName, page.getRuleName());
|
|
|
|
|
// }
|
2025-11-20 16:22:07 +08:00
|
|
|
if(!StringUtils.isBlank(page.getWarningType())){
|
|
|
|
|
queryWrapper.eq(WarningRuleInfo::getWarningType, page.getWarningType());
|
|
|
|
|
}
|
2026-02-27 16:33:33 +08:00
|
|
|
// if(page.getDateTimeRangeSo() != null){
|
|
|
|
|
// queryWrapper.ge(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getStart());
|
|
|
|
|
// queryWrapper.le(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getEnd());
|
|
|
|
|
// }
|
2025-11-24 17:14:15 +08:00
|
|
|
queryWrapper.orderByDesc(WarningRuleInfo::getCreateTime);
|
2025-11-20 16:22:07 +08:00
|
|
|
Page<WarningRuleInfo> warningRuleInfoPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
2025-11-26 18:00:57 +08:00
|
|
|
List<WarningRuleInfo> records = warningRuleInfoPage.getRecords();
|
|
|
|
|
for (WarningRuleInfo record : records) {
|
|
|
|
|
List<WarningCondition> listByRuleId = warningConditionService.getListByRuleId(record.getRuleId());
|
|
|
|
|
record.setConditions(listByRuleId);
|
|
|
|
|
}
|
2025-11-20 16:22:07 +08:00
|
|
|
return warningRuleInfoPage;
|
|
|
|
|
}
|
|
|
|
|
}
|