package com.newfiber.api.pc.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.newfiber.api.core.commons.PageRequestObject; import com.newfiber.api.core.commons.PageResultObject; import com.newfiber.api.pc.dao.DutyMapper; import com.newfiber.api.pc.model.meet.Duty; import com.newfiber.api.pc.service.DutyService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; /** * @Author:zzh * @CreateDate:2020/11/24 13:50 * @Description: */ @Service @Transactional(rollbackFor = Exception.class) public class DutyServiceImpl extends ServiceImpl<DutyMapper,Duty> implements DutyService { @Override public PageResultObject<Duty> queryPage(PageRequestObject<String> pageRequestObject) { Page<Duty> page = new Page<>(pageRequestObject.getCurrent(), pageRequestObject.getSize()); EntityWrapper<Duty> wrapper = new EntityWrapper<>(); if(!StringUtils.isEmpty(pageRequestObject.getObject())){ wrapper.like("duty_name",pageRequestObject.getObject()); } Page<Duty> dutyPage = this.selectPage(page, wrapper); int count = this.selectCount(wrapper); return new PageResultObject(pageRequestObject.getCurrent(), pageRequestObject.getSize(),(long)count,dutyPage.getRecords()); } }