zf
2023-09-12 ef56f943f7c056c2debe8980c8d346d00d2b163e
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
80
81
82
83
84
85
86
87
88
89
90
91
package com.gkhy.exam.noncoalmine.controller;
 
 
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gkhy.exam.noncoalmine.entity.WorkRegistration;
import com.gkhy.exam.noncoalmine.model.addForm.WorkRegistrationAddForm;
import com.gkhy.exam.noncoalmine.model.modForm.WorkRegistrationModForm;
import com.gkhy.exam.noncoalmine.model.query.WorkRegistrationQuery;
import com.gkhy.exam.noncoalmine.service.WorkRegistrationService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
 
/**
 * (WorkRegistration)表控制层
 *
 * @author makejava
 * @since 2023-09-11 16:59:58
 */
@RestController
@RequestMapping("work/registration")
public class WorkRegistrationController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private WorkRegistrationService workRegistrationService;
 
    /**
     * 分页查询所有数据
     *
     * @param query 查询实体
     * @return 所有数据
     */
    @GetMapping("/list/page")
    public TableDataInfo listByPage(WorkRegistrationQuery query) {
        startPage();
        return getDataTable(this.workRegistrationService.listByPage(query));
    }
 
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("get/{id}")
    public AjaxResult selectOne(@PathVariable Long id) {
        return success(this.workRegistrationService.getById(id));
    }
 
    /**
     * 新增数据
     *
     * @param addForm 实体对象
     * @return 新增结果
     */
    @PostMapping("add")
    public AjaxResult add(@Validated @RequestBody WorkRegistrationAddForm addForm) {
        return toAjax(this.workRegistrationService.add(addForm));
    }
 
    /**
     * 修改数据
     * @param modForm
     * @return
     */
    @PostMapping("mod")
    public AjaxResult mod(@Validated @RequestBody WorkRegistrationModForm modForm) {
        return toAjax(this.workRegistrationService.mod(modForm));
    }
 
    /**
     * 删除数据
     *
     * @param workIds 主键结合
     * @return 删除结果
     */
    @DeleteMapping("del/batch/{workIds}")
    public AjaxResult delete(@PathVariable List<Long> workIds) {
        return success(this.workRegistrationService.removeByIds(workIds));
    }
}