package com.chinacreator.process.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

import com.chinacreator.common.support.cache.annotation.CacheName;
import com.chinacreator.process.util.DataSource;
import com.frameworkset.common.poolman.SQLExecutor;

/**
 * 查询TB_SP_OPERLIMIT_CONF配置数据
 * @author xu.zhou
 * @date 20211230
 */
@Component
@CacheName("BusiOperlimit")
public class BusiOperlimitConfDao {
	
	@Cacheable(value="BusiOperlimit", key="#name")
	public List<HashMap> getValue(String name) throws Exception {
		System.out.println("查询数据库");
		String sql = "SELECT CPID,SPID,OPERTYPE,CHANNEL,DATASRC,IP FROM TB_SP_OPERLIMIT_CONF WHERE STATUS = '0' AND SPID = ? ";
		return SQLExecutor.queryListWithDBName(HashMap.class, DataSource.NET3G, sql, name);
	}
	
	public static void main(String[] args) {
		BusiOperlimitConfDao dao = new BusiOperlimitConfDao();
		try {
			System.out.println(dao.getValue("99144186"));
			System.out.println(dao.getValue("99144186"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
