lius
2023-06-08 534aec7a687ceca8120ba798ad20d80d7058ffe6
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package org.jeecg.modules.mdc.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.mdc.entity.MdcShift;
import org.jeecg.modules.mdc.service.IMdcShiftService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
 
/**
 * @Description: 班制表(主表)
 * @Author: Sake
 * @Date: 2023-04-03 14:40
 */
@Slf4j
@Api(tags = "班制表(主表)")
@RestController
@RequestMapping("/mdc/mdcMdcShift")
public class MdcShiftController extends JeecgController<MdcShift, IMdcShiftService> {
 
    @Resource
    private IMdcShiftService mdcShiftService;
 
    /**
     * 班制表(主表)-分页查询
     * @param mdcShift
     * @param pageNo
     * @param pageSize
     * @return
     */
    @AutoLog("班制表(主表)-分页查询")
    @ApiOperation(value = "班制表(主表)-分页查询", notes = "班制表(主表)-分页查询")
    @GetMapping("/queryPageList")
    public Result<?> queryPageList(MdcShift mdcShift,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
        Page page = new Page(pageNo, pageSize);
        IPage<MdcShift> mdcShiftIPage = mdcShiftService.queryPageList(page, mdcShift);
        return Result.OK(mdcShiftIPage);
    }
 
    /**
     * 班制表(主表)-新增(班制名重复校验/状态默认为启用)
     * @param mdcShift
     * @return
     */
    @AutoLog("班制表(主表)-新增")
    @ApiOperation(value = "班制表(主表)-新增(班制名重复校验/状态默认为启用)", notes = "班制表(主表)-新增(班制名重复校验/状态默认为启用)")
    @PostMapping("/addShift")
    public Result<?> addShift(@RequestBody MdcShift mdcShift){
        Boolean flag = mdcShiftService.addShift(mdcShift);
        return flag ? Result.OK("新增成功") : Result.error("班制名重复");
    }
 
    /**
     * 班制表(主表)-修改
     * @param mdcShift
     * @return
     */
    @AutoLog("班制表(主表)-修改")
    @ApiOperation(value = "班制表(主表)-修改", notes = "班制表(主表)-修改")
    @PutMapping("/editShift")
    public Result<?> editShift(@RequestBody MdcShift mdcShift){
        Boolean flag = mdcShiftService.editShift(mdcShift);
        return flag ? Result.OK("修改成功") : Result.error("数据库无该数据");
    }
 
    /**
     * 根据id修改
     * @param
     * @return
     */
    @AutoLog("班制表(主表)-根据id修改状态")
    @ApiOperation(value = "班制表(主表)-根据id修改状态", notes = "班制表(主表)-根据id修改状态")
    @PutMapping("/changeStatus")
    public Result<?> changeStatus(@RequestBody JSONObject jsonObject){
        Boolean flag = mdcShiftService.changeStatus(jsonObject);
        return flag ? Result.OK("修改成功") : Result.error("数据库无该数据");
    }
 
    /**
     * 班制表(主表)-根据id删除
     * @param id
     * @return
     */
    @AutoLog("班制表(主表)-根据id删除")
    @ApiOperation(value = "班制表(主表)-根据id删除", notes = "班制表(主表)-根据id删除")
    @DeleteMapping("/deleteShift")
    public Result<?> deleteShift(@RequestParam(name = "id", required = true) String id){
        return mdcShiftService.deleteShift(id);
    }
 
    /**
     * 班制表(主表)-加载班制下拉选项
     */
    @AutoLog("班制表(主表)-加载班制下拉选项")
    @ApiOperation(value = "班制表(主表)-加载班制下拉选项", notes = "班制表(主表)-加载班制下拉选项")
    @GetMapping("/deleteShift")
    public Result<List<Map<String, String>>> initShiftList() {
        List<Map<String, String>> result = mdcShiftService.initShiftList();
        return Result.OK(result);
    }
}