int pageNum,int pageSize){
Logger.info("找個備用實驗室");
FoHQLQuery query = new FoHQLQuery();
string hql = " from operationagentbase entity a ";
//查詢條件
字符串where SQL = " where 1 = 1 ";
//實驗室名稱或編號
if(entity.getAgentname()!= null & amp& amp!entity.getAgentname()。修剪()。等於(" "){
whereSql += "和a . agent name like:agent name ";
query.setString("agentName "," "+entity . getagentname()+" " ");
}
//顯示件數
string count hql = " select count(*)"+hql+where SQL;query . sethql(hql+where SQL+" order by a . agent name ");
query . setcounthql(countHql);
query . setpagenum(pageNum);
query . set pageSize(pageSize);
返回this.execFoPageQuery(查詢);
}公共字符串delOperationAgentEntity(最終字符串[] agentCode){
Logger.info("刪除當前使用的實驗室");
String message = " delError
嘗試
{
message =(String)this . gethibernatetemplate()。執行(
新HibernateCallback() {
公共對象doInHibernate(會話Session)拋出HibernateException {
transaction tx = session . begin transaction();
嘗試{
for(int I = 0;agentCode!= null & amp& amp我& ltagent code . length;i++){
SQLQuery delAgentQuery = session . createsqlquery(" delete from operation _ agent _ base c where c . agent code = ' "+agent code[I]+" ' ");
SQLQuery delTelQuery = session . createsqlquery(" delete from OPERATION _ CUSTOMER _ TELEPHONE c where c . CUSTOMER num = ' "+agent code[I]+" ' ");
delagentquery . execute update();
deltelquery . execute update();
}
tx . commit();
}catch(異常e){
tx . roll back();
logger . error(" delete \ r \ n "+e . tostring());
e . printstacktrace();
拋出新的hibernate exception(e);
}
返回“del success”;
}
}
);
}catch(異常e)
{
logger . error(" delete \ r \ n "+e . tostring());
message = " delError
}
返回消息;
}
當遇到同樣的提示時,xietiaosql判斷選擇count(*)from where house ID =?如果返回值等於0,則不相同,反之亦然。