陶杰
2024-08-22 ee9032d9baf5f33e376d2d2699136e0a7b26bec7
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
package com.mzl.flower.web.system;
 
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.request.system.ContentSaveDTO;
import com.mzl.flower.dto.response.system.ContentDTO;
import com.mzl.flower.dto.response.system.ContentListDTO;
import com.mzl.flower.service.system.ConfigContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.constraints.NotBlank;
import java.util.List;
 
@RestController
@RequestMapping("/api/config/content")
@Api(value = "内容配置管理", tags = "内容配置管理")
@Validated
public class ConfigContentController extends BaseController {
 
    @Autowired
    private ConfigContentService contentService;
 
    @GetMapping("/list")
    @ApiOperation(value = "查询内容列表")
    public ResponseEntity<ReturnDataDTO<List<ContentListDTO>>> selectContentList() {
        return returnData(R.SUCCESS.getCode(), contentService.selectContentList());
    }
 
    @PostMapping("/list/save")
    @ApiOperation(value = "新增内容")
    public ResponseEntity<ReturnDataDTO> saveContent(@RequestBody ContentSaveDTO dto) {
        return returnData(R.SUCCESS.getCode(), contentService.saveContent(dto));
    }
 
    @GetMapping("/list/view")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query")
    })
    @ApiOperation(value = "查询内容详情")
    public ResponseEntity<ReturnDataDTO<ContentDTO>> getContent(@NotBlank(message = "id不能为空") String id) {
        return returnData(R.SUCCESS.getCode(), contentService.getContent(id));
    }
 
}