package com.hxzkappboot.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzkappboot.mapper.TbWarningMapper;
import com.hxzkappboot.pojo.TbWarning;
import com.hxzkappboot.service.TbWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
*
* 服务实现类
*
*
* @author wangfei
* @since 2024-03-08
*/
@Service
public class TbWarningServiceImpl extends ServiceImpl implements TbWarningService {
@Autowired
TbWarningMapper warningDao;
@Override
public List findAll(Page page, String objectid,String company) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","未处理");
List CompanyPage = new ArrayList();
if (objectid!=null){
String output = objectid.toUpperCase();//将小写字母转成大写字母
CompanyPage = baseMapper.findwarper1(company,output,page.getCurrent()-1,page.getSize());
}else{
CompanyPage = baseMapper.findwarper(company,page.getCurrent()-1,page.getSize());
}
queryWrapper.orderByDesc("time");
return CompanyPage;
}
@Override
public Integer findWarningNum(String company ) {
List CompanyPage = new ArrayList();
// QueryWrapper queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("status","未处理");
CompanyPage = baseMapper.findwarper2(company);
return CompanyPage.size();
}
@Override
public TbWarning findWarningid(Integer id ) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",id);
return baseMapper.selectOne(queryWrapper);
}
@Override
public TbWarning processingWarn(TbWarning warning) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",warning.getId());
baseMapper.update(warning,queryWrapper);
return baseMapper.selectOne(queryWrapper);
}
}