From 68985c22a03d280a96e89f4d0e67f144259fab92 Mon Sep 17 00:00:00 2001 From: 安瑾然 <107107765@qq.com> Date: 星期三, 13 七月 2022 11:54:54 +0800 Subject: [PATCH] commit --- src/main/java/com/example/jz/controller/CommonQuestionController.java | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/jz/controller/CommonQuestionController.java b/src/main/java/com/example/jz/controller/CommonQuestionController.java index a8256a0..3fecef8 100644 --- a/src/main/java/com/example/jz/controller/CommonQuestionController.java +++ b/src/main/java/com/example/jz/controller/CommonQuestionController.java @@ -14,7 +14,7 @@ import javax.annotation.Resource; import java.io.Serializable; -import java.util.List; +import java.util.Date; /** * 甯歌闂琛�(CommonQuestion)琛ㄦ帶鍒跺眰 @@ -66,6 +66,8 @@ @PostMapping @ApiOperation(value = "鏂板鏁版嵁", notes = "鏂板鏁版嵁") public R<Boolean> insert(@RequestBody CommonQuestion commonQuestion) { + commonQuestion.setStatus(0); + commonQuestion.setCtime(new Date()); return R.ok(commonQuestionService.save(commonQuestion)); } @@ -78,18 +80,50 @@ @PutMapping @ApiOperation(value = "淇敼鏁版嵁", notes = "淇敼鏁版嵁") public R<Boolean> update(@RequestBody CommonQuestion commonQuestion) { + if (commonQuestion.getId() == 1) { + commonQuestion.setReleaseTime(new Date()); + } return R.ok(commonQuestionService.updateById(commonQuestion)); } /** * 鍒犻櫎鏁版嵁 * - * @param idList 涓婚敭缁撳悎 + * @param id 涓婚敭 * @return 鍒犻櫎缁撴灉 */ @DeleteMapping @ApiOperation(value = "鍒犻櫎鏁版嵁", notes = "鍒犻櫎鏁版嵁") - public R<Boolean> delete(@RequestParam("idList") List<Long> idList) { - return R.ok(commonQuestionService.removeByIds(idList)); + public R<Boolean> delete(@RequestParam("id") Serializable id) { + return R.ok(commonQuestionService.removeById(id)); + } + + /** + * 鍙戝竷 + * + * @param id 涓婚敭 + * @return 鍙戝竷缁撴灉 + */ + @ApiOperation(value = "鍙戝竷", notes = "鍙戝竷") + @GetMapping("release/{id}") + public R<Boolean> release(@PathVariable Serializable id) { + CommonQuestion commonQuestion = commonQuestionService.getById(id); + commonQuestion.setReleaseTime(new Date()); + commonQuestion.setStatus(1); + return R.ok(commonQuestionService.updateById(commonQuestion)); + } + + /** + * 涓嬫灦 + * + * @param id 涓婚敭 + * @return 鍙戝竷缁撴灉 + */ + @ApiOperation(value = "涓嬫灦", notes = "涓嬫灦") + @GetMapping("offline/{id}") + public R<Boolean> offline(@PathVariable Serializable id) { + CommonQuestion commonQuestion = commonQuestionService.getById(id); + commonQuestion.setStatus(2); + return R.ok(commonQuestionService.updateById(commonQuestion)); } } -- Gitblit v1.8.0