12345678910111213141516171819202122232425262728 |
- package com.chinacreator.videoalliance.query.dao;
- import java.sql.SQLException;
- import org.apache.commons.lang.math.NumberUtils;
- 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.frameworkset.common.poolman.SQLExecutor;
- @Component
- @CacheName("CpControlDao")
- public class CpControlDao {
-
- @Cacheable(value="CpControlDao", key = "'qfindByCP-' + #cpid")
- public boolean query(String cpid) throws SQLException {
- String sql = "select count(1) from TB_CPQUERYMOB_CONTROL where cpid=? and status=1";
- return NumberUtils.toInt(SQLExecutor.queryFieldWithDBName(DataSource.NET3G, sql,cpid), 0) > 0;
- }
-
- public static void main(String[] args) throws SQLException {
- CpControlDao dao = new CpControlDao();
- System.out.println(dao.query("tencent"));
- }
-
- }
|