Home > Article > Web Front-end > jquery struts 验证唯一标识(公用方法)_jquery
public int checkCodeOnly(DictionaryBean bean)throws DataAccessException,Exception {
Object[] sqlParams = new Object[4];
int index = 0;
String sql="";
/* 验证页面标志是否唯一*/
if (bean.getFlag().equals("1")) {
sql = "select count(1) from YHAO_PORTALS_PAGE where PAGE_FLAG = ? ";
sqlParams[index]=bean.getCode();
index++;
}
/* 验证类型志标识是否唯一*/
if (bean.getFlag().equals("2")) {
sql = "select count(1) from YHAO_PORTALS_DOWNTYPE where DOWNTYPE_FLAG = ? ";
sqlParams[index]=bean.getCode();
index++;
}
/* 验证下载志标识是否唯一*/
if (bean.getFlag().equals("3")) {
sql = "select count(1) from YHAO_PORTALS_DOWN where DOWN_FLAG = ? ";
sqlParams[index]=bean.getCode();
index++;
}
if (bean.getFlag().equals("4")) {
sql = "select count(1) from YHAO_PORTALS_KUAI where KUAI_FLAG = ? ";
sqlParams[index]=bean.getCode();
index++;
}
Object[] sqlParamsEnd = new Object[index];
System.arraycopy(sqlParams, 0, sqlParamsEnd, 0, index);
int count = this.queryForInt(sql,sqlParamsEnd);
return count;
}