package com.lightinit.hsdataplatform.impl.admin;

import com.lightinit.hsdataplatform.mapper.ResourceCatelogMapper;
import com.lightinit.hsdataplatform.model.admin.StatisiticSearchModel;
import com.lightinit.hsdataplatform.model.admin.StatisticModel;
import com.lightinit.hsdataplatform.service.admin.IResourceService;
import com.lightinit.hsdataplatform.spring.DynamicDataContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: sunxiang
 * @Date: 2018/7/16 17:44
 * @Description:
 **/
@Service
public class ResourceServiceImpl implements IResourceService {

    @Autowired
    private ResourceCatelogMapper resourceCatelogMapper;

    @Override
    public List<String> getCatelogTypeIsTheme(StatisiticSearchModel inputModel) {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        return resourceCatelogMapper.getCatelogTypeIsTheme(inputModel);
    }

    @Override
    public List<Map<String, Object>> getEveryThemeTotal(StatisiticSearchModel inputModel) {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        return resourceCatelogMapper.getEveryThemeTotal(inputModel);
    }

    @Override
    public List<String> getSectorList() {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        return resourceCatelogMapper.getSectorList();
    }

    @Override
    public List<Map<String, Object>> getEverySectorTotal(StatisiticSearchModel inputModel) {
        DynamicDataContextHolder.setCustomerType(DynamicDataContextHolder.DEFAULT);
        return resourceCatelogMapper.getEverySectorTotal(inputModel);
    }

    @Override
    public List<StatisticModel> getThemeSortTotal(StatisiticSearchModel inputModel) {
        return resourceCatelogMapper.getThemeSortTotal(inputModel);
    }

    @Override
    public List<StatisticModel> getSectorSortList(StatisiticSearchModel inputModel) {
        return resourceCatelogMapper.getSectorSortList(inputModel);
    }
}
