Beispiel #1
0
 private List<ActionResource> findResources() {
   Employee employee = (Employee) getSession().get(LOGIN_USER);
   SystemSetting setting = (SystemSetting) getApplication().get(ConstValue.SYS_SETTING);
   Boolean opened = setting.getCompanyInfo().getOpened();
   List<ActionResource> resources = employeeService.findUserResources(employee.getId(), !opened);
   Collections.sort(resources, new LftRgtTreeNodeComparator()); // 按左值排序。
   return resources;
 }
Beispiel #2
0
 @Override
 protected void beforInputSave() {
   logger.debug("beforInputSave...");
   if (StringUtils.isNotBlank(id)) {
     employee = employeeService.getById(id);
     employee.setDepartment(null);
     employee.getUser().getRoles().clear();
     // Set<Role> roles = employee.getRoles();
     if (isEditSave()) {
       // 如果是修改后的保存,因为prepare到save前会执行一次Set操作(modelDriven),
       // 所以要在保存前将其关联的对象置空
     } else {
       // 修改前的数据回显准备
       // ids = new Long[roles.size()];
       // int i = 0;
       // for (Role role : roles) {
       // ids[i++] = role.getId();
       // }
     }
   }
 }
Beispiel #3
0
 @Override
 public String save() {
   if (employee.getDepartment() == null
       || employee.getDepartment().getId() == null
       || employee.getDepartment().getId() == -1) {
     employee.setDepartment(null);
   }
   // 修改后传过来的ids数组
   if (StringUtils.isNotBlank(ids)) {
     String[] idsStr = ids.split(",");
     Long[] idsLong = ArrayConverter.Strings2Longs(idsStr);
     for (Long idL : idsLong) {
       employee.getUser().getRoles().add(new Role(idL));
     }
   }
   if (StringUtils.isNotBlank(id)) {
     employeeService.update(employee);
   } else {
     employeeService.save(employee);
   }
   actionJsonResult = new ActionJsonResult(employee);
   return JSONLIST;
 }