class SysDeptRestApi {

  @DELETE
  @Path("/delete")
  @SubmarineApi
  public Response delete(@QueryParam("id") String id, @QueryParam("deleted") int deleted) {
    LOG.info("delete({}, {})", id, deleted);
    String msgOperation = "Delete";
    if (deleted == 0) {
      msgOperation = "Restore";
    }


    try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
      SysDeptMapper sysDeptMapper = sqlSession.getMapper(SysDeptMapper.class);

      SysDept dept = new SysDept();
      dept.setId(id);
      dept.setDeleted(deleted);
      sysDeptMapper.updateBy(dept);
      sqlSession.commit();
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      return new JsonResponse.Builder<>(Response.Status.OK)
          .message(msgOperation + " department failed!").success(false).build();
    }

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

  @Inject public  SysDeptRestApi();

}