package com.lightinit.hsdatashow.impl.ms;

import com.lightinit.hsdatashow.common.SingleChartMapperUtils;
import com.lightinit.hsdatashow.entity.BaseExample;
import com.lightinit.hsdatashow.entity.IndustrialAccidentDistribution;
import com.lightinit.hsdatashow.mapper.*;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.service.ms.IMSProduceSecurityService;
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/3 10:42
 * @Description:
 **/
@Service
public class MSProduceSecurityServiceImpl implements IMSProduceSecurityService {

    private  List getClazz(){
        ArrayList list = new ArrayList();
        list.add(industrialAccidentDeathMapper);
        list.add(industrialAccidentProportionMapper);
        list.add(industrialAccidentRankingMapper);
        list.add(industrialAccidentTendencyMapper);
        list.add(industrialAccidentDistributionMapper);
        return list;
    }
    @Autowired
    private IndustrialAccidentDeathMapper industrialAccidentDeathMapper;
    @Autowired
    private IndustrialAccidentProportionMapper industrialAccidentProportionMapper;
    @Autowired
    private IndustrialAccidentRankingMapper industrialAccidentRankingMapper;
    @Autowired
    private IndustrialAccidentTendencyMapper industrialAccidentTendencyMapper;
    @Autowired
    private IndustrialAccidentDistributionMapper industrialAccidentDistributionMapper;
    @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());
    }
}
