package com.nantian.cloud.jljc.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.jljc.entity.TSupervisionSuggest;
import com.nantian.cloud.jljc.mapper.TSupervisionSuggestMapper;
import com.nantian.cloud.jljc.service.TSupervisionSuggestService;
import com.nantian.cloud.jljc.vo.Query;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  监察处理建议/复查情况汇总表 服务实现类
 * @since 2021-01-14
 */
@Service("tSupervisionSuggestService")
public class TSupervisionSuggestServiceImpl extends ServiceImpl<TSupervisionSuggestMapper, TSupervisionSuggest> implements TSupervisionSuggestService {

    @Override
    public IPage<TSupervisionSuggest> getSuggestPage(Page page, Query query) {
        if(null!=query.getArea() && !"".equals(query.getArea())){
            query.setArea(query.getArea().replaceAll("0000","").replaceAll("00",""));
        }
        return baseMapper.getSuggestPage(page,query);
    }

    @Override
    public List<TSupervisionSuggest> getSuggestList(Query query) {
        if(null!=query.getArea() && !"".equals(query.getArea())){
            query.setArea(query.getArea().replaceAll("0000","").replaceAll("00",""));
        }
        return baseMapper.getSuggestList(query);
    }

    @Override
    public boolean updateData(TSupervisionSuggest tSupervisionSuggest) {
        if (baseMapper.updateData(tSupervisionSuggest) > 0) {
            return true;
        } else {
            return false;
        }

    }
}
