package com.ruoyi.project.tr.specialCheck.service.impl; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.ruoyi.doublePrevention.enums.ErrorCodes; import com.ruoyi.doublePrevention.enums.ResultCodes; import com.ruoyi.doublePrevention.vo.ResultVO; import com.ruoyi.project.tr.specialCheck.domin.*; import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckItemBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckScoreBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbBaseCheckTaskBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckTaskLogBO; import com.ruoyi.project.tr.specialCheck.mapper.*; import com.ruoyi.project.tr.specialCheck.service.SpecialCheckItemDangerLogService; import com.ruoyi.project.tr.specialCheck.service.TbBaseCheckService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class TbBaseCheckServiceImpl implements TbBaseCheckService { @Autowired private TbBaseCheckCompanyMapper companyTbRepository; @Autowired private TbBaseCheckItemMapper itemTbRepository; @Autowired private TbBaseCheckScoreMapper scoreTbRepository; @Autowired private TbBaseCheckTaskMapper taskTbRepository; @Autowired private TbSpecialCheckTaskLogMapper taskSpecialLogMapper; @Autowired private SpecialCheckItemDangerLogService itemDangerLogService; @Override public ResultVO> selectTbBaseCheckTaskPage(TbBaseCheckTaskBO tbBaseCheckTaskBO) { Integer pageIndex = tbBaseCheckTaskBO.getPageNum(); Integer pageSize = tbBaseCheckTaskBO.getPageSize(); if (pageIndex == 0 || pageSize == 0){ return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0"); } Page page = PageHelper.startPage(pageIndex, pageSize); taskTbRepository.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO); Long total = page.getTotal(); int count = total.intValue(); List pageResult = null; ResultVO> resultVO = new ResultVO<>(ResultCodes.OK,pageResult); resultVO.setData(page.getResult()); resultVO.setCount(count); resultVO.setCount((int) page.getTotal()); resultVO.setPageNum(page.getPageNum()); resultVO.setPageSize(page.getPageSize()); return resultVO; } @Override public ResultVO> selectTbBaseCheckItemPage(TbBaseCheckItemBO tbBaseCheckItemBO) { Integer pageIndex = tbBaseCheckItemBO.getPageNum(); Integer pageSize = tbBaseCheckItemBO.getPageSize(); if (pageIndex == 0 || pageSize == 0){ return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0"); } Page page = PageHelper.startPage(pageIndex, pageSize); itemTbRepository.selectTbBaseCheckItemPage(tbBaseCheckItemBO); Long total = page.getTotal(); int count = total.intValue(); List pageResult = null; ResultVO> resultVO = new ResultVO<>(ResultCodes.OK,pageResult); resultVO.setData(page.getResult()); resultVO.setCount(count); resultVO.setCount((int) page.getTotal()); resultVO.setPageNum(page.getPageNum()); resultVO.setPageSize(page.getPageSize()); return resultVO; } @Override public ResultVO> selectTbBaseCheckScorePage(TbBaseCheckScoreBO tbBaseCheckScoreBO) { Integer pageIndex = tbBaseCheckScoreBO.getPageNum(); Integer pageSize = tbBaseCheckScoreBO.getPageSize(); if (pageIndex == 0 || pageSize == 0){ return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0"); } TbSpecialCheckItemLog specialCheckItemDangerLogById = itemDangerLogService.getSpecialCheckItemDangerLogById(tbBaseCheckScoreBO.getId()); Page page = PageHelper.startPage(pageIndex, pageSize); tbBaseCheckScoreBO.setCheckItemId(specialCheckItemDangerLogById.getCheckItemId()); scoreTbRepository.selectTbBaseCheckScorePage(tbBaseCheckScoreBO); Long total = page.getTotal(); int count = total.intValue(); List pageResult = null; ResultVO> resultVO = new ResultVO<>(ResultCodes.OK,pageResult); resultVO.setData(page.getResult()); resultVO.setCount(count); resultVO.setCount((int) page.getTotal()); resultVO.setPageNum(page.getPageNum()); resultVO.setPageSize(page.getPageSize()); return resultVO; } @Override public List listTbBaseCheckTask() { return scoreTbRepository.listTbBaseCheckTask(); } }