package com.lightinit.hsdatashow.impl.ms;

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

    private  List getClazz(){
        ArrayList list = new ArrayList();
        list.add(criminalRateMapper);
        list.add(registerLegalProportionMapper);
        list.add(registerLegalTendencyMapper);
        list.add(videoMonitorMapper);
        list.add(criminalRegisterProportionMapper);
        return list;
    }
    @Autowired
    private CriminalRateMapper criminalRateMapper;
    @Autowired
    private RegisterLegalProportionMapper registerLegalProportionMapper;
    @Autowired
    private RegisterLegalTendencyMapper registerLegalTendencyMapper;
    @Autowired
    private VideoMonitorMapper videoMonitorMapper;
    @Autowired
    private CriminalRegisterProportionMapper criminalRegisterProportionMapper;
    @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());
    }
}