更新代码

This commit is contained in:
xiao-fajia 2024-09-14 14:38:11 +08:00
parent 967e66a7da
commit 3013afb9c7
3 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.common;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
/**
* 维修异常定义类
* @author 小李
* @date 11:43 2024/9/14
**/
public interface RepairErrorCodeConstants {
ErrorCode GOODS_IS_EMPTY = new ErrorCode(500, "商品为空");
}

View File

@ -1,12 +1,24 @@
package cn.iocoder.yudao.module.stockOperate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 针对表dl_repair_so(采购单领料单)的数据库操作Service实现
*
@ -17,15 +29,26 @@ import org.springframework.stereotype.Service;
public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepairSo>
implements DlRepairSoService {
@Resource
private DlRepairSoiService repairSoiService;
/**
* 采购单/领料单 新增
* @author 小李
* @date 10:49 2024/9/14
* @param repairSoRespVO 采购单对象
**/
@DSTransactional
@Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO){
return;
// 新增主表
baseMapper.insertOrUpdate(repairSoRespVO);
// 新增子表
if (CollectionUtil.isEmpty(repairSoRespVO.getGoodsList())){
throw exception(RepairErrorCodeConstants.GOODS_IS_EMPTY);
}
repairSoRespVO.getGoodsList().forEach(item -> item.setSoId(repairSoRespVO.getId()));
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
}
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.stockOperate.vo;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
@ -15,5 +17,5 @@ import java.util.List;
public class DlRepairSoRespVO extends DlRepairSo {
// 商品List
private List<T> partList;
private List<DlRepairSoi> goodsList;
}