DAO layer Summary 2 (inquiry)

xiaoxiao2021-03-06  64

/ * ** Point query function table * @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;

/ ** * Query the data of the Partyrel table according to a certain condition * @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 (): function generation table query object point error", ex);} try {return query.list ();} catch (HibernateException ex) {throw new SysException ( "9000004", "FuncNodeDAO.findFuncNodelPO ( : Query Function Point Table Record Error ", EX);

}

/ ** * construction Hql * @param vo FuncNodeVO contain query * @param flag String query the old and new record mark * @throws SysException * @throws AppException * @return String return 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 (vol.getsubsystemname ()! = null) {HQL = HQL "a.subsystemname = '" Vo.getysystemName () "'and";}} @ gtfuncnodetype ()! = null) {HQL = HQL "a.FuncNodeType ='" "g dcnodetype () " 'and ";} if (Vo.getNodeTreeID ()! = N ULL) {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;

转载请注明原文地址:https://www.9cbs.com/read-118972.html

New Post(0)