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.CustomException; import com.newfiber.api.core.commons.PageRequestObject; import com.newfiber.api.core.commons.PageResultObject; import com.newfiber.api.core.commons.ResultCode; import com.newfiber.api.pc.dao.MeetAreaMapper; import com.newfiber.api.pc.model.meet.MeetArea; import com.newfiber.api.pc.model.vo.MeetAreaSiteVo; import com.newfiber.api.pc.service.MeetAreaService; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; /** * @Author:zzh * @CreateDate:2020/11/24 14:37 * @Description: */ @Service @Transactional(rollbackFor = Exception.class) public class MeetAreaServiceImpl extends ServiceImpl<MeetAreaMapper, MeetArea> implements MeetAreaService { @Autowired private MeetAreaMapper areaMapper; @Override public PageResultObject<MeetArea> queryPage(PageRequestObject<String> pageRequestObject) { Page<MeetArea> page = new Page<>(pageRequestObject.getCurrent(), pageRequestObject.getSize()); EntityWrapper<MeetArea> wrapper = new EntityWrapper<>(); if(!StringUtils.isEmpty(pageRequestObject.getObject())){ wrapper.like("area_name",pageRequestObject.getObject()); } Page<MeetArea> dutyPage = this.selectPage(page, wrapper); int count = this.selectCount(wrapper); return new PageResultObject(pageRequestObject.getCurrent(), pageRequestObject.getSize(),(long)count,dutyPage.getRecords()); } @Override public MeetAreaSiteVo selectAreaById(Integer id) { if(StringUtils.isEmpty(id)){ throw new CustomException(ResultCode.PARAM_NULL); } return areaMapper.selectAreaById(id); } }