class SysDeptRestApi {

  @PUT
  @Path("/edit")
  @SubmarineApi
  public Response edit(SysDept sysDept) {
    LOG.info("edit({})", sysDept.toString());
    try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
      SysDeptMapper sysDeptMapper = sqlSession.getMapper(SysDeptMapper.class);

      SysDept dept = sysDeptMapper.getById(sysDept.getId());
      if (dept == null) {
        return new JsonResponse.Builder<>(Response.Status.OK)
            .message("Can not found department:" + sysDept.getId()).success(false).build();
      }
      sysDeptMapper.updateBy(sysDept);
      sqlSession.commit();
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      return new JsonResponse.Builder<>(Response.Status.OK)
          .message("Update department failed!").success(false).build();
    }

    return new JsonResponse.Builder<>(Response.Status.OK).success(true)
        .message("Update department successfully!").build();
  }

  @Inject public  SysDeptRestApi();

}