Ejemplo n.º 1
0
  public List<Rights> findDailyByCondition(Rights rights, Integer firstResult, Integer maxResults) {
    String strHql = "SELECT d FROM Rights d WHERE 1=1";
    // 员工工号
    if (null != rights.getRightsName() && !"".equals(rights.getRightsName())) {
      strHql += " AND d.rightsName LIKE('%" + rights.getRightsName() + "%')";
    }

    strHql += " ORDER BY d.rightsId";

    System.out.println(strHql);
    return dataBaseDaoHelper.getResultListByHql(strHql, firstResult, maxResults);
  }
Ejemplo n.º 2
0
  @Override
  public Long countDailyByCondition(Rights rights) {
    String strHql = "SELECT COUNT(d) FROM Rights d WHERE 1=1";

    // 员工工号
    if (null != rights.getRightsName() && !"".equals((rights.getRightsName()))) {
      strHql += " AND d.rightsName LIKE('%" + rights.getRightsName() + "%')";
    }

    strHql += " ORDER BY d.rightsId";

    System.out.println(strHql);
    return (Long) dataBaseDaoHelper.getSingleResultByHql(strHql);
  }
Ejemplo n.º 3
0
 @Override
 public void addRights(Rights rights) {
   dataBaseDaoHelper.persist(rights);
   String sql =
       "insert into t_role_rights values (s_role_rights.nextval,'" + rights.getRightsId() + "',1)";
   dataBaseDaoHelper.executeNativeSQL(sql);
 }
Ejemplo n.º 4
0
  @SuppressWarnings("unchecked")
  @Override
  public List<RightsTree> findRightsForTree() {
    String strSql =
        "select t.RIGHTS_ID,t.RIGHTS_NAME,t.RIGHTS_TYPE,"
            + "t.P_RIGHTS_ID,t.RIGHTS_LEVEL,t.RIGHTS_CONTROL_STATUS,"
            + "t.RIGHTS_PARAMTER,t.RIGHTS_STATUS,(select count(TT.RIGHTS_ID) from "
            + "T_RIGHTS TT where TT.P_RIGHTS_ID=t.RIGHTS_ID) "
            + "as children from T_RIGHTS t CONNECT BY PRIOR "
            + "RIGHTS_ID = P_RIGHTS_ID START WITH RIGHTS_LEVEL = 1";
    Query query = entityManager.createNativeQuery(strSql);
    List lisObj = query.getResultList();
    List<RightsTree> lisRightsTree = new ArrayList<RightsTree>();
    for (Object object : lisObj) {
      RightsTree rightsTree = new RightsTree();
      Rights rights = new Rights();
      Object[] objR = (Object[]) object;
      if (objR[0] != null) {
        rights.setRightsId(objR[0].toString());
      }
      if (objR[1] != null) {
        rights.setRightsName(objR[1].toString());
      }
      if (objR[2] != null) {
        rights.setRightsType(objR[2].toString());
      }
      if (objR[3] != null) {
        rights.setPrightsId(objR[3].toString());
      }
      if (objR[4] != null) {
        rights.setRightsLevel(objR[4].toString());
      }
      if (objR[5] != null) {
        rights.setRightsControlStatus(objR[5].toString());
      }
      if (objR[6] != null) {
        rights.setRightsParamter(objR[6].toString());
      }
      if (objR[7] != null) {
        rights.setRightsStatus(objR[7].toString());
      }

      rightsTree.setRights(rights);

      if (objR[8] != null) {
        int childrenCount = Integer.parseInt(objR[8].toString());
        rightsTree.setChidrenCount(childrenCount);
      }
      lisRightsTree.add(rightsTree);
    }
    return lisRightsTree;
  }