|
@@ -0,0 +1,47 @@
|
|
|
+package com.zhentao.common.course.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.zhentao.common.course.domain.Product;
|
|
|
+import com.zhentao.common.course.domain.ProductCategory;
|
|
|
+import com.zhentao.common.course.domain.ProductSku;
|
|
|
+import com.zhentao.common.course.dto.ProductDto;
|
|
|
+import com.zhentao.common.course.service.ProductService;
|
|
|
+import com.zhentao.common.course.mapper.ProductMapper;
|
|
|
+import com.zhentao.util.ResultVo;
|
|
|
+import com.zhentao.util.SnowflakeIdGenerator;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+/**
|
|
|
+* @author 86159
|
|
|
+* @description 针对表【product(商品基本信息表)】的数据库操作Service实现
|
|
|
+* @createDate 2025-05-08 19:32:50
|
|
|
+*/
|
|
|
+@Service
|
|
|
+public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
|
|
|
+ implements ProductService{
|
|
|
+ @Autowired
|
|
|
+ private ProductMapper productMapper;
|
|
|
+ @Override
|
|
|
+ public ResultVo add(ProductDto productDto) {
|
|
|
+ Product product = new Product();
|
|
|
+ ProductCategory productCategory=new ProductCategory();
|
|
|
+ ProductSku productSku=new ProductSku();
|
|
|
+ BeanUtils.copyProperties(productDto , product);
|
|
|
+ BeanUtils.copyProperties(productDto , productCategory);
|
|
|
+ BeanUtils.copyProperties(productDto, productSku);
|
|
|
+ product.setId(SnowflakeIdGenerator.getSnowId());
|
|
|
+
|
|
|
+
|
|
|
+ productCategory.setId(SnowflakeIdGenerator.getSnowId());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|