/**
* 查询功能点表
* @param vo FuncNodeVO
* @throws SysException
* @throws AppException
* @return List
*/
public List findFuncNode(FuncNodeVO vo) throws
SysException, AppException {
List list = findFuncNodePO(vo);
ArrayList ret = new ArrayList();
try {
if (list != null) {
PropertyCopy.PO2VO(list,ret);
}
} catch (PropertyCopyException ex) {
ex.printStackTrace();
throw new SysException("9000005",
"FuncNodeDAO.findFuncNode():PropertyCopyException", ex);
}
return ret;
}
/**
* 根据一定条件查询PartyRel表的数据
* @param vo FuncNodeVO
* @throws SysException
* @throws AppException
* @return List
*/
private List findFuncNodePO(FuncNodeVO vo) throws
SysException, AppException {
String hql = constructHql(vo);
Query query = null;
try {
query = session.createQuery(hql);
} catch (HibernateException ex) {
throw new SysException("9000004",
"FuncNodeDAO.findFuncNodelPO():生成功能点表查询对象出错", ex);
}
try {
return query.list();
} catch (HibernateException ex) {
throw new SysException("9000004",
"FuncNodeDAO.findFuncNodelPO():查询功能点表记录出错", ex);
}
}
/**
* 构造Hql
* @param vo FuncNodeVO 包含查询条件
* @param flag String 查询新旧记录标志
* @throws SysException
* @throws AppException
* @return String 返回Hql
*/
private String constructHql(FuncNodeVO vo) throws
SysException, AppException {
String hql = "from FuncNode as a where ";
if (vo.getFuncNodeId() != null) {
hql = hql + "a.funcNodeId='" + vo.getFuncNodeId() + "' and ";
}
if (vo.getFuncNodeCode() != 0 ) {
hql = hql + "a.funcNodeCode='" + vo.getFuncNodeCode() + "' and ";
}
if (vo.getFuncNodeName() !=null ){
hql = hql + "a.funcNodeName='" + vo.getFuncNodeName() + "' and ";
}
if (vo.getSubSystemName() != null) {
hql = hql + "a.subSystemName='" + vo.getSubSystemName() + "' and ";
}
if ( vo.getFuncNodeType() !=null ) {
hql = hql + "a.funcNodeType='" + vo.getFuncNodeType() + "' and ";
}
if (vo.getNodeTreeId() != null ){
hql = hql + "a.nodeTreeId='" + vo.getNodeTreeId() + "' and ";
}
if (hql.endsWith("where ")) {
hql = hql.substring(0, hql.length() - 6);
} else {
hql = hql.substring(0, hql.length() - 4);
}
return hql;
}