hejianhao
2026-08-18 3df055ea1038e0bbcbbbf80ccbeea43c82952932
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
package com.tcm.training.admin.system.controller;
 
import com.tcm.training.admin.common.ApiResponse;
import com.tcm.training.admin.system.dto.AgreementContentSaveRequest;
import com.tcm.training.admin.system.service.AgreementContentAppService;
import com.tcm.training.admin.system.vo.AgreementContentItemVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.validation.Valid;
import java.util.List;
 
@Validated
@RestController
@RequestMapping({"/api/v1", "/api"})
public class AgreementContentController {
 
    private final AgreementContentAppService agreementContentAppService;
 
    public AgreementContentController(AgreementContentAppService agreementContentAppService) {
        this.agreementContentAppService = agreementContentAppService;
    }
 
    @GetMapping("/agreement-contents")
    public ApiResponse<List<AgreementContentItemVO>> list() {
        return ApiResponse.ok(agreementContentAppService.list());
    }
 
    @PutMapping("/agreement-contents/{agreementType}")
    public ApiResponse<AgreementContentItemVO> save(@PathVariable("agreementType") String agreementType,
                                                    @Valid @RequestBody AgreementContentSaveRequest request) {
        return ApiResponse.ok(agreementContentAppService.save(agreementType, request));
    }
}