InspectionTemplateController.java
2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.glsx.usedcar.controller;
import com.glsx.usedcar.module.inspect.service.InspectionNodeService;
import com.glsx.usedcar.module.inspect.service.InspectionTemplateService;
import com.glsx.usedcar.resp.BaseResp;
import com.glsx.usedcar.module.inspect.vo.DefaultValueItemDTO;
import com.glsx.usedcar.module.inspect.vo.InspectionRootNodeVO;
import com.glsx.usedcar.module.inspect.vo.InspectionTemplateDefaultValueReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 检测报告模版前端控制器
* @author yangwei
* @version 1.0
* @since 2026/03/11 18:13
*/
@Slf4j
@RestController
@RequestMapping("/rest/inspectionTemplate")
@RequiredArgsConstructor
@Tag(name = "检测报告模版前端控制器", description = "检测报告模版的增删改查操作")
public class InspectionTemplateController {
private final InspectionNodeService inspectionNodeService;
private final InspectionTemplateService inspectionTemplateService;
/**
* 查询检测模版根节点列表
*
* @param taskId 检测工单Id
* @return 根节点列表
*/
@GetMapping("/{taskId}/rootNodes")
@Operation(summary = "查询检测模版根节点", description = "根据模版ID查询该模版下的所有根节点(parentId=0),按sortOrder升序排列")
public BaseResp<List<InspectionRootNodeVO>> listRootNodes(
@PathVariable @Parameter(description = "检测工单ID", required = true) Long taskId) {
List<InspectionRootNodeVO> rootNodes = inspectionNodeService.listRootNodes(taskId);
return BaseResp.success(rootNodes);
}
@PostMapping("/default")
@Operation(summary = "获取模版默认值", description = "获取模版默认值")
public BaseResp<Map<String, List<DefaultValueItemDTO>>> getTemplateDefaultValue(
@RequestBody @Valid @Parameter(description = "请求参数", required = true) InspectionTemplateDefaultValueReqVO reqVO) {
return BaseResp.success(inspectionTemplateService.getTemplateDefaultValue(reqVO));
}
}