hyingbo
7 天以前 cc0e9036de6e922e8fe254fef01d8de9996024b7
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
116
117
118
119
120
121
122
123
124
125
126
127
128
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.MdcShiftSub;
import org.jeecg.modules.mdc.service.IMdcShiftSubService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
/**
 * @Description: 班次表(次表)
 * @Author: Sake
 * @Date: 2023-04-04 09:15
 */
@Slf4j
@Api(tags = "班次表(次表)")
@RestController
@RequestMapping("/mdc/mdcShiftSub")
public class MdcShiftSubController extends JeecgController<MdcShiftSub, IMdcShiftSubService> {
 
    @Resource
    private IMdcShiftSubService mdcShiftSubService;
 
    /**
     * 班次表(次表)-分页查询
     *
     * @param shiftId
     * @param pageNo
     * @param pageSize
     * @return
     */
    @AutoLog(value = "班次表(次表)-分页查询")
    @ApiOperation(value = "班次表(次表)-分页查询", notes = "班次表(次表)-分页查询")
    @GetMapping("/queryPageList")
    public Result<?> queryPageList(@RequestParam String shiftId,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Page page = new Page<>(pageNo, pageSize);
        IPage<MdcShiftSub> mdcShiftSubIPage = mdcShiftSubService.queryPageList(shiftId, page);
        return Result.OK(mdcShiftSubIPage);
    }
 
    /**
     * 班次表(次表)-新增
     *
     * @param mdcShiftSub
     * @return
     */
    @AutoLog(value = "班次表(次表)-新增")
    @ApiOperation(value = "班次表(次表)-新增", notes = "班次表(次表)-新增")
    @PostMapping("/addShiftSub")
    public Result<?> addShiftSub(@RequestBody MdcShiftSub mdcShiftSub) {
        //处理是否存在空值
        if (StringUtils.isNotEmpty(mdcShiftSub.getSleepStartDate()) || StringUtils.isNotEmpty(mdcShiftSub.getSleepEndDate())) {
            if (StringUtils.isEmpty(mdcShiftSub.getSleepEndDate()) || StringUtils.isEmpty(mdcShiftSub.getSleepStartDate())) {
                return Result.error("新增失败,休息时间选择不对");
            }
        }
        MdcShiftSub result = mdcShiftSubService.addMdcShiftSub(mdcShiftSub);
        return Result.OK(result);
    }
 
    /**
     * 班次表(次表)-修改
     *
     * @param mdcShiftSub
     * @return
     */
    @AutoLog(value = "班次表(次表)-修改")
    @ApiOperation(value = "班次表(次表)-修改", notes = "班次表(次表)-修改")
    @PutMapping("/editMdcShiftSub")
    public Result<?> editShiftSub(@RequestBody MdcShiftSub mdcShiftSub) {
        Boolean flag = mdcShiftSubService.editMdcShiftSub(mdcShiftSub);
        return flag ? Result.OK("修改成功") : Result.error("修改失败");
    }
 
    /**
     * 班次表(次表)-根据id修改子表状态
     *
     * @param jsonObject
     * @return
     */
    @AutoLog(value = "班次表(次表)-根据id修改子表状态")
    @ApiOperation(value = "班次表(次表)-根据id修改子表状态", notes = "根据id修改子表状态")
    @PutMapping("/updateSubStatusById")
    public Result<?> updateSubStatusById(@RequestBody JSONObject jsonObject) {
        Boolean flag = mdcShiftSubService.updateSubStatusById(jsonObject);
        return flag ? Result.OK("修改成功") : Result.error("修改失败");
    }
 
    /**
     * 班次表(次表)-根据id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "班次表(次表)-根据id删除")
    @ApiOperation(value = "班次表(次表)-根据id删除", notes = "班次表(次表)-根据id删除")
    @DeleteMapping("/deleteMdcShiftSub")
    public Result<?> deleteMdcShiftSub(@RequestParam String id) {
        return mdcShiftSubService.deleteMdcShiftSub(id);
    }
 
    /**
     * 班次表(次表)-根据id删除
     *
     * @param shiftId
     * @return
     */
    @AutoLog(value = "班次表(次表)-根据班制id获取班次下拉列表")
    @ApiOperation(value = "班次表(次表)-根据班制id获取班次下拉列表", notes = "班次表(次表)-根据班制id获取班次下拉列表")
    @GetMapping("/initShiftSubList")
    public Result<?> initShiftSubList(@RequestParam(name = "shiftId", required = true) String shiftId) {
        List<Map<String, String>> result = mdcShiftSubService.initShiftSubList(shiftId);
        return Result.OK(result);
    }
}