/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://www.cqcis.com</a>
 */
package com.crunii.micro.platform.jdbc;

import com.crunii.micro.domain.common.jdbc.BaseJdbcTemplate;
import com.crunii.micro.domain.common.jdbc.BaseNPJdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @author 田平 create 2017年8月11日下午12:44:04
 */
@Repository
public class MicroJdbcDao {

	@Resource(name = "mainJT")
	protected BaseJdbcTemplate JT;

	@Resource(name = "mainNPJT")
	protected BaseNPJdbcTemplate NPJT;

	private static final String validatePortSql = "select count(*) from t_service where service_code=? and port=? and state=1";

	public boolean validatePort(String serviceCode, int port) {
		int size = JT.queryForInt(validatePortSql, serviceCode, port);
		return size > 0 ? true : false;
	}

}
