/*
 *    Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: hnqz
 */
package com.qunzhixinxi.hnqz.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qunzhixinxi.hnqz.admin.entity.MonitoringIndicator;
import com.qunzhixinxi.hnqz.admin.enums.SubjectTypeEnum;
import com.qunzhixinxi.hnqz.admin.mapper.MonitoringIndicatorMapper;
import com.qunzhixinxi.hnqz.admin.service.MonitoringIndicatorService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import static com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants.MONITORING_INDICATOR;

/**
 * 风险监控
 *
 * @author ryz
 * @date 2021-04-19 16:08:29
 */
@Service
public class MonitoringIndicatorServiceImpl extends ServiceImpl<MonitoringIndicatorMapper, MonitoringIndicator> implements MonitoringIndicatorService {

	@Cacheable(value = MONITORING_INDICATOR)
	@Override
	public MonitoringIndicator getBySubType(String subType) {
		if(SubjectTypeEnum.TYPE_RENLIJIA.getCode().equals(subType)){
			return baseMapper.selectById(1);
		}else if(SubjectTypeEnum.TYPE_SHUIBANGYUN.getCode().equals(subType)){
			return baseMapper.selectById(2);
		}
		return null;
	}
}
