whyclxw
2024-04-22 ec33a306d97e52eb725b47f48d337ce357a8ef6a
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
59
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.pojo.PageParam;
import com.whyc.pojo.PageParamUser;
import com.whyc.service.PageParamUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
@RestController
@RequestMapping("pageParamUser")
@Api(tags = "系统设置-系统配置-用户页面参数")
public class PageParamUserController {
 
    @Autowired
    private PageParamUserService service;
 
    @GetMapping("allList")
    @ApiOperation(value = "查询待添加和已添加参数列表")
    public Response<Map<Integer, List<PageParamUser>>> getAllList(@RequestParam int type){
        Map<Integer, List<PageParamUser>> map = service.getAllList(type);
        return new Response<Map<Integer, List<PageParamUser>>>().set(1,map);
    }
 
    @GetMapping("list")
    @ApiOperation(value = "查询可用参数列表")
    public Response<List<PageParamUser>> getList(@RequestParam int type){
        List<PageParamUser> paramList = service.getList(type);
        return new Response<List<PageParamUser>>().set(1,paramList);
    }
 
    @PostMapping("updateList")
    @ApiOperation(value = "添加或者移除参数配置")
    public Response updateList(@RequestParam int operationFlag,@RequestBody List<PageParamUser> pageParamUserList){
        service.updateList(pageParamUserList,operationFlag);
        return new Response().setII(1,"更新成功");
    }
 
    @PostMapping("list")
    @ApiOperation(value = "新增参数配置",notes = "在用户从未配置过参数时添加调用本接口")
    public Response addList(@RequestBody List<PageParamUser> pageParamUserList){
        service.addList(pageParamUserList);
        return new Response().setII(1,"添加成功");
    }
 
    @PostMapping("allParamList")
    @ApiOperation(value = "更新所有参数配置",notes = "更新所有参数")
    public Response updateParamList(@RequestBody List<PageParamUser> pageParamUserList){
        service.updateParamList(pageParamUserList);
        return new Response().setII(1,"更新成功");
    }
 
}