- 创建应收货物计划实体类 WmsReceivePlan - 定义应收货物计划服务接口 IWmsReceivePlanService - 实现应收货物计划服务业务逻辑 WmsReceivePlanServiceImpl - 创建应收货物计划控制器 WmsReceivePlanController - 设计应收货物计划数据传输对象 WmsReceivePlanBo 和视图对象 WmsReceivePlanVo - 配置应收货物计划数据访问映射 WmsReceivePlanMapper - 添加应收货物计划数据库映射文件 - 实现应收货物计划的增删改查功能 - 集成分页查询和导出功能
100 lines
3.2 KiB
Java
100 lines
3.2 KiB
Java
package com.klp.controller;
|
|
|
|
import java.util.List;
|
|
import java.util.Arrays;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.constraints.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import com.klp.common.annotation.RepeatSubmit;
|
|
import com.klp.common.annotation.Log;
|
|
import com.klp.common.core.controller.BaseController;
|
|
import com.klp.common.core.domain.PageQuery;
|
|
import com.klp.common.core.domain.R;
|
|
import com.klp.common.core.validate.AddGroup;
|
|
import com.klp.common.core.validate.EditGroup;
|
|
import com.klp.common.enums.BusinessType;
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
|
import com.klp.domain.vo.WmsReceivePlanVo;
|
|
import com.klp.domain.bo.WmsReceivePlanBo;
|
|
import com.klp.service.IWmsReceivePlanService;
|
|
import com.klp.common.core.page.TableDataInfo;
|
|
|
|
/**
|
|
* 应收货物计划
|
|
*
|
|
* @author klp
|
|
* @date 2026-05-10
|
|
*/
|
|
@Validated
|
|
@RequiredArgsConstructor
|
|
@RestController
|
|
@RequestMapping("/wms/receivePlan")
|
|
public class WmsReceivePlanController extends BaseController {
|
|
|
|
private final IWmsReceivePlanService iWmsReceivePlanService;
|
|
|
|
/**
|
|
* 查询应收货物计划列表
|
|
*/
|
|
@GetMapping("/list")
|
|
public TableDataInfo<WmsReceivePlanVo> list(WmsReceivePlanBo bo, PageQuery pageQuery) {
|
|
return iWmsReceivePlanService.queryPageList(bo, pageQuery);
|
|
}
|
|
|
|
/**
|
|
* 导出应收货物计划列表
|
|
*/
|
|
@Log(title = "应收货物计划", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(WmsReceivePlanBo bo, HttpServletResponse response) {
|
|
List<WmsReceivePlanVo> list = iWmsReceivePlanService.queryList(bo);
|
|
ExcelUtil.exportExcel(list, "应收货物计划", WmsReceivePlanVo.class, response);
|
|
}
|
|
|
|
/**
|
|
* 获取应收货物计划详细信息
|
|
*
|
|
* @param receiveId 主键
|
|
*/
|
|
@GetMapping("/{receiveId}")
|
|
public R<WmsReceivePlanVo> getInfo(@NotNull(message = "主键不能为空")
|
|
@PathVariable Long receiveId) {
|
|
return R.ok(iWmsReceivePlanService.queryById(receiveId));
|
|
}
|
|
|
|
/**
|
|
* 新增应收货物计划
|
|
*/
|
|
@Log(title = "应收货物计划", businessType = BusinessType.INSERT)
|
|
@RepeatSubmit()
|
|
@PostMapping()
|
|
public R<Long> add(@Validated(AddGroup.class) @RequestBody WmsReceivePlanBo bo) {
|
|
return R.ok(iWmsReceivePlanService.insertByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 修改应收货物计划
|
|
*/
|
|
@Log(title = "应收货物计划", businessType = BusinessType.UPDATE)
|
|
@RepeatSubmit()
|
|
@PutMapping()
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsReceivePlanBo bo) {
|
|
return toAjax(iWmsReceivePlanService.updateByBo(bo));
|
|
}
|
|
|
|
/**
|
|
* 删除应收货物计划
|
|
*
|
|
* @param receiveIds 主键串
|
|
*/
|
|
@Log(title = "应收货物计划", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{receiveIds}")
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
@PathVariable Long[] receiveIds) {
|
|
return toAjax(iWmsReceivePlanService.deleteWithValidByIds(Arrays.asList(receiveIds), true));
|
|
}
|
|
}
|