Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / MeetPlanSubServiceImpl.java
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.MeetPlanSubMapper;
import com.newfiber.api.pc.model.meet.MeetPlanSub;
import com.newfiber.api.pc.service.MeetPlanSubService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

/**
 * @Author:zhz
 * @CreateDate:2020/11/26 15:43
 * @Description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MeetPlanSubServiceImpl extends ServiceImpl<MeetPlanSubMapper,MeetPlanSub> implements MeetPlanSubService {
    @Override
    public PageResultObject<MeetPlanSub> queryPage(PageRequestObject<String> objectPage,Integer planId) {
        Page<MeetPlanSub> page = new Page<>(objectPage.getCurrent(), objectPage.getSize());
        EntityWrapper<MeetPlanSub> wrapper = new EntityWrapper<>();
        if(!StringUtils.isEmpty(objectPage.getObject())){
            wrapper.like("sub_name",objectPage.getObject());
        }
        wrapper.eq("plan_id",planId);
        Page<MeetPlanSub> meetPlanLevelPage = this.selectPage(page, wrapper);
        int count = this.selectCount(wrapper);
        return new PageResultObject<>(objectPage.getCurrent(), objectPage.getSize(),(long)count,meetPlanLevelPage.getRecords());
    }
}