예제 #1
0
 /**
  * @Title: saveDataField @Description: 保存操作 @Autohr guoxuelian#symdata.cn
  *
  * @param @param dataField
  * @param @param dto
  * @param @return
  * @return TransDto
  * @throws 2015年9月12日下午3:10:43
  */
 @RequiresPermissions("power:datafield:add")
 @RequestMapping(value = "/save")
 public @ResponseBody Map<String, Object> saveDataField(DataField dataField, TransDto dto)
     throws DatabaseException {
   Map<String, Object> data = Maps.newConcurrentMap();
   if (!StringUtils.isNotBlank(dataField.getCode())
       || !StringUtils.isNotBlank(dataField.getName())) {
     data.put("message", Message.error(ErrorCode.ERR1001.getDescription()));
     return data;
   }
   dataFieldService.save(dataField);
   data.put("message", SUCCESS_MESSAGE);
   return data;
 }
예제 #2
0
 /**
  * @Title: perModify @Description: 编辑操作 @Autohr guoxuelian#symdata.cn
  *
  * @param @param dataField
  * @param @param model
  * @param @return
  * @return String
  * @throws 2015年9月12日下午3:10:57
  */
 @RequiresPermissions("power:datafield:edit")
 @RequestMapping(value = "/edit")
 public String editDataField(DataField dataField, ModelMap model) throws DatabaseException {
   List<Menu> pageList = menuService.findAll();
   dataField = dataFieldService.findOne(dataField.getId());
   model.addAttribute("dataField", dataField);
   model.addAttribute("page", JsonMapper.nonDefaultMapper().toJson(pageList));
   return "datafield/edit";
 }
예제 #3
0
  @Override
  public List<DataField> findDataFieldByEnable(User user, String menuIds) throws DatabaseException {
    List<DataField> resultList = Lists.newArrayList();
    List<DataField> dataFieldList = dataFieldDao.findDataFieldByEnable();
    for (DataField dataField : dataFieldList) {
      String users = dataField.getUsers();
      if (users.contains(user.getId())) {
        dataField.setIsChecked(1);
      }

      if (StringUtils.isNotBlank(menuIds)
          && dataField.getMenu() != null
          && StringUtils.isNotBlank(dataField.getMenu().getId())) {
        if (!menuIds.contains(dataField.getMenu().getId())) { // 过滤所有包含该菜单ID的按钮
          resultList.add(dataField);
        }
      }
    }

    if (resultList != null && resultList.size() > 0) {
      dataFieldList.removeAll(resultList);
    }
    return dataFieldList;
  }