Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / MeetPlanServiceImpl.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.MeetPlanMapper;
import com.newfiber.api.pc.model.meet.MeetPlan;
import com.newfiber.api.pc.service.MeetPlanService;
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/25 17:12
 * @Description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MeetPlanServiceImpl extends ServiceImpl<MeetPlanMapper,MeetPlan> implements MeetPlanService {

    @Autowired
    private MeetPlanMapper meetPlanMapper;

    @Override
    public PageResultObject<MeetPlan> queryPage(PageRequestObject<String> pageRequestObject) {
        Page<MeetPlan> page = new Page<>(pageRequestObject.getCurrent(), pageRequestObject.getSize());
        EntityWrapper<MeetPlan> wrapper = new EntityWrapper<>();
        if(!StringUtils.isEmpty(pageRequestObject)){
            wrapper.like("plan_name",pageRequestObject.getObject());
        }
        Page<MeetPlan> meetPlanPage = this.selectPage(page, wrapper);
        int count = this.selectCount(wrapper);
        return new PageResultObject<>(pageRequestObject.getCurrent(), pageRequestObject.getSize(),(long)count,meetPlanPage.getRecords());
    }

    @Override
    public MeetPlan selectMeetPlanInfoById(Integer id) {
        return meetPlanMapper.selectMeetPlanInfoById(id);
    }
}