perryhsu
2020-10-17 a543f4de1c91ef6f43aace92975c6cf28de23618
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.fgkj.controller;
 
import com.fgkj.util.*;
 
import com.fgkj.dto.PageParam;
import com.fgkj.dto.ServiceModel;
import com.fgkj.services.PageParamService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * 页面参数状态类
 */
@RequestMapping("pageParam")
@RestController
@Api
public class PageParamController{
 
    @Autowired
    private PageParamService service;
 
    @GetMapping("byCategoryId")
    public ServiceModel findByCategoryId(@RequestParam int categoryId){
        //前端传参: json字符串 json={categoryId:1}
        ServiceModel model = service.findByCategoryId(categoryId);
 
        return model;
    }
    
    //编辑单个参数
    @PutMapping("/")
    public ServiceModel update(@RequestBody PageParam param){
        ServiceModel model = service.update(param.getId(),param.getStatus());
 
        return model;
    }
    
}