【惯用需求收集】数据库交互类
【常用需求收集】数据库交互类
1、查询是否存在此编号或名称,存在与不存在,建议用select count(*) from ....
例:
hql = "select count(*) from BasePipeline"; int count = (Integer) HibernateWrapper.queryOneObject(hql); if (count == 0) {// 是否子节点,open表示叶子,close表示不是叶子 childJson.put("state", "open"); } else if(count == 1){ //********** } else{ childJson.put("state", "closed"); }