package com.newfiber.modules.inspection.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; 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.newfiber.common.bean.PageRequestObject; import com.newfiber.common.bean.PageResultObject; import com.newfiber.modules.inspection.dao.ManPumpstationMapper; import com.newfiber.modules.inspection.entity.ManPumpstation; import com.newfiber.modules.inspection.service.ManPumpstationService; import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; /** * @description: 泵站基础信息业务层实现类 * @author: 张鸿志 * @date: 2020/12/14 9:50 * @version: v1.0 */ @Service @DS("main") @Transactional(rollbackFor = Exception.class) public class ManPumpstationServiceImpl extends ServiceImpl<ManPumpstationMapper, ManPumpstation> implements ManPumpstationService { @Override public PageResultObject<ManPumpstation> queryPage(PageRequestObject<String> pageRequestObject) { Page<ManPumpstation> page = new Page<>(pageRequestObject.getCurrent(), pageRequestObject.getSize()); QueryWrapper<ManPumpstation> wrapper = new QueryWrapper<>(); if(!StringUtils.isEmpty(pageRequestObject.getObject())){ wrapper.like("pump_name",pageRequestObject.getObject()); } Page<ManPumpstation> pumpstationPage = this.page(page, wrapper); int count = this.count(wrapper); return new PageResultObject<>(pageRequestObject.getCurrent(), pageRequestObject.getSize(),(long)count,pumpstationPage.getRecords()); } @Override public List<ManPumpstation> listTree() { return this.list(); } @Override public ManPumpstation getByName(String name) { QueryWrapper<ManPumpstation> wrapper = new QueryWrapper<ManPumpstation>(). eq("pump_name", name); return this.getOne(wrapper); } @Override public ManPumpstation getByNo(String no) { QueryWrapper<ManPumpstation> wrapper = new QueryWrapper<ManPumpstation>(). eq("pump_no", no); return this.getOne(wrapper); } }