From aed297a5fbc8df9dab01b28da21f872ee546b43c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 13 十月 2025 16:15:11 +0800
Subject: [PATCH] 2025.10.13 1. 统一调整controller层的返回类型,通过添加全局响应增强器GlobalResponseAdvice来管理返回结果; 2. 新增mybatis-generator自定义插件,实现给数据库实体entity自动添加swagger注解@ApiModel和@ApiModelProperty
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt
index 464cb58..502dc57 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.common.exception.BizException
+import cn.flightfeather.supervision.config.IgnoreResponseAdvice
import cn.flightfeather.supervision.domain.ds1.entity.Inspection
import cn.flightfeather.supervision.lightshare.service.InspectionService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
@@ -14,34 +15,44 @@
@RestController
@RequestMapping("/inspection")
class InspectionController(val inspectionService: InspectionService) {
+ @IgnoreResponseAdvice
@GetMapping
fun getAll() = inspectionService.findAll()
+ @IgnoreResponseAdvice
@PutMapping
fun add(@RequestBody inspection: Inspection) = inspectionService.save(inspection)
+ @IgnoreResponseAdvice
@PostMapping
fun update(@RequestBody inspection: Inspection) = inspectionService.update(inspection)
+ @IgnoreResponseAdvice
@GetMapping("/{id}")
fun getById(@PathVariable id: String) = inspectionService.findByID(id)
+ @IgnoreResponseAdvice
@GetMapping("/{id}/problemlist")
fun findProblemListById(@PathVariable id: String) = inspectionService.findProblemListById(id)
+ @IgnoreResponseAdvice
@GetMapping("/{id}/gitlist")
fun findGitListById(@PathVariable id: String) = inspectionService.findGitListById(id)
+ @IgnoreResponseAdvice
@GetMapping("/{id}/{date}/lastproblemlist")
fun findLastProblemListById(@PathVariable id: String, @PathVariable date: String) =
inspectionService.findLastProblemListBySenceId(id, date)
+ @IgnoreResponseAdvice
@GetMapping("/find/{id}")
fun findBySubTaskID(@PathVariable id: String) = inspectionService.findBySubTaskID(id)
+ @IgnoreResponseAdvice
@DeleteMapping("/{id}")
fun delete(@PathVariable id: String) = inspectionService.delete(id)
+ @IgnoreResponseAdvice
@GetMapping("/getInspectionInfoByScene")
fun getInspectionInfoByScene(
@RequestParam(value = "sceneId", required = true) sceneId: String,
@@ -54,15 +65,13 @@
@ApiParam("鎬讳换鍔d") @RequestParam(required = false) topTaskId: String?,
@ApiParam("鍦烘櫙绫诲瀷id") @RequestParam(required = false) sceneTypeId: String?,
@ApiParam("鍖哄煙鏉′欢") @RequestBody(required = false) areaVo: AreaVo?,
- ): BaseResponse<Any> {
- return resPack {
- if (topTaskId != null && sceneTypeId != null) {
- inspectionService.getStatistic(topTaskId, sceneTypeId)
- } else if (areaVo != null) {
- inspectionService.getStatistic(areaVo)
- } else {
- throw BizException("缂哄け鎬讳换鍔d鍜屽尯鍩熸潯浠讹紝璇烽�夋嫨浼犺緭鍏朵腑涓�绉嶅弬鏁�")
- }
+ ) = resPack {
+ if (topTaskId != null && sceneTypeId != null) {
+ inspectionService.getStatistic(topTaskId, sceneTypeId)
+ } else if (areaVo != null) {
+ inspectionService.getStatistic(areaVo)
+ } else {
+ throw BizException("缂哄け鎬讳换鍔d鍜屽尯鍩熸潯浠讹紝璇烽�夋嫨浼犺緭鍏朵腑涓�绉嶅弬鏁�")
}
}
}
\ No newline at end of file
--
Gitblit v1.9.3