|
|
@@ -0,0 +1,107 @@
|
|
|
+package com.uas.kanban.controller;
|
|
|
+
|
|
|
+import com.uas.kanban.annotation.NotEmpty;
|
|
|
+import com.uas.kanban.base.BaseController;
|
|
|
+import com.uas.kanban.exception.OperationException;
|
|
|
+import com.uas.kanban.model.KanbanHistory;
|
|
|
+import com.uas.kanban.service.KanbanHistoryService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 看板历史记录
|
|
|
+ *
|
|
|
+ * @author sunyj
|
|
|
+ * @since 2017/12/13 9:18
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/kanbanHistory")
|
|
|
+public class KanbanHistoryController extends BaseController<KanbanHistory> {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KanbanHistoryService kanbanHistoryService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public KanbanHistory save(@NotEmpty("json") String json, HttpServletRequest request) throws OperationException {
|
|
|
+ return super.save(json, request);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public KanbanHistory savePart(@NotEmpty("json") String json, HttpServletRequest request) throws OperationException {
|
|
|
+ throw new OperationException("不支持的操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int update(@NotEmpty("json") String json, HttpServletRequest request) throws IllegalArgumentException, OperationException {
|
|
|
+ throw new OperationException("不支持的操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updatePart(@NotEmpty("json") String json, HttpServletRequest request) throws IllegalArgumentException, OperationException {
|
|
|
+ throw new OperationException("不支持的操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int deleteAll(HttpServletRequest request) throws OperationException {
|
|
|
+ throw new OperationException("不支持的操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取指定看板的历史记录
|
|
|
+ *
|
|
|
+ * @param kanbanCode 看板 code
|
|
|
+ * @param request request
|
|
|
+ * @return 历史记录
|
|
|
+ */
|
|
|
+ @RequestMapping("/get/byKanban/{kanbanCode}")
|
|
|
+ @ResponseBody
|
|
|
+ public List<KanbanHistory> getByKanbanCode(@PathVariable("kanbanCode") String kanbanCode, HttpServletRequest request) {
|
|
|
+ return kanbanHistoryService.findByKanbanCode(kanbanCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除指定看板的历史记录
|
|
|
+ *
|
|
|
+ * @param kanbanCode 看板 code
|
|
|
+ * @param request request
|
|
|
+ * @return 删除的数据条数
|
|
|
+ */
|
|
|
+ @RequestMapping("/delete/byKanban/{kanbanCode}")
|
|
|
+ @ResponseBody
|
|
|
+ public int deleteByKanbanCode(@PathVariable("kanbanCode") String kanbanCode, HttpServletRequest request) {
|
|
|
+ return kanbanHistoryService.deleteByKanbanCode(kanbanCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存指定看板的历史记录
|
|
|
+ *
|
|
|
+ * @param kanbanCode 看板 code
|
|
|
+ * @param description 关于此次记录的描述
|
|
|
+ * @param request request
|
|
|
+ * @return 历史记录
|
|
|
+ */
|
|
|
+ @RequestMapping("/backup/byKanban/{kanbanCode}")
|
|
|
+ @ResponseBody
|
|
|
+ public KanbanHistory backup(@PathVariable("kanbanCode") String kanbanCode, String description, HttpServletRequest request) {
|
|
|
+ return kanbanHistoryService.backup(kanbanCode, description, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据备份的历史记录恢复看板
|
|
|
+ *
|
|
|
+ * @param code 历史记录 code
|
|
|
+ * @param request request
|
|
|
+ * @return 更新的数据条数
|
|
|
+ */
|
|
|
+ @RequestMapping("/restore/{code}")
|
|
|
+ @ResponseBody
|
|
|
+ public int restore(@PathVariable("code") String code, HttpServletRequest request) throws OperationException {
|
|
|
+ return kanbanHistoryService.restore(code);
|
|
|
+ }
|
|
|
+}
|