package com.chinacreator.process.dao;

import java.sql.SQLException;

import org.apache.commons.lang.math.NumberUtils;
import org.springframework.stereotype.Component;
import com.chinacreator.process.util.DataSource;
import com.frameworkset.common.poolman.SQLExecutor;

@Component
public class WhiteDao {

	public boolean isWhiteUser(String userid, String cpid) throws SQLException {
		String sql = "select count(userid) from TB_BLACKWHITE_LIST where userid=? and (cpid='0' or cpid=?) and type=0";
		return NumberUtils.toInt(SQLExecutor.queryFieldWithDBName(DataSource.NET3G, sql, userid, cpid), 0) > 0;
	}
}
