コード例 #1
0
  /**
   * 删除角色
   *
   * @param request
   * @param response
   * @return
   */
  public String delete(HttpServletRequest request, HttpServletResponse response) {
    Operator operator = new Operator();
    operator.setRoleid(Long.parseLong(request.getParameter("id")));
    List<Operator> list = new ArrayList<Operator>();
    ;
    try {
      list = ioperatorService.findOperators(operator);
    } catch (Exception e1) {
      e1.printStackTrace();
    }

    if (list != null && list.size() > 0) {
      AjaxReturnUtil rmsg = new AjaxReturnUtil(false, "该角色无法删除,操作员拥有此角色", null);
      return GsonUtil.getJsonFromObject(rmsg);
    } else {
      try {
        iroleService.deleteRole(Long.parseLong(request.getParameter("id")));
      } catch (Exception e) {
        AjaxReturnUtil rmsg = new AjaxReturnUtil(false, e.getMessage(), null);
        return GsonUtil.getJsonFromObject(rmsg);
      }
      AjaxReturnUtil rmsg = new AjaxReturnUtil(true, "成功", null);
      return GsonUtil.getJsonFromObject(rmsg);
    }
  }
コード例 #2
0
 /**
  * 删除操作员
  *
  * @param id
  * @throws Exception
  */
 @Transactional(readOnly = false)
 public void deleteOperator(long id) throws Exception {
   Operator operator = new Operator();
   operator.setId(id);
   operatorDao.deleteOperator(operator);
 }
コード例 #3
0
 /**
  * 根据主键查找操作员
  *
  * @param id
  * @return
  * @throws Exception
  */
 public Operator getOperatorById(long id) throws Exception {
   Operator operator = new Operator();
   operator.setId(id);
   return operatorDao.getOperatorById(operator);
 }