package com.chinacreator.videoalliance.order.dao; import java.sql.SQLException; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; import com.chinacreator.common.support.cache.annotation.CacheName; import com.chinacreator.videoalliance.common.util.DataSource; import com.chinacreator.videoalliance.order.bean.WxcsBean; import com.frameworkset.common.poolman.SQLExecutor; @Component @CacheName("WxcsDao") public class WxcsDao { @Cacheable(value={"WxcsDao"}, key="'getByCP-' + #cpid + '-' +#spid") public WxcsBean getConfig(String cpid,String spid) throws SQLException{ String sql = "select cpid,spid,totalvip,to_char(vipstarttime,'yyyymmddhh24miss') vipstarttime,to_char(vipendtime,'yyyymmddhh24miss') vipendtime,vipstatus," + " vipurl,viptype,flowstatus,to_char(flowstarttime,'yyyymmddhh24miss') flowstarttime,to_char(flowendtime,'yyyymmddhh24miss') flowendtime from tb_wxcs_config where cpid =? and spid =?"; return SQLExecutor.queryObjectWithDBName(WxcsBean.class, DataSource.NET3G, sql, cpid,spid); } @Cacheable(value={"WxcsDao"}, key="'getByCPid-' + #cpid") public WxcsBean getConfig(String cpid) throws SQLException{ String sql = "select cpid,spid,totalvip,to_char(vipstarttime,'yyyymmddhh24miss') vipstarttime,to_char(vipendtime,'yyyymmddhh24miss') vipendtime,vipstatus," + " vipurl,viptype,flowstatus,to_char(flowstarttime,'yyyymmddhh24miss') flowstarttime,to_char(flowendtime,'yyyymmddhh24miss') flowendtime from tb_wxcs_config where cpid =?"; return SQLExecutor.queryObjectWithDBName(WxcsBean.class, DataSource.NET3G, sql, cpid); } public static void main(String[] args) throws SQLException { WxcsDao dao =new WxcsDao(); System.out.println(dao.getConfig("aiqy", "1017").getCpid()); } }