class SysDeptRestApi {

  @POST
  @Path("/add")
  @SubmarineApi
  public Response add(SysDept sysDept) {
    LOG.info("add({})", sysDept.toString());

    try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
      SysDeptMapper sysDeptMapper = sqlSession.getMapper(SysDeptMapper.class);
      sysDeptMapper.add(sysDept);
      sqlSession.commit();
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      return new JsonResponse.Builder<>(Response.Status.OK).success(false)
          .message("Save department failed!").build();
    }

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

  @Inject public  SysDeptRestApi();

}