|
|
@@ -2,6 +2,7 @@ package com.dk.mdm.service.mst;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
+import com.dk.common.infrastructure.constant.Constant;
|
|
|
import com.dk.common.model.pojo.PageList;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
@@ -18,6 +19,7 @@ import com.dk.mdm.model.query.mst.SupplierQuery;
|
|
|
import com.dk.mdm.model.vo.mst.OrgVO;
|
|
|
import com.dk.mdm.model.vo.mst.StaffVO;
|
|
|
import com.dk.mdm.model.vo.mst.SupplierVo;
|
|
|
+import com.dk.mdm.service.common.CommonService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -27,6 +29,7 @@ import java.sql.CallableStatement;
|
|
|
import java.sql.Connection;
|
|
|
import java.sql.DriverManager;
|
|
|
import java.sql.SQLException;
|
|
|
+import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
@Service
|
|
|
@@ -51,7 +54,8 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
|
|
|
@Autowired
|
|
|
private SupplierConvert supplierConvert;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
/**
|
|
|
* @desc : 条件查询
|
|
|
* @author : 王英杰
|
|
|
@@ -81,18 +85,14 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
|
|
|
|
try {
|
|
|
+ Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.STAFF.getName(), true);
|
|
|
|
|
|
- // 获取第一个插入操作生成的id
|
|
|
- String supID = supplierMapper.selectUuid(); // 先生成id
|
|
|
- supplierVo.setSupId(supID);
|
|
|
- String supCode = supplierMapper.selectSupCode(supplierVo); //拿着生成的id 传过来的cpid 去生成code
|
|
|
- supplierVo.setSupCode(supCode); //插入供应商品牌的实体
|
|
|
- supplier.setSupCode(supCode); //插入供应商表的实体
|
|
|
- super.insert(supplier);// 先插入自己的供应商表
|
|
|
- if (supplierVo.getBrandId() != null) { //如果有 商品品牌
|
|
|
- // 设置supplierVo的supplierId
|
|
|
+ supplier.setSupId(codeMap.get("outId").toString());
|
|
|
+ supplier.setSupCode(codeMap.get("outNote").toString()); //插入供应商表的实体
|
|
|
|
|
|
- supplierMapper.insertSupplierBrand(supplierVo); // 向供应商品牌表插入数据
|
|
|
+ super.insert(supplier);// 先插入自己的供应商表
|
|
|
+ if (supplier.getBrandId() != null) { //如果有 商品品牌
|
|
|
+ supplierMapper.insertSupplierBrand(supplier); // 向供应商品牌表插入数据
|
|
|
}
|
|
|
return ResponseResultUtil.success();
|
|
|
} catch (Exception e) {
|
|
|
@@ -115,10 +115,10 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
|
try {
|
|
|
super.updateByUuid(supplier);// 先更新的供应商表
|
|
|
- supplierMapper.batchDelete(supplierVo);//批量删除供应商对应的供应商品牌
|
|
|
+ supplierMapper.batchDelete(supplier);//批量删除供应商对应的供应商品牌
|
|
|
if (supplierVo.getBrandId() != null) { //如果有 商品品牌
|
|
|
// 设置supplierVo的supplierId
|
|
|
- supplierMapper.insertSupplierBrand(supplierVo); // 向供应商品牌表插入数据
|
|
|
+ supplierMapper.insertSupplierBrand(supplier); // 向供应商品牌表插入数据
|
|
|
}
|
|
|
return ResponseResultUtil.success();
|
|
|
} catch (Exception e) {
|