Newer
Older
huludao / src / main / java / com / newfiber / api / pc / service / impl / PatrolManageDicServiceImpl.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.PatrolManageDicMapper;
import com.newfiber.api.pc.model.River.PatrolManageDic;
import com.newfiber.api.pc.service.PatrolManageDicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;


@Service("patrolManageDicService")
public class PatrolManageDicServiceImpl extends ServiceImpl<PatrolManageDicMapper, PatrolManageDic> implements PatrolManageDicService {

    @Autowired
    private PatrolManageDicMapper patrolManageDicMapper;

    @Override
    public PageInfo<PatrolManageDic> listForPage(String searchStr,String patrolType,String source, Integer pageNo, Integer pageSize) {
        EntityWrapper wapper = new EntityWrapper<>();
        //name 模糊匹配的字段
        if(!StringUtils.isEmpty(searchStr) && !"null".equalsIgnoreCase(searchStr)){
            wapper.like("name", searchStr);
        }
        if(!StringUtils.isEmpty(patrolType)){
            wapper.eq("patrol_type", patrolType);
        }
        wapper.ne("alarm_type", 1);
        wapper.eq("source", source);
        PageHelper.startPage(pageNo, pageSize);
        List<PatrolManageDic> list = patrolManageDicMapper.selectList(wapper);
        PageInfo<PatrolManageDic> result = new PageInfo<>();
        if (!list.isEmpty()) {
            result = new PageInfo<>(list);
        }
        return result;
    }

    @Override
    public List<PatrolManageDic> getListByPatrolType(Integer patrolType) {
        return patrolManageDicMapper.getListByPatrolType(patrolType);
    }

    @Override
    public List<PatrolManageDic> getListByPatrolState() {
        return patrolManageDicMapper.getListByPatrolState();
    }
}