From f4e70436bb93ab6cc7e2b8c27afa9a5978371855 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 13 一月 2026 16:31:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/jtwy' into jtwy
---
src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
index dc6d3e9..bc3840f 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
@@ -14,12 +14,15 @@
import com.ruoyi.basic.service.IProductModelService;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -45,12 +48,21 @@
if (productModelDto.getId() == null) {
ProductModel productModel = new ProductModel();
BeanUtils.copyProperties(productModelDto,productModel);
- return productModelMapper.insert(productModel);
+ productModelMapper.insert(productModel);
+
+ String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
+ String idStr = String.format("%06d", productModel.getId()); // 鍏綅琛�0
+ String newProductCode = "BM" + dateStr + idStr;
+ // 鏇存柊鏁版嵁搴撲腑鐨刾roductCode
+ productModel.setProductCode(newProductCode);
+ return productModelMapper.updateById(productModel);
} else {
return productModelMapper.updateById(productModelDto);
}
}
+
+
@Override
public int delProductModel(Long[] ids) {
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>()
--
Gitblit v1.9.3