| | |
| | | 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 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.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <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 MwBoxDTO dtoList) { |
| | | boxService.editBatch(dtoList); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param idList |
| | | * @return |
| | | */ |
| | | @ApiOperation("批量删除") |
| | | @PostMapping("/delBatch") |
| | | @ApiImplicitParam(name = "idStr", value = "转运箱id字符串,多个用逗号分隔", required = true) |
| | | public R<?> delBatch(@RequestParam @NotEmpty(message = "转运箱id字符串不能为空") String idStr) { |
| | | List<Long> idList = Arrays.stream(idStr.split(",")).map(Long::valueOf).collect(Collectors.toList()); |
| | | boxService.removeByIds(idList); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |