feat(wms): 新增发货单及发货单明细模块
- 创建发货单服务接口IWmsShippingBillService,定义查询、新增、修改、删除、提交流程等方法 - 创建发货单明细服务接口IWmsShippingDetailsService,定义对应的增删查改接口 - 定义发货单实体类WmsShippingBill,包含各类发货相关字段及明细列表 - 定义发货单业务对象WmsShippingBillBo,支持校验和流程变量扩展 - 新增发货单控制器WmsShippingBillController,提供发货单的增删改查和流程提交接口 - 新增发货单MyBatis Mapper接口及XML实现,支持分页、自定义查询、批量操作和逻辑删除 - 完成发货单相关SQL映射文件,支持复杂联表查询获取合同SAP订单号信息 - 实现分页列表、导出Excel、权限校验、日志记录和防重复提交功能dev
parent
3ed1dd0829
commit
6ba97b3e3f
@ -0,0 +1,128 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.wms.domain.bo.WmsShippingBillBo;
|
||||
import org.dromara.wms.domain.vo.WmsShippingBillVo;
|
||||
import org.dromara.wms.service.IWmsShippingBillService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货单
|
||||
* 前端访问路由地址为:/wms/wmsShippingBill
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wmsShippingBill")
|
||||
public class WmsShippingBillController extends BaseController {
|
||||
|
||||
private final IWmsShippingBillService wmsShippingBillService;
|
||||
|
||||
/**
|
||||
* 查询发货单列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsShippingBillVo> list(WmsShippingBillBo bo, PageQuery pageQuery) {
|
||||
return wmsShippingBillService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出发货单列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:export")
|
||||
@Log(title = "发货单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsShippingBillBo bo, HttpServletResponse response) {
|
||||
List<WmsShippingBillVo> list = wmsShippingBillService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "发货单", WmsShippingBillVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发货单详细信息
|
||||
*
|
||||
* @param shippingBillId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:query")
|
||||
@GetMapping("/{shippingBillId}")
|
||||
public R<WmsShippingBillVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("shippingBillId") Long shippingBillId) {
|
||||
return R.ok(wmsShippingBillService.queryById(shippingBillId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发货单
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:add")
|
||||
@Log(title = "发货单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsShippingBillBo bo) {
|
||||
return toAjax(wmsShippingBillService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货单
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:edit")
|
||||
@Log(title = "发货单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsShippingBillBo bo) {
|
||||
return toAjax(wmsShippingBillService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发货单
|
||||
*
|
||||
* @param shippingBillIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:remove")
|
||||
@Log(title = "发货单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shippingBillIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("shippingBillIds") Long[] shippingBillIds) {
|
||||
return toAjax(wmsShippingBillService.deleteWithValidByIds(List.of(shippingBillIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询发货单列表
|
||||
*/
|
||||
@GetMapping("/getWmsShippingBillList")
|
||||
public R<List<WmsShippingBillVo>> getWmsShippingBillList(WmsShippingBillBo bo) {
|
||||
List<WmsShippingBillVo> list = wmsShippingBillService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交发货单并发起审批流程
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingBill:edit")
|
||||
@Log(title = "发货单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/shippingBillSubmitAndFlowStart")
|
||||
public R<WmsShippingBillVo> shippingBillSubmitAndFlowStart(@RequestBody WmsShippingBillBo bo) {
|
||||
return R.ok(wmsShippingBillService.shippingBillSubmitAndFlowStart(bo));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package org.dromara.wms.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.wms.domain.bo.WmsShippingDetailsBo;
|
||||
import org.dromara.wms.domain.vo.WmsShippingDetailsVo;
|
||||
import org.dromara.wms.service.IWmsShippingDetailsService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货单明细
|
||||
* 前端访问路由地址为:/wms/wmsShippingDetails
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wmsShippingDetails")
|
||||
public class WmsShippingDetailsController extends BaseController {
|
||||
|
||||
private final IWmsShippingDetailsService wmsShippingDetailsService;
|
||||
|
||||
/**
|
||||
* 查询发货单明细列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsShippingDetailsVo> list(WmsShippingDetailsBo bo, PageQuery pageQuery) {
|
||||
return wmsShippingDetailsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出发货单明细列表
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:export")
|
||||
@Log(title = "发货单明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsShippingDetailsBo bo, HttpServletResponse response) {
|
||||
List<WmsShippingDetailsVo> list = wmsShippingDetailsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "发货单明细", WmsShippingDetailsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发货单明细详细信息
|
||||
*
|
||||
* @param shippingDetailsId 主键
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:query")
|
||||
@GetMapping("/{shippingDetailsId}")
|
||||
public R<WmsShippingDetailsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("shippingDetailsId") Long shippingDetailsId) {
|
||||
return R.ok(wmsShippingDetailsService.queryById(shippingDetailsId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发货单明细
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:add")
|
||||
@Log(title = "发货单明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsShippingDetailsBo bo) {
|
||||
return toAjax(wmsShippingDetailsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货单明细
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:edit")
|
||||
@Log(title = "发货单明细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsShippingDetailsBo bo) {
|
||||
return toAjax(wmsShippingDetailsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发货单明细
|
||||
*
|
||||
* @param shippingDetailsIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("wms:wmsShippingDetails:remove")
|
||||
@Log(title = "发货单明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shippingDetailsIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("shippingDetailsIds") Long[] shippingDetailsIds) {
|
||||
return toAjax(wmsShippingDetailsService.deleteWithValidByIds(List.of(shippingDetailsIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询发货单明细列表
|
||||
*/
|
||||
@GetMapping("/getWmsShippingDetailsList")
|
||||
public R<List<WmsShippingDetailsVo>> getWmsShippingDetailsList(WmsShippingDetailsBo bo) {
|
||||
List<WmsShippingDetailsVo> list = wmsShippingDetailsService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.wms.domain.bo.WmsShippingBillBo;
|
||||
import org.dromara.wms.domain.vo.WmsShippingBillVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货单Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface IWmsShippingBillService {
|
||||
|
||||
/**
|
||||
* 查询发货单
|
||||
*
|
||||
* @param shippingBillId 主键
|
||||
* @return 发货单
|
||||
*/
|
||||
WmsShippingBillVo queryById(Long shippingBillId);
|
||||
|
||||
/**
|
||||
* 分页查询发货单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 发货单分页列表
|
||||
*/
|
||||
TableDataInfo<WmsShippingBillVo> queryPageList(WmsShippingBillBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的发货单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 发货单列表
|
||||
*/
|
||||
List<WmsShippingBillVo> queryList(WmsShippingBillBo bo);
|
||||
|
||||
/**
|
||||
* 新增发货单
|
||||
*
|
||||
* @param bo 发货单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsShippingBillBo bo);
|
||||
|
||||
/**
|
||||
* 修改发货单
|
||||
*
|
||||
* @param bo 发货单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsShippingBillBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除发货单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 提交发货单并发起流程
|
||||
*
|
||||
* @param bo 发货单
|
||||
* @return 发货单VO
|
||||
*/
|
||||
WmsShippingBillVo shippingBillSubmitAndFlowStart(WmsShippingBillBo bo);
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package org.dromara.wms.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.wms.domain.bo.WmsShippingDetailsBo;
|
||||
import org.dromara.wms.domain.vo.WmsShippingDetailsVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货单明细Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface IWmsShippingDetailsService {
|
||||
|
||||
/**
|
||||
* 查询发货单明细
|
||||
*
|
||||
* @param shippingDetailsId 主键
|
||||
* @return 发货单明细
|
||||
*/
|
||||
WmsShippingDetailsVo queryById(Long shippingDetailsId);
|
||||
|
||||
/**
|
||||
* 分页查询发货单明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 发货单明细分页列表
|
||||
*/
|
||||
TableDataInfo<WmsShippingDetailsVo> queryPageList(WmsShippingDetailsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的发货单明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 发货单明细列表
|
||||
*/
|
||||
List<WmsShippingDetailsVo> queryList(WmsShippingDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 新增发货单明细
|
||||
*
|
||||
* @param bo 发货单明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(WmsShippingDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 修改发货单明细
|
||||
*
|
||||
* @param bo 发货单明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(WmsShippingDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除发货单明细信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
package org.dromara.wms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.wms.domain.WmsShippingDetails;
|
||||
import org.dromara.wms.domain.bo.WmsShippingDetailsBo;
|
||||
import org.dromara.wms.domain.vo.WmsShippingDetailsVo;
|
||||
import org.dromara.wms.mapper.WmsShippingDetailsMapper;
|
||||
import org.dromara.wms.service.IWmsShippingDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发货单明细Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsShippingDetailsServiceImpl implements IWmsShippingDetailsService {
|
||||
|
||||
private final WmsShippingDetailsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询发货单明细
|
||||
*
|
||||
* @param shippingDetailsId 主键
|
||||
* @return 发货单明细
|
||||
*/
|
||||
@Override
|
||||
public WmsShippingDetailsVo queryById(Long shippingDetailsId){
|
||||
return baseMapper.selectVoById(shippingDetailsId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发货单明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 发货单明细分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsShippingDetailsVo> queryPageList(WmsShippingDetailsBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<WmsShippingDetails> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsShippingDetailsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的发货单明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 发货单明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsShippingDetailsVo> queryList(WmsShippingDetailsBo bo) {
|
||||
MPJLambdaWrapper<WmsShippingDetails> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<WmsShippingDetails> buildQueryWrapper(WmsShippingDetailsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<WmsShippingDetails> lqw = JoinWrappers.lambda(WmsShippingDetails.class)
|
||||
.selectAll(WmsShippingDetails.class)
|
||||
.eq(WmsShippingDetails::getDelFlag, "0")
|
||||
.eq(bo.getShippingBillId() != null, WmsShippingDetails::getShippingBillId, bo.getShippingBillId())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialSourceType()), WmsShippingDetails::getMaterialSourceType, bo.getMaterialSourceType())
|
||||
.eq(bo.getErpMaterialId() != null, WmsShippingDetails::getErpMaterialId, bo.getErpMaterialId())
|
||||
.eq(bo.getWmsMaterialId() != null, WmsShippingDetails::getWmsMaterialId, bo.getWmsMaterialId())
|
||||
.eq(StringUtils.isNotBlank(bo.getSourceDetailType()), WmsShippingDetails::getSourceDetailType, bo.getSourceDetailType())
|
||||
.eq(bo.getSourceDetailId() != null, WmsShippingDetails::getSourceDetailId, bo.getSourceDetailId())
|
||||
.eq(bo.getWarehouseId() != null, WmsShippingDetails::getWarehouseId, bo.getWarehouseId())
|
||||
.eq(bo.getMaterielId() != null, WmsShippingDetails::getMaterielId, bo.getMaterielId())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), WmsShippingDetails::getMaterialCode, bo.getMaterialCode())
|
||||
.like(StringUtils.isNotBlank(bo.getMaterialName()), WmsShippingDetails::getMaterialName, bo.getMaterialName())
|
||||
.eq(StringUtils.isNotBlank(bo.getMaterielSpecification()), WmsShippingDetails::getMaterielSpecification, bo.getMaterielSpecification())
|
||||
.eq(StringUtils.isNotBlank(bo.getBatchNumber()), WmsShippingDetails::getBatchNumber, bo.getBatchNumber())
|
||||
.eq(bo.getUnitPrice() != null, WmsShippingDetails::getUnitPrice, bo.getUnitPrice())
|
||||
.eq(bo.getShippingStockAmount() != null, WmsShippingDetails::getShippingStockAmount, bo.getShippingStockAmount())
|
||||
.eq(bo.getUnitId() != null, WmsShippingDetails::getUnitId, bo.getUnitId())
|
||||
.like(StringUtils.isNotBlank(bo.getUnitName()), WmsShippingDetails::getUnitName, bo.getUnitName())
|
||||
.eq(bo.getTotalPrice() != null, WmsShippingDetails::getTotalPrice, bo.getTotalPrice())
|
||||
;
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发货单明细
|
||||
*
|
||||
* @param bo 发货单明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsShippingDetailsBo bo) {
|
||||
WmsShippingDetails add = MapstructUtils.convert(bo, WmsShippingDetails.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setShippingDetailsId(add.getShippingDetailsId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货单明细
|
||||
*
|
||||
* @param bo 发货单明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsShippingDetailsBo bo) {
|
||||
WmsShippingDetails update = MapstructUtils.convert(bo, WmsShippingDetails.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsShippingDetails entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除发货单明细信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,262 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.wms.mapper.WmsShippingDetailsMapper">
|
||||
<resultMap type="org.dromara.wms.domain.vo.WmsShippingDetailsVo" id="WmsShippingDetailsResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomWmsShippingDetailsVoList" resultMap="WmsShippingDetailsResult">
|
||||
select t.shipping_details_id, t.tenant_id, t.shipping_bill_id, t.material_source_type, t.erp_material_id, t.wms_material_id, t.source_detail_type, t.source_detail_id, t.warehouse_id, t.materiel_id, t.material_code, t.material_name, t.materiel_specification, t.batch_number, t.unit_price, t.shipping_stock_amount, t.unit_id, t.unit_name, t.total_price, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time from wms_shipping_details t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询详情 -->
|
||||
<select id="selectCustomWmsShippingDetailsVoById" resultMap="WmsShippingDetailsResult">
|
||||
select t.shipping_details_id, t.tenant_id, t.shipping_bill_id, t.material_source_type, t.erp_material_id, t.wms_material_id, t.source_detail_type, t.source_detail_id, t.warehouse_id, t.materiel_id, t.material_code, t.material_name, t.materiel_specification, t.batch_number, t.unit_price, t.shipping_stock_amount, t.unit_id, t.unit_name, t.total_price, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from wms_shipping_details t
|
||||
where t.shipping_details_id = #{shippingDetailsId}
|
||||
</select>
|
||||
|
||||
<!-- 批量查询 - 根据ID列表 -->
|
||||
<select id="selectCustomWmsShippingDetailsVoByIds" resultMap="WmsShippingDetailsResult">
|
||||
select t.shipping_details_id, t.tenant_id, t.shipping_bill_id, t.material_source_type, t.erp_material_id, t.wms_material_id, t.source_detail_type, t.source_detail_id, t.warehouse_id, t.materiel_id, t.material_code, t.material_name, t.materiel_specification, t.batch_number, t.unit_price, t.shipping_stock_amount, t.unit_id, t.unit_name, t.total_price, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from wms_shipping_details t
|
||||
where t.shipping_details_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 统计查询 -->
|
||||
<select id="countCustomWmsShippingDetails" resultType="java.lang.Long">
|
||||
select count(1) from wms_shipping_details t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 分页查询(带自定义条件) -->
|
||||
<select id="selectCustomWmsShippingDetailsVoPage" resultMap="WmsShippingDetailsResult">
|
||||
select t.shipping_details_id, t.tenant_id, t.shipping_bill_id, t.material_source_type, t.erp_material_id, t.wms_material_id, t.source_detail_type, t.source_detail_id, t.warehouse_id, t.materiel_id, t.material_code, t.material_name, t.materiel_specification, t.batch_number, t.unit_price, t.shipping_stock_amount, t.unit_id, t.unit_name, t.total_price, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
||||
from wms_shipping_details t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsertWmsShippingDetails">
|
||||
insert into wms_shipping_details(
|
||||
tenant_id,
|
||||
|
||||
shipping_bill_id,
|
||||
|
||||
material_source_type,
|
||||
|
||||
erp_material_id,
|
||||
|
||||
wms_material_id,
|
||||
|
||||
source_detail_type,
|
||||
|
||||
source_detail_id,
|
||||
|
||||
warehouse_id,
|
||||
|
||||
materiel_id,
|
||||
|
||||
material_code,
|
||||
|
||||
material_name,
|
||||
|
||||
materiel_specification,
|
||||
|
||||
batch_number,
|
||||
|
||||
unit_price,
|
||||
|
||||
shipping_stock_amount,
|
||||
|
||||
unit_id,
|
||||
|
||||
unit_name,
|
||||
|
||||
total_price,
|
||||
|
||||
remark,
|
||||
|
||||
del_flag,
|
||||
|
||||
create_dept,
|
||||
|
||||
create_by,
|
||||
|
||||
create_time,
|
||||
|
||||
update_by,
|
||||
|
||||
update_time
|
||||
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.tenantId},
|
||||
|
||||
#{item.shippingBillId},
|
||||
|
||||
#{item.materialSourceType},
|
||||
|
||||
#{item.erpMaterialId},
|
||||
|
||||
#{item.wmsMaterialId},
|
||||
|
||||
#{item.sourceDetailType},
|
||||
|
||||
#{item.sourceDetailId},
|
||||
|
||||
#{item.warehouseId},
|
||||
|
||||
#{item.materielId},
|
||||
|
||||
#{item.materialCode},
|
||||
|
||||
#{item.materialName},
|
||||
|
||||
#{item.materielSpecification},
|
||||
|
||||
#{item.batchNumber},
|
||||
|
||||
#{item.unitPrice},
|
||||
|
||||
#{item.shippingStockAmount},
|
||||
|
||||
#{item.unitId},
|
||||
|
||||
#{item.unitName},
|
||||
|
||||
#{item.totalPrice},
|
||||
|
||||
#{item.remark},
|
||||
|
||||
#{item.delFlag},
|
||||
|
||||
#{item.createDept},
|
||||
|
||||
#{item.createBy},
|
||||
|
||||
#{item.createTime},
|
||||
|
||||
#{item.updateBy},
|
||||
|
||||
#{item.updateTime}
|
||||
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量更新 -->
|
||||
<update id="batchUpdateWmsShippingDetails">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
update wms_shipping_details t
|
||||
<set>
|
||||
<if test="item.tenantId != null and item.tenantId != ''">
|
||||
t.tenant_id = #{item.tenantId},
|
||||
</if>
|
||||
<if test="item.shippingBillId != null">
|
||||
t.shipping_bill_id = #{item.shippingBillId},
|
||||
</if>
|
||||
<if test="item.materialSourceType != null and item.materialSourceType != ''">
|
||||
t.material_source_type = #{item.materialSourceType},
|
||||
</if>
|
||||
<if test="item.erpMaterialId != null">
|
||||
t.erp_material_id = #{item.erpMaterialId},
|
||||
</if>
|
||||
<if test="item.wmsMaterialId != null">
|
||||
t.wms_material_id = #{item.wmsMaterialId},
|
||||
</if>
|
||||
<if test="item.sourceDetailType != null and item.sourceDetailType != ''">
|
||||
t.source_detail_type = #{item.sourceDetailType},
|
||||
</if>
|
||||
<if test="item.sourceDetailId != null">
|
||||
t.source_detail_id = #{item.sourceDetailId},
|
||||
</if>
|
||||
<if test="item.warehouseId != null">
|
||||
t.warehouse_id = #{item.warehouseId},
|
||||
</if>
|
||||
<if test="item.materielId != null">
|
||||
t.materiel_id = #{item.materielId},
|
||||
</if>
|
||||
<if test="item.materialCode != null and item.materialCode != ''">
|
||||
t.material_code = #{item.materialCode},
|
||||
</if>
|
||||
<if test="item.materialName != null and item.materialName != ''">
|
||||
t.material_name = #{item.materialName},
|
||||
</if>
|
||||
<if test="item.materielSpecification != null and item.materielSpecification != ''">
|
||||
t.materiel_specification = #{item.materielSpecification},
|
||||
</if>
|
||||
<if test="item.batchNumber != null and item.batchNumber != ''">
|
||||
t.batch_number = #{item.batchNumber},
|
||||
</if>
|
||||
<if test="item.unitPrice != null">
|
||||
t.unit_price = #{item.unitPrice},
|
||||
</if>
|
||||
<if test="item.shippingStockAmount != null">
|
||||
t.shipping_stock_amount = #{item.shippingStockAmount},
|
||||
</if>
|
||||
<if test="item.unitId != null">
|
||||
t.unit_id = #{item.unitId},
|
||||
</if>
|
||||
<if test="item.unitName != null and item.unitName != ''">
|
||||
t.unit_name = #{item.unitName},
|
||||
</if>
|
||||
<if test="item.totalPrice != null">
|
||||
t.total_price = #{item.totalPrice},
|
||||
</if>
|
||||
<if test="item.remark != null and item.remark != ''">
|
||||
t.remark = #{item.remark},
|
||||
</if>
|
||||
<if test="item.delFlag != null and item.delFlag != ''">
|
||||
t.del_flag = #{item.delFlag},
|
||||
</if>
|
||||
<if test="item.createDept != null">
|
||||
t.create_dept = #{item.createDept},
|
||||
</if>
|
||||
<if test="item.createBy != null">
|
||||
t.create_by = #{item.createBy},
|
||||
</if>
|
||||
<if test="item.createTime != null">
|
||||
t.create_time = #{item.createTime},
|
||||
</if>
|
||||
<if test="item.updateBy != null">
|
||||
t.update_by = #{item.updateBy},
|
||||
</if>
|
||||
<if test="item.updateTime != null">
|
||||
t.update_time = #{item.updateTime}
|
||||
</if>
|
||||
</set>
|
||||
where t.shipping_details_id = #{item.shippingDetailsId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 根据自定义条件删除 -->
|
||||
<delete id="deleteCustomWmsShippingDetails">
|
||||
delete from wms_shipping_details t
|
||||
${ew.getCustomSqlSegment}
|
||||
</delete>
|
||||
|
||||
<!-- 根据ID列表批量删除 -->
|
||||
<delete id="deleteCustomWmsShippingDetailsByIds">
|
||||
delete from wms_shipping_details t
|
||||
where t.shipping_details_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 检查是否存在 -->
|
||||
<select id="existsWmsShippingDetails" resultType="java.lang.Boolean">
|
||||
select count(1) > 0 from wms_shipping_details t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue