Exemplo n.º 1
0
 @SuppressWarnings("unchecked")
 @Transactional(propagation = Propagation.REQUIRED)
 public ArrayList<VColumn> getColumn(String type, String selfId) throws ChecksException {
   SqlExcuterImpl sqlMager = (SqlExcuterImpl) SpringContextUtil.getBean("SqlExcuter");
   VUser loginuser = WebContextMaker.getLoginer(WebContextMaker.getRequest());
   StringBuffer sqlBuffer = new StringBuffer();
   if (loginuser.getId().equals(SystemParms.ROOTID)) {
     sqlBuffer.append(
         " select distinct a.* from  v_column a where a.leveler = '"
             + type
             + "' and a.state = 1 and backHidden = 0 ");
   } else {
     sqlBuffer.append(
         "select distinct a.* from  v_column a left join v_power b  on (b.dataId=a.id) where a.leveler = '"
             + type
             + "' and a.state = 1 and backHidden = 0 ");
     String aa = getPowerSql(loginuser, 1, 0, 0, 0);
     if (!Checks.empty(aa)) {
       sqlBuffer.append(" and ").append(aa);
     }
   }
   if (selfId != null) {
     sqlBuffer.append(" and a.selfId ='" + selfId + "'");
   }
   sqlBuffer.append(" order by a.backSorter asc");
   String theSql = sqlBuffer.toString();
   return (ArrayList<VColumn>)
       sqlMager.sqlQuery(theSql, null, null, "com.fangshuoit.basic.entity", "VColumn", null, 0);
 }
Exemplo n.º 2
0
 @SuppressWarnings("unchecked")
 public void laodPower() throws ChecksException {
   // TODO Auto-generated method stub
   SqlExcuterImpl sqlMager = (SqlExcuterImpl) SpringContextUtil.getBean("SqlExcuter");
   VUser loginuser = WebContextMaker.getLoginer(WebContextMaker.getRequest());
   StringBuffer sqlBuffer = new StringBuffer();
   sqlBuffer.append(
       "select b.* from  v_column a left join v_power b  on (b.dataId=a.id) where  a.state = 1 and backHidden = 0 ");
   String aa = getPowerSql(loginuser, 0, 0, 0, 0);
   if (!Checks.empty(aa)) {
     sqlBuffer.append(" and ").append(aa);
   }
   List<VPower> alist =
       sqlMager.sqlQuery(
           sqlBuffer.toString(), null, null, "com.fangshuoit.basic.entity", "VPower", null, 0); //
   if (alist != null && alist.size() > 0) {
     if (PowerMap.powerMap.containsKey(loginuser.getId())) {
       PowerMap.powerMap.remove(loginuser.getId());
     }
     Map<String, Object> userMap = new HashMap<String, Object>();
     for (int i = 0; i < alist.size(); i++) {
       if (!Checks.empty(alist.get(i).getReservation())) {
         if (alist.get(i).getIfAdd() == 1 && alist.get(i).getIfNotAdd() != 1) {
           if (!userMap.containsKey(alist.get(i).getReservation() + "add")) {
             userMap.put(alist.get(i).getReservation() + "add", true);
           }
         }
         if (alist.get(i).getIfEdit() == 1 && alist.get(i).getIfNotEdit() != 1) {
           if (!userMap.containsKey(alist.get(i).getReservation() + "edit")) {
             userMap.put(alist.get(i).getReservation() + "edit", true);
           }
         }
         if (alist.get(i).getIfDel() == 1 && alist.get(i).getIfNotDel() != 1) {
           if (!userMap.containsKey(alist.get(i).getReservation() + "del")) {
             userMap.put(alist.get(i).getReservation() + "del", true);
           }
         }
         if (alist.get(i).getIfView() == 1 && alist.get(i).getIfNotView() != 1) {
           if (!userMap.containsKey(alist.get(i).getReservation() + "view")) {
             userMap.put(alist.get(i).getReservation() + "view", true);
           }
         }
       }
     }
     PowerMap.powerMap.put(loginuser.getId(), userMap);
   }
 }
Exemplo n.º 3
0
 public boolean fixGetPower(Object thId, String simpleName) throws ChecksException {
   StringBuffer sqlBuffer = new StringBuffer();
   VUser loginuser = WebContextMaker.getLoginer(WebContextMaker.getRequest());
   if (!loginuser.getId().equals(SystemParms.ROOTID)) {
     sqlBuffer.append(
         "select b.id from v_power b where power_types = '"
             + simpleName
             + "' and data_id ='"
             + thId
             + "'");
     String aa = getPowerSql(loginuser, 1, 0, 0, 0);
     if (!Checks.empty(aa)) {
       sqlBuffer.append(" and").append(aa);
     }
   } else {
     return true;
   }
   String theSql = sqlBuffer.toString();
   SqlExcuterImpl sqlMager = (SqlExcuterImpl) SpringContextUtil.getBean("SqlExcuter");
   if (sqlMager.sqlQueryString(theSql, null, null, 0) == null) return false;
   return true;
 }
Exemplo n.º 4
0
 private void editPower(String[] aa, VPower tempVo, int types, String vo) throws ChecksException {
   String id = null;
   if (aa != null && aa.length > 0) {
     String str = "";
     if (types == 1) {
       str = "ifView";
     } else if (types == 2) {
       str = "ifEdit";
     } else if (types == 3) {
       str = "ifAdd";
     } else if (types == 4) {
       str = "ifDel";
     } else if (types == 5) {
       str = "ifNotView";
     } else if (types == 6) {
       str = "ifNotEdit";
     } else if (types == 7) {
       str = "ifNotAdd";
     } else if (types == 8) {
       str = "ifNotDel";
     }
     for (int i = 0; i < aa.length; i++) {
       if (!Checks.empty(aa[i])) {
         id =
             tempVo.hqlQueryString(
                 "select id from VPower where opId='"
                     + aa[i]
                     + "' and dataId='"
                     + tempVo.getDataId()
                     + "' and powerTypes ='"
                     + tempVo.getPowerTypes()
                     + "'",
                 null,
                 null,
                 0);
         if (id != null) {
           tempVo.hqlDelUpdate(
               "update VPower set " + str + " = 1 where id='" + id + "' ", null, null, 1);
         } else {
           VPower power = new VPower();
           power.setOpId(aa[i]);
           power.setDataId(tempVo.getDataId());
           power.setPowerTypes(tempVo.getPowerTypes());
           power.setSafeLeveler(tempVo.getSafeLeveler());
           if (str.equals("ifView")) {
             power.setIfView(1);
           } else {
             power.setIfView(0);
           }
           if (str.equals("ifEdit")) {
             power.setIfEdit(1);
           } else {
             power.setIfEdit(0);
           }
           if (str.equals("ifAdd")) {
             power.setIfAdd(1);
           } else {
             power.setIfAdd(0);
           }
           if (str.equals("ifDel")) {
             power.setIfDel(1);
           } else {
             power.setIfDel(0);
           }
           if (str.equals("ifNotView")) {
             power.setIfNotView(1);
           } else {
             power.setIfNotView(0);
           }
           if (str.equals("ifNotEdit")) {
             power.setIfNotEdit(1);
           } else {
             power.setIfNotEdit(0);
           }
           if (str.equals("ifNotAdd")) {
             power.setIfNotAdd(1);
           } else {
             power.setIfNotAdd(0);
           }
           if (str.equals("ifNotDel")) {
             power.setIfNotDel(1);
           } else {
             power.setIfNotDel(0);
           }
           power.setCreater(WebContextMaker.getLoginer(WebContextMaker.getRequest()).getId());
           power.setCreatTime(new Timestamp(System.currentTimeMillis()));
           power.setMemo(vo);
           power.setReservation(tempVo.getReservation());
           tempVo.save(power);
         }
       }
     }
   }
 }
Exemplo n.º 5
0
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public void fixEditSave(Map<String, String> VPowerMap, VPower tempVo) throws ChecksException {
    if (VPowerMap != null) {
      tempVo.hqlDelUpdate("delete from VPower where dataId = :dataId", null, tempVo, 1);
      for (String key : VPowerMap.keySet()) {
        if (key.equals("departmentId1")) {
          if (!Checks.empty(VPowerMap.get("departmentId1"))) {
            String[] aa = VPowerMap.get("departmentId1").split(";");
            editPower(aa, tempVo, 1, "VDepartment");
          }
        } else if (key.equals("roleIdList1")) {
          if (!Checks.empty(VPowerMap.get("roleIdList1"))) {
            String[] aa = VPowerMap.get("roleIdList1").split(",");
            editPower(aa, tempVo, 1, "VRole");
          }
        } else if (key.equals("userIdList1")) {
          if (!Checks.empty(VPowerMap.get("userIdList1"))) {
            String[] aa = VPowerMap.get("userIdList1").split(",");
            editPower(aa, tempVo, 1, "VUser");
          }
        } else if (key.equals("departmentId2")) {
          if (!Checks.empty(VPowerMap.get("departmentId2"))) {
            String[] aa = VPowerMap.get("departmentId2").split(";");
            editPower(aa, tempVo, 2, "VDepartment");
          }
        } else if (key.equals("roleIdList2")) {
          if (!Checks.empty(VPowerMap.get("roleIdList2"))) {
            String[] aa = VPowerMap.get("roleIdList2").split(",");
            editPower(aa, tempVo, 2, "VRole");
          }
        } else if (key.equals("userIdList2")) {
          if (!Checks.empty(VPowerMap.get("userIdList2"))) {
            String[] aa = VPowerMap.get("userIdList2").split(",");
            editPower(aa, tempVo, 2, "VUser");
          }
        } else if (key.equals("departmentId3")) {
          if (!Checks.empty(VPowerMap.get("departmentId3"))) {
            String[] aa = VPowerMap.get("departmentId3").split(";");
            editPower(aa, tempVo, 3, "VDepartment");
          }
        } else if (key.equals("roleIdList3")) {
          if (!Checks.empty(VPowerMap.get("roleIdList3"))) {
            String[] aa = VPowerMap.get("roleIdList3").split(",");
            editPower(aa, tempVo, 3, "VRole");
          }
        } else if (key.equals("userIdList3")) {
          if (!Checks.empty(VPowerMap.get("userIdList3"))) {
            String[] aa = VPowerMap.get("userIdList3").split(",");
            editPower(aa, tempVo, 3, "VUser");
          }
        } else if (key.equals("departmentId4")) {
          if (!Checks.empty(VPowerMap.get("departmentId4"))) {
            String[] aa = VPowerMap.get("departmentId4").split(";");
            editPower(aa, tempVo, 4, "VDepartment");
          }
        } else if (key.equals("roleIdList4")) {
          if (!Checks.empty(VPowerMap.get("roleIdList4"))) {
            String[] aa = VPowerMap.get("roleIdList4").split(",");
            editPower(aa, tempVo, 4, "VRole");
          }
        } else if (key.equals("userIdList4")) {
          if (!Checks.empty(VPowerMap.get("userIdList4"))) {
            String[] aa = VPowerMap.get("userIdList4").split(",");
            editPower(aa, tempVo, 4, "VUser");
          }
        } else if (key.equals("departmentId5")) {
          if (!Checks.empty(VPowerMap.get("departmentId5"))) {
            String[] aa = VPowerMap.get("departmentId5").split(";");
            editPower(aa, tempVo, 5, "VDepartment");
          }
        } else if (key.equals("roleIdList5")) {
          if (!Checks.empty(VPowerMap.get("roleIdList5"))) {
            String[] aa = VPowerMap.get("roleIdList5").split(",");
            editPower(aa, tempVo, 5, "VRole");
          }
        } else if (key.equals("userIdList5")) {
          if (!Checks.empty(VPowerMap.get("userIdList5"))) {
            String[] aa = VPowerMap.get("userIdList5").split(",");
            editPower(aa, tempVo, 5, "VUser");
          }
        } else if (key.equals("departmentId6")) {
          if (!Checks.empty(VPowerMap.get("departmentId6"))) {
            String[] aa = VPowerMap.get("departmentId6").split(";");
            editPower(aa, tempVo, 6, "VDepartment");
          }
        } else if (key.equals("roleIdList6")) {
          if (!Checks.empty(VPowerMap.get("roleIdList6"))) {
            String[] aa = VPowerMap.get("roleIdList6").split(",");
            editPower(aa, tempVo, 6, "VRole");
          }
        } else if (key.equals("userIdList6")) {
          if (!Checks.empty(VPowerMap.get("userIdList6"))) {
            String[] aa = VPowerMap.get("userIdList6").split(",");
            editPower(aa, tempVo, 6, "VUser");
          }

        } else if (key.equals("departmentId7")) {
          if (!Checks.empty(VPowerMap.get("departmentId7"))) {
            String[] aa = VPowerMap.get("departmentId7").split(";");
            editPower(aa, tempVo, 7, "VDepartment");
          }
        } else if (key.equals("roleIdList7")) {
          if (!Checks.empty(VPowerMap.get("roleIdList7"))) {
            String[] aa = VPowerMap.get("roleIdList7").split(",");
            editPower(aa, tempVo, 7, "VRole");
          }
        } else if (key.equals("userIdList7")) {
          if (!Checks.empty(VPowerMap.get("userIdList7"))) {
            String[] aa = VPowerMap.get("userIdList7").split(",");
            editPower(aa, tempVo, 7, "VUser");
          }
        } else if (key.equals("departmentId8")) {
          if (!Checks.empty(VPowerMap.get("departmentId8"))) {
            String[] aa = VPowerMap.get("departmentId8").split(";");
            editPower(aa, tempVo, 8, "VDepartment");
          }
        } else if (key.equals("roleIdList8")) {
          if (!Checks.empty(VPowerMap.get("roleIdList8"))) {
            String[] aa = VPowerMap.get("roleIdList8").split(",");
            editPower(aa, tempVo, 8, "VRole");
          }
        } else if (key.equals("userIdList8")) {
          if (!Checks.empty(VPowerMap.get("userIdList8"))) {
            String[] aa = VPowerMap.get("userIdList8").split(",");
            editPower(aa, tempVo, 8, "VUser");
          }
        }
      }
    }
  }