feiyu02
2024-11-19 752e00503f672ddfe2066afb6c235721a3a912b5
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
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.domain.entity.Evaluationrule
import cn.flightfeather.supervision.lightshare.service.EvaluationruleService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import springfox.documentation.annotations.ApiIgnore
 
@Api(tags = ["评分总规则API接口"])
@RestController
@RequestMapping("/evaluationrule")
class EvaluationruleController (val evaluationruleService: EvaluationruleService){
 
    @ApiOperation(value = "获取评分规则表")
    @GetMapping("/rule")
    fun getRules(
        @ApiParam(value = "规则主键id") @RequestParam(value = "erGuid", required = false) erGuid: String?,
        @ApiParam(value = "场景类型id") @RequestParam(value = "sceneTypeId", required = true) sceneTypeId: Int,
        @ApiParam(value = "评分表类型", allowableValues = "null, 0, 1") @RequestParam(value = "erType", required = false) erType: Int?)
    = evaluationruleService.getRule(erGuid, sceneTypeId, erType)
 
    @ApiOperation(value = "获取所有评分规则表")
    @GetMapping
    fun getAll() = evaluationruleService.findAll()
 
    @ApiOperation(value = "上传评分规则表")
    @PutMapping
    fun add(@ApiParam(value = "评分规则") @RequestBody evaluationrule: Evaluationrule) = evaluationruleService.save(evaluationrule)
 
    @ApiOperation(value = "更新评分规则表")
    @PostMapping
    fun update(@ApiParam(value = "评分规则") @RequestBody evaluationrule: Evaluationrule) = evaluationruleService.update(evaluationrule)
 
    @ApiOperation(value = "查找评分规则表")
    @GetMapping("/{id}")
    fun getById(@ApiParam(value = "评分规则表id") @PathVariable id:String) = evaluationruleService.findOne(id)
 
    @ApiIgnore
    @ApiOperation(value = "删除评分规则表")
    @DeleteMapping("/{id}")
    fun delete (@PathVariable id: String) = evaluationruleService.delete(id)
}