package com.cool.bang.modules.business.service.impl;

import com.cool.bang.common.base.BaseServiceImpl;
import com.cool.bang.common.web.request.PageDomain;
import com.cool.bang.modules.business.domain.DataCount;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import com.cool.bang.modules.business.mapper.DataCollectionMapper;
import com.cool.bang.modules.business.domain.DataCollection;
import com.cool.bang.modules.business.service.IDataCollectionService;

import java.util.List;

/**
* 数据集合
*
* @author PeiZhi Guo
* 2024-10-31 17:05
*/
@Service
public class DataCollectionServiceImpl extends BaseServiceImpl<DataCollectionMapper, DataCollection> implements IDataCollectionService {

    public int queryDataYear(String yearMonth,Long corpId,Integer district){
        return baseMapper.queryDataYear(yearMonth,corpId,district);
    }

    public int queryIsEnd(String yearMonth,Integer district){
        return baseMapper.queryIsEnd(yearMonth,district);
    }

    public  DataCount queryByDataView(String yearMonth,Integer district){
        return baseMapper.queryByDataView(yearMonth,district);
    }

    public  List<DataCount> queryByDataCount( ){
        return baseMapper.queryByDataCount();
    }

    public boolean addIsEnd(String yearMonth,Integer district){
        baseMapper.addIsEnd(yearMonth,district);
        return baseMapper.updateEnd(yearMonth,district)>0;
    }

    public PageInfo<DataCount> queryByDataCountList(PageDomain page, DataCount param){
        PageHelper.startPage(page.getPage(), page.getLimit());
        List<DataCount> list = baseMapper.selectDataCountList(param);
        return new PageInfo<>(list);
    }
}
