Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / RiverUserRelationServiceImpl.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.RiverUserRelationMapper;
import com.newfiber.api.pc.model.River.RiverUserRelation;
import com.newfiber.api.pc.service.RiverUserRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("riverUserRelationService")
public class RiverUserRelationServiceImpl extends ServiceImpl<RiverUserRelationMapper, RiverUserRelation> implements RiverUserRelationService {

    @Autowired
    private RiverUserRelationMapper riverUserRelationMapper;

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

    @Override
    public RiverUserRelation selectByRiverNo(String riverNo) {
        EntityWrapper<RiverUserRelation> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("river_no",riverNo);
        RiverUserRelation relation = this.selectOne(entityWrapper);
        return relation;
    }

    @Override
    public List<RiverUserRelation> selectRiverByUserNo(String userNo) {
        return riverUserRelationMapper.selectRiverByUserNo(userNo);
    }
}