package com.ozs.kpim.service.common.impl;

import com.ozs.kpim.dto.common.RuleTypeDTO;
import com.ozs.kpim.dto.common.SignDTO;
import com.ozs.kpim.dto.common.TypeDTO;
import com.ozs.kpim.dto.common.UserDTO;
import com.ozs.kpim.mapper.common.CommonMapper;
import com.ozs.kpim.service.common.CommonService;
import com.ozs.kpim.util.R;
import com.ozs.kpim.util.S;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName CommonServiceImpl
 * @Desc 通用Service
 * @Author jade
 * @Date 2019/2/18
 * @Version 1.0
 */
@Service
public class CommonServiceImpl implements CommonService {

    @Resource
    private CommonMapper commonMapper;

    /* *
     * @Author jade
     * @Description 配置类型查询
     * @Date 2019/2/18
     * @Param []
     * @return R<java.util.List<TypeDTO>>
    **/
    @Override
    public R<List<TypeDTO>> listTypes() throws Exception {
        List<TypeDTO> list = commonMapper.listTypes();
        return new R<>(S.OK,S.getMsg(S.OK),list);
    }

    /* *
     * @Author jade
     * @Description 符号列表查询
     * @Date 2019/2/20
     * @Param []
     * @return R<java.util.List<SignDTO>>
    **/
    @Override
    public R<List<SignDTO>> listSigns() {
        return new R<>(S.OK,S.getMsg(S.OK),commonMapper.listSigns());
    }

    /* *
     * @Author jade
     * @Description 查询规则类型列表
     * @Date 2019/2/21
     * @Param []
     * @return R<java.util.List<RuleTypeDTO>>
    **/
    @Override
    public R<List<RuleTypeDTO>> listRuleTypes(Integer kpiType) throws Exception {
        return  new R<>(S.OK,S.getMsg(S.OK),commonMapper.listRuleTypes(kpiType));
    }

    /* *
     * @Author jade
     * @Description 查询普通管理员
     * @Date 2019/2/26
     * @Param [userType]s
     * @return R<java.util.List<UserDTO>>
    **/
    @Override
    public R<List<UserDTO>> listAdministrativeUsers(Integer userType) {
        return  new R(S.OK,S.getMsg(S.OK),commonMapper.listAdministrativeUsers(userType));
    }

}
