kongzy
2023-12-08 ca5445257b1fdeceddf3fcc2dea18c442023aeb7
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.gkhy.assess.admin.controller.web;
 
import com.gkhy.assess.common.annotation.RepeatSubmit;
import com.gkhy.assess.common.api.CommonResult;
import com.gkhy.assess.system.domain.SysLaw;
import com.gkhy.assess.system.service.SysLawService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
@Api(tags = "法律法规前端控制器")
@RestController
@RequestMapping("/system/law")
public class SysLawController {
    @Autowired
    private SysLawService lawService;
 
    @ApiOperation(value = "法律法规列表(分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
    })
    @GetMapping("/lawList")
    public CommonResult lawList(SysLaw law){
        return CommonResult.success(lawService.lawList(law));
    }
 
 
    @ApiOperation(value = "根据id获取法律法规详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "lawId", dataType = "int", required = true, value = "法律法规id")
    })
    @GetMapping("/getLawById")
    public CommonResult getLawById(@RequestParam(required = true)Long lawId){
        return CommonResult.success(lawService.getLawById(lawId));
    }
 
    @RepeatSubmit
    @RequiresPermissions("system:assess:monitor")
    @ApiOperation(value = "新增法律法规")
    @PostMapping("/addLaw")
    public CommonResult addLaw(@Validated @RequestBody SysLaw law){
        return CommonResult.success(lawService.addLaw(law));
    }
 
 
    @RepeatSubmit
    @RequiresPermissions("system:assess:monitor")
    @ApiOperation(value = "编辑法律法规")
    @PutMapping("/editLaw")
    public CommonResult editLaw(@Validated @RequestBody SysLaw law){
        return CommonResult.success(lawService.editLaw(law));
    }
 
 
    @RepeatSubmit
    @RequiresPermissions("system:assess:monitor")
    @ApiOperation(value = "删除法律法规")
    @DeleteMapping("/remove/{lawId}")
    public CommonResult removeLaw(@PathVariable(name = "lawId")Long lawId){
        return CommonResult.success(lawService.deleteLawById(lawId));
    }
 
 
    @RepeatSubmit
    @RequiresPermissions("system:assess:monitor")
    @ApiOperation(value = "法律法规状态修改,停用/启用")
    @PostMapping("/changeStatus")
    public CommonResult changeStatus(@RequestBody SysLaw law)
    {
        return CommonResult.success(lawService.changeLawStatus(law));
    }
 
}