riku
2021-09-26 7919d4bab9e4d787b5a8d5dd6c9d99d22e394ca7
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
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.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["评分总规则API接口"])
@RestController
@RequestMapping("/evaluationrule")
class EvaluationruleController (val evaluationruleService: EvaluationruleService){
 
    @GetMapping("/rule")
    fun getRules(
            @RequestParam(value = "erGuid", required = false) erGuid: String?,
            @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)
 
    @GetMapping
    fun getAll() = evaluationruleService.findAll()
 
    @PutMapping
    fun add(@RequestBody evaluationrule: Evaluationrule) = evaluationruleService.save(evaluationrule)
 
    @PostMapping
    fun update(@RequestBody evaluationrule: Evaluationrule) = evaluationruleService.update(evaluationrule)
 
    @GetMapping("/{id}")
    fun getById(@PathVariable id:String) = evaluationruleService.findOne(id)
 
    @DeleteMapping("/{id}")
    fun delete (@PathVariable id: String) = evaluationruleService.delete(id)
}