在线商城

This commit is contained in:
zjf committed 2025-06-20 18:19:57 +08:00
1 parent f6411676c3
commit 3d02b77da8
2 files changed
+8 -3

No files matched your search

@@ -174,5 +174,10 @@ public class ShopSpuEntity extends Model<ShopSpuEntity> {
@ExcelIgnore
@TableField(exist = false)
@EntityMapping(thisField = "id", joinField = "spuId")
private List<ShopSkuEntity> shopSkuList;
private List<ShopSkuEntity> skuList;
@TableField(exist = false)
@Schema(description="关联的商户id")
private List<Long> merchantIds;
}
@@ -30,7 +30,7 @@ public class ShopSpuServiceImpl extends ServiceImpl<ShopSpuMapper, ShopSpuEntity
@Transactional(rollbackFor = Exception.class)
public Boolean saveDeep(ShopSpuEntity shopSpu) {
baseMapper.insert(shopSpu);
for (ShopSkuEntity shopSku : shopSpu.getShopSkuList()) {
for (ShopSkuEntity shopSku : shopSpu.getSkuList()) {
shopSku.setSpuId(shopSpu.getId());
shopSkuMapper.insert( shopSku);
}
@@ -42,7 +42,7 @@ public class ShopSpuServiceImpl extends ServiceImpl<ShopSpuMapper, ShopSpuEntity
@Transactional(rollbackFor = Exception.class)
public Boolean updateDeep(ShopSpuEntity shopSpu) {
baseMapper.updateById(shopSpu);
for (ShopSkuEntity shopSku : shopSpu.getShopSkuList()) {
for (ShopSkuEntity shopSku : shopSpu.getSkuList()) {
if (Objects.isNull(shopSku.getId())) {
shopSku.setSpuId(shopSpu.getId());
shopSkuMapper.insert(shopSku);