Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / ProblemLongTermExpServiceImpl.java
package com.newfiber.api.pc.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.newfiber.api.pc.dao.RiverManage.ProblemLongTermExpMapper;
import com.newfiber.api.pc.model.River.ProblemLongTermExp;
import com.newfiber.api.pc.service.ProblemLongTermExpService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("problemLongTermExpService")
public class ProblemLongTermExpServiceImpl extends ServiceImpl<ProblemLongTermExpMapper, ProblemLongTermExp> implements ProblemLongTermExpService {

    @Autowired
    private ProblemLongTermExpMapper problemLongTermExpMapper;

    @Override
    public PageInfo<ProblemLongTermExp> listForPage(String searchStr, Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        EntityWrapper<ProblemLongTermExp> wapper = new EntityWrapper<>();
        //name 模糊匹配的字段
        if(!StringUtils.isEmpty(searchStr)){
            wapper.like("searchStr", searchStr);
        }
        List<ProblemLongTermExp> list = problemLongTermExpMapper.selectList(wapper);
        PageInfo<ProblemLongTermExp> result = new PageInfo<>();
        if (!list.isEmpty()) {
            result = new PageInfo<ProblemLongTermExp>(list);
        }
        return result;
    }


    @Override
    public List<ProblemLongTermExp> listAll(Long totalClass) {
        EntityWrapper<ProblemLongTermExp> wrapper = new EntityWrapper<>();
        wrapper.eq("total_class",totalClass);
        return this.selectList(wrapper);
    }

    @Override
    public List<ProblemLongTermExp> selectByIds(List<Long> list) {
        return problemLongTermExpMapper.selectByIds(list);
    }
}