Files
klp-oa/klp-wms/src/main/java/com/klp/controller/WmsDeliveryWaybillController.java

100 lines
3.2 KiB
Java
Raw Normal View History

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.WmsDeliveryWaybillVo;
import com.klp.domain.bo.WmsDeliveryWaybillBo;
import com.klp.service.IWmsDeliveryWaybillService;
import com.klp.common.core.page.TableDataInfo;
/**
* 发货单主
*
* @author klp
* @date 2025-11-25
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/wms/deliveryWaybill")
public class WmsDeliveryWaybillController extends BaseController {
private final IWmsDeliveryWaybillService iWmsDeliveryWaybillService;
/**
* 查询发货单主列表
*/
@GetMapping("/list")
public TableDataInfo<WmsDeliveryWaybillVo> list(WmsDeliveryWaybillBo bo, PageQuery pageQuery) {
return iWmsDeliveryWaybillService.queryPageList(bo, pageQuery);
}
/**
* 导出发货单主列表
*/
@Log(title = "发货单主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(WmsDeliveryWaybillBo bo, HttpServletResponse response) {
List<WmsDeliveryWaybillVo> list = iWmsDeliveryWaybillService.queryList(bo);
ExcelUtil.exportExcel(list, "发货单主", WmsDeliveryWaybillVo.class, response);
}
/**
* 获取发货单主详细信息
*
* @param waybillId 主键
*/
@GetMapping("/{waybillId}")
public R<WmsDeliveryWaybillVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long waybillId) {
return R.ok(iWmsDeliveryWaybillService.queryById(waybillId));
}
/**
* 新增发货单主
*/
@Log(title = "发货单主", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsDeliveryWaybillBo bo) {
return toAjax(iWmsDeliveryWaybillService.insertByBo(bo));
}
/**
* 修改发货单主
*/
@Log(title = "发货单主", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsDeliveryWaybillBo bo) {
return toAjax(iWmsDeliveryWaybillService.updateByBo(bo));
}
/**
* 删除发货单主
*
* @param waybillIds 主键串
*/
@Log(title = "发货单主", businessType = BusinessType.DELETE)
@DeleteMapping("/{waybillIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] waybillIds) {
return toAjax(iWmsDeliveryWaybillService.deleteWithValidByIds(Arrays.asList(waybillIds), true));
}
}