package com.lightinit.hsdatashow.impl.ms;

import com.lightinit.hsdatashow.common.SingleChartMapperUtils;
import com.lightinit.hsdatashow.entity.*;
import com.lightinit.hsdatashow.mapper.*;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.service.ms.IMSLivingSecurityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: sunxiang
 * @Date: 2018/9/6 15:36
 * @Description:
 **/
@Service
public class MSLivingSecurityServiceImpl implements IMSLivingSecurityService {

    private  List getClazz(){
        ArrayList list = new ArrayList();
        list.add(areaFireDeathRateMapper);
        list.add(areaFireProportionMapper);
        list.add(areaFireTendencyMapper);
        list.add(areaFireRankingMapper);
        list.add(areaFireDistributionMapper);
        return list;
    }
    @Autowired
    private AreaFireDeathRateMapper areaFireDeathRateMapper;
    @Autowired
    private AreaFireProportionMapper areaFireProportionMapper;
    @Autowired
    private AreaFireTendencyMapper areaFireTendencyMapper;
    @Autowired
    private AreaFireRankingMapper areaFireRankingMapper;
    @Autowired
    private AreaFireDistributionMapper areaFireDistributionMapper;
    @Override
    public List list(String tableType, BaseExample.Page pager) {
        return SingleChartMapperUtils.list(getClazz(),tableType,pager);
    }

    @Override
    public long queryCount(String tableType) {
        return SingleChartMapperUtils.queryCount(getClazz(),tableType);
    }

    @Override
    public Object findById(String tableType, Long id) {
        return SingleChartMapperUtils.findById(getClazz(),tableType,id);
    }

    @Override
    public ResultState delete(String tableType, Long id) {
        return SingleChartMapperUtils.delete(getClazz(),tableType,id);
    }

    @Override
    public <V> ResultState add(V v, boolean isEdit) {
        return SingleChartMapperUtils.add(v,isEdit,getClazz());
    }
}