package com.gk.hotwork.Service.ServiceImpl; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gk.hotwork.Domain.GasWarnInfo; import com.gk.hotwork.Domain.InvolveDepInfo; import com.gk.hotwork.Domain.Utils.PageInfo; import com.gk.hotwork.Domain.Utils.StringUtils; import com.gk.hotwork.Domain.Vo.DepartmentVo; import com.gk.hotwork.Mapper.GasWarnInfoMapper; import com.gk.hotwork.Service.GasWarnService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service("GasWarnService") public class GasWarnServiceImpl extends ServiceImpl implements GasWarnService { @Autowired GasWarnInfoMapper gasWarnInfoMapper; @Override public void selectDataGrid(PageInfo pageInfo) { Page page = new Page<>(pageInfo.getPageIndex(), pageInfo.getPageSize()); List orderItems = new ArrayList<>(); OrderItem orderItem = new OrderItem(); if (StringUtils.isNotBlank(pageInfo.getSort()) && StringUtils.isNotBlank(pageInfo.getOrder())) { orderItem.setAsc(pageInfo.getOrder().equalsIgnoreCase("ascending")); orderItem.setColumn(pageInfo.getSort()); }else { orderItem.setAsc(false); orderItem.setColumn("updatetime"); } orderItems.add(orderItem); page.setOrders(orderItems); List list = gasWarnInfoMapper.selectDataGrid(page,pageInfo.getCondition()); pageInfo.setResult(list); pageInfo.setTotalCount(page.getTotal()); } @Override public GasWarnInfo selectExistByType(Long id,String warntype, String gastype) { return gasWarnInfoMapper.selectExistByType(id,warntype, gastype); } @Override public GasWarnInfo selectByType(String gastype, String warntype) { return gasWarnInfoMapper.selectByType(gastype, warntype); } }