商品模块代码提交
This commit is contained in:
@@ -79,12 +79,12 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
|||||||
ShopProdSpec entity = BeanUtil.copyProperties(dto, ShopProdSpec.class);
|
ShopProdSpec entity = BeanUtil.copyProperties(dto, ShopProdSpec.class);
|
||||||
if (GlobalConstant.TREE_ROOT.equals(entity.getPid())) {
|
if (GlobalConstant.TREE_ROOT.equals(entity.getPid())) {
|
||||||
entity.setFullName(entity.getName());
|
entity.setFullName(entity.getName());
|
||||||
entity.setPids(GlobalConstant.TREE_ROOT.toString());
|
entity.setPids(GlobalConstant.TREE_ROOT + ",");
|
||||||
} else {
|
} else {
|
||||||
ShopProdSpec parent = super.getById(entity.getPid());
|
ShopProdSpec parent = super.getById(entity.getPid());
|
||||||
entity.setFullName(parent.getFullName() + " - " + entity.getName());
|
entity.setFullName(parent.getFullName() + " - " + entity.getName());
|
||||||
String pids = parent.getPids();
|
String pids = parent.getPids();
|
||||||
entity.setPids(pids + "," + entity.getPid());
|
entity.setPids(pids + entity.getPid() + ",");
|
||||||
}
|
}
|
||||||
entity.setStatus(StatusEnum.ENABLED.value());
|
entity.setStatus(StatusEnum.ENABLED.value());
|
||||||
entity.setShopId(shopId);
|
entity.setShopId(shopId);
|
||||||
@@ -112,16 +112,17 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
|||||||
ShopProdSpec entity = BeanUtil.copyProperties(dto, ShopProdSpec.class);
|
ShopProdSpec entity = BeanUtil.copyProperties(dto, ShopProdSpec.class);
|
||||||
if (GlobalConstant.TREE_ROOT.equals(entity.getPid())) {
|
if (GlobalConstant.TREE_ROOT.equals(entity.getPid())) {
|
||||||
entity.setFullName(entity.getName());
|
entity.setFullName(entity.getName());
|
||||||
entity.setPids(GlobalConstant.TREE_ROOT.toString());
|
entity.setPids(GlobalConstant.TREE_ROOT + ",");
|
||||||
} else {
|
} else {
|
||||||
ShopProdSpec parent = super.getById(entity.getPid());
|
ShopProdSpec parent = super.getById(entity.getPid());
|
||||||
entity.setFullName(parent.getFullName() + " - " + entity.getName());
|
entity.setFullName(parent.getFullName() + " - " + entity.getName());
|
||||||
String pids = parent.getPids();
|
String pids = parent.getPids();
|
||||||
entity.setPids(pids + "," + entity.getPid());
|
entity.setPids(pids + entity.getPid() + ",");
|
||||||
}
|
}
|
||||||
String oldName = old.getName();
|
String oldName = old.getName();
|
||||||
UpdateChain.of(ShopProdSpec.class)
|
UpdateChain.of(ShopProdSpec.class)
|
||||||
.setRaw(ShopProdSpec::getFullName, StrUtil.format("replace(full_name, '{}', '{}')", oldName, entity.getName()))
|
.setRaw(ShopProdSpec::getFullName, StrUtil.format("replace(full_name, '{}', '{}')", oldName, entity.getName()))
|
||||||
|
.like(ShopProdSpec::getPids, "," + entity.getId() + ",")
|
||||||
.eq(ShopProdSpec::getShopId, entity.getShopId()).update();
|
.eq(ShopProdSpec::getShopId, entity.getShopId()).update();
|
||||||
return super.updateById(entity);
|
return super.updateById(entity);
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
|||||||
Long shopId = StpKit.USER.getLoginIdAsLong();
|
Long shopId = StpKit.USER.getLoginIdAsLong();
|
||||||
return super.remove(query()
|
return super.remove(query()
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id))))
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ","))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +142,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
|||||||
return UpdateChain.of(ShopProdSpec.class)
|
return UpdateChain.of(ShopProdSpec.class)
|
||||||
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.DISABLE.value())
|
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.DISABLE.value())
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id)))).update();
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,7 +151,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
|
|||||||
return UpdateChain.of(ShopProdSpec.class)
|
return UpdateChain.of(ShopProdSpec.class)
|
||||||
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.ENABLED.value())
|
.set(SHOP_PROD_SPEC.STATUS, StatusEnum.ENABLED.value())
|
||||||
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
.where(SHOP_PROD_SPEC.SHOP_ID.eq(shopId)
|
||||||
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id)))).update();
|
.and(SHOP_PROD_SPEC.ID.eq(id).or(SHOP_PROD_SPEC.PIDS.like("," + id + ",")))).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user