package com.whyc.controller;
|
|
import com.whyc.dto.Response;
|
import com.whyc.pojo.PageParam;
|
import com.whyc.service.PageParamService;
|
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("pageParam")
|
@Api(tags = "系统设置-系统配置-页面参数")
|
public class PageParamController {
|
|
@Autowired
|
private PageParamService service;
|
|
@GetMapping("allList")
|
@ApiOperation(value = "查询待添加和已添加参数列表")
|
public Response<Map<Integer, List<PageParam>>> getAllList(@RequestParam int categoryId){
|
Map<Integer, List<PageParam>> map = service.getAllList(categoryId);
|
return new Response<Map<Integer, List<PageParam>>>().set(1,map);
|
}
|
|
@GetMapping("list")
|
@ApiOperation(value = "查询可用参数列表")
|
public Response<List<PageParam>> getList(@RequestParam int categoryId){
|
List<PageParam> paramList = service.getList(categoryId);
|
return new Response<List<PageParam>>().set(1,paramList);
|
}
|
|
@PutMapping("list")
|
@ApiOperation(value = "添加或者移除参数配置")
|
public Response updateList(@RequestParam int operationFlag,@RequestBody List<PageParam> pageParamList){
|
service.updateList(pageParamList,operationFlag);
|
return new Response().setII(1,"更新成功");
|
}
|
|
@PostMapping("list")
|
@ApiOperation(value = "新增参数配置",notes = "在用户从未配置过参数时添加调用本接口")
|
public Response addList(@RequestBody List<PageParam> pageParamList){
|
service.addList(pageParamList);
|
return new Response().setII(1,"添加成功");
|
}
|
|
}
|