提交 | 用户 | 时间
|
92d87e
|
1 |
package com.iailab.module.mcs.controller; |
潘 |
2 |
|
|
3 |
import com.iailab.common.annotation.LogOperation; |
|
4 |
import com.iailab.framework.common.page.PageData; |
|
5 |
import com.iailab.common.utils.Constant; |
|
6 |
import com.iailab.framework.common.pojo.CommonResult; |
|
7 |
|
|
8 |
import com.iailab.framework.common.util.validation.ValidationUtils; |
|
9 |
import com.iailab.framework.common.validation.group.AddGroup; |
|
10 |
import com.iailab.framework.common.validation.group.DefaultGroup; |
|
11 |
import com.iailab.framework.common.validation.group.UpdateGroup; |
|
12 |
import com.iailab.module.mcs.dto.StModelRunlogDTO; |
|
13 |
import com.iailab.module.mcs.service.StModelRunlogService; |
|
14 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
15 |
import io.swagger.v3.oas.annotations.Operation; |
|
16 |
import io.swagger.v3.oas.annotations.Parameter; |
|
17 |
import io.swagger.v3.oas.annotations.Parameters; |
|
18 |
import javax.annotation.Resource; |
|
19 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
20 |
import org.springframework.web.bind.annotation.*; |
|
21 |
|
|
22 |
|
|
23 |
import java.util.Map; |
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* 运行日志表 |
|
28 |
* |
|
29 |
* @author lirm ${email} |
|
30 |
* @since 1.0.0 2023-07-04 |
|
31 |
*/ |
|
32 |
@RestController |
|
33 |
@RequestMapping("/model/mcs/runlog") |
|
34 |
@Tag(name = "运行日志表") |
|
35 |
public class StModelRunlogController { |
|
36 |
@Resource |
|
37 |
private StModelRunlogService runlogService; |
|
38 |
|
|
39 |
@GetMapping("page") |
|
40 |
@Operation(summary = "分页") |
|
41 |
@Parameters({ |
|
42 |
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
|
43 |
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
|
44 |
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
|
45 |
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
|
46 |
}) |
|
47 |
public CommonResult<PageData<StModelRunlogDTO>> page(@RequestParam Map<String, Object> params){ |
|
48 |
PageData<StModelRunlogDTO> page = runlogService.queryPage(params); |
|
49 |
|
|
50 |
return new CommonResult<PageData<StModelRunlogDTO>>().setData(page); |
|
51 |
} |
|
52 |
|
|
53 |
@GetMapping("{id}") |
|
54 |
@Operation(summary = "信息") |
|
55 |
@PreAuthorize("@ss.hasPermission('mcs:runlog:info')") |
|
56 |
public CommonResult<StModelRunlogDTO> get(@PathVariable("id") Long id){ |
|
57 |
StModelRunlogDTO data = runlogService.get(id); |
|
58 |
|
|
59 |
return new CommonResult<StModelRunlogDTO>().setData(data); |
|
60 |
} |
|
61 |
|
|
62 |
@PostMapping |
|
63 |
@Operation(summary = "保存") |
|
64 |
@LogOperation("保存") |
|
65 |
@PreAuthorize("@ss.hasPermission('mcs:runlog:save')") |
|
66 |
public CommonResult save(@RequestBody StModelRunlogDTO dto){ |
|
67 |
//效验数据 |
|
68 |
ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
|
69 |
|
|
70 |
runlogService.save(dto); |
|
71 |
|
|
72 |
return new CommonResult(); |
|
73 |
} |
|
74 |
|
|
75 |
@PutMapping |
|
76 |
@Operation(summary = "修改") |
|
77 |
@LogOperation("修改") |
|
78 |
@PreAuthorize("@ss.hasPermission('mcs:runlog:update')") |
|
79 |
public CommonResult update(@RequestBody StModelRunlogDTO dto){ |
|
80 |
//效验数据 |
|
81 |
ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class); |
|
82 |
|
|
83 |
runlogService.update(dto); |
|
84 |
|
|
85 |
return new CommonResult(); |
|
86 |
} |
|
87 |
|
|
88 |
@DeleteMapping |
|
89 |
@Operation(summary = "删除") |
|
90 |
@LogOperation("删除") |
|
91 |
@PreAuthorize("@ss.hasPermission('mcs:runlog:delete')") |
|
92 |
public CommonResult delete(@RequestBody Long[] ids){ |
|
93 |
runlogService.delete(ids); |
|
94 |
return new CommonResult(); |
|
95 |
} |
|
96 |
} |