luodangjia
2024-12-24 bd6d42818da5b2551eba1884744f28a42720987d
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
package com.sinata.web.controller.backend;
 
import com.sinata.common.core.domain.R;
import com.sinata.common.entity.PageDTO;
import com.sinata.system.domain.dto.MwBoxDTO;
import com.sinata.system.domain.query.MwBoxPageQuery;
import com.sinata.system.domain.vo.BoxStatisticsVO;
import com.sinata.system.domain.vo.MwBoxVO;
import com.sinata.system.service.MwBoxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
 
/**
 * <p>
 * 转运箱 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-12-02
 */
@Api(tags = {"转运箱管理相关接口"})
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/backend/mwBox")
public class MwBoxController {
    private final MwBoxService boxService;
 
    /**
     * 转运箱数据统计
     *
     * @return
     */
    @GetMapping("/statistics")
    @ApiOperation("转运箱数据统计")
    public R<BoxStatisticsVO> getBoxStatistics() {
        return R.ok(boxService.getBoxStatistics());
    }
 
    /**
     * 转运箱分页列表
     *
     * @param query
     * @return
     */
    @ApiOperation("转运箱分页列表")
    @PostMapping("/page")
    public R<PageDTO<MwBoxVO>> pageList(@Valid @RequestBody MwBoxPageQuery query) {
        return R.ok(boxService.pageList(query));
    }
 
    /**
     * 新增转运箱
     *
     * @param boxNumberStart
     * @param boxNumberEnd
     * @return
     */
    @ApiOperation("新增转运箱")
    @PostMapping("/add")
    @ApiImplicitParams({@ApiImplicitParam(name = "boxNumberStart", value = "转运箱编号开始", required = true),
            @ApiImplicitParam(name = "boxNumberEnd", value = "转运箱编号结束", required = true)})
    public R<?> add(@RequestParam String boxNumberStart, @RequestParam String boxNumberEnd) {
        boxService.add(boxNumberStart, boxNumberEnd);
        return R.ok();
    }
 
    /**
     * 编辑转运箱状态
     *
     * @param dtoList
     * @return
     */
    @ApiOperation("批量修改转运箱状态")
    @PostMapping("/editBatch")
    public R<?> editBatch(@Valid @RequestBody List<MwBoxDTO> dtoList) {
        boxService.editBatch(dtoList);
        return R.ok();
    }
 
    /**
     * 批量删除
     *
     * @param idList
     * @return
     */
    @ApiOperation("批量删除")
    @PostMapping("/delBatch")
    public R<?> delBatch(@ApiParam(name = "idList", value = "转运箱id列表", required = true, allowMultiple = true) @NotEmpty(message = "转运箱列表不能为空") @RequestBody List<Long> idList) {
        boxService.removeByIds(idList);
        return R.ok();
    }
 
}