代客下单 单位回填

This commit is contained in:
wangw 2024-12-02 15:43:37 +08:00
parent c7633ec875
commit 87804eba1b
3 changed files with 33 additions and 17 deletions

View File

@ -72,6 +72,10 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "单位Id") @ApiModelProperty(value = "单位Id")
private Integer unitId; private Integer unitId;
@Transient
@TableField(exist = false)
private String unitName;
@Column(name = "`cover_img`") @Column(name = "`cover_img`")
@ApiModelProperty(value = "商品封面图") @ApiModelProperty(value = "商品封面图")
private String coverImg; private String coverImg;

View File

@ -790,12 +790,19 @@ public class TbProductServiceImpl implements TbProductService {
if (productId != null) { if (productId != null) {
queryWrapper.eq("id", productId); queryWrapper.eq("id", productId);
} }
Map<Integer, String> unitMap = new HashMap<>();
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper); com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper);
tbProductPage.getRecords().forEach(item -> { tbProductPage.getRecords().forEach(item -> {
if ("package".equals(item.getType())) { if ("package".equals(item.getType())) {
item.setProGroupVo(JSONUtil.parseJSONStrTList(item.getGroupSnap(), ProductGroupVo.class)); item.setProGroupVo(JSONUtil.parseJSONStrTList(item.getGroupSnap(), ProductGroupVo.class));
} }
if (item.getUnitId() != null) {
if (!unitMap.containsKey(item.getUnitId())) {
TbShopUnit tbShopUnit = tbShopUnitRepository.searchUnit(item.getUnitId());
unitMap.put(item.getId(), tbShopUnit.getName());
}
item.setUnitName(unitMap.get(item.getUnitId()));
}
TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null); TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null);
List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0) List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0)
.eq(TbProductSku::getIsPauseSale, 0) .eq(TbProductSku::getIsPauseSale, 0)

View File

@ -28,6 +28,7 @@ public class TbProductNewVo {
private String name; private String name;
//售价 //售价
private String lowPrice; private String lowPrice;
private String type;
//类型 单规格/多规格 //类型 单规格/多规格
private String typeEnum; private String typeEnum;
//库存 //库存
@ -53,26 +54,30 @@ public class TbProductNewVo {
private Integer sort; private Integer sort;
public void setTypeEnum(String typeEnum) { public void setTypeEnum(String typeEnum) {
switch (typeEnum) { switch (this.type) {
case "normal": case "normal":
this.typeEnum = "单规格"; this.typeEnum = "普通商品";
break; case "weigh":
case "sku":
this.typeEnum = "多规格";
break;
case "weight":
this.typeEnum = "称重商品"; this.typeEnum = "称重商品";
break; break;
case "currentPrice": case "coupon":
this.typeEnum = "时价商品"; this.typeEnum = "优惠券";
break; break;
case "group": case "package":
this.typeEnum = "套餐商品/团购卷"; this.typeEnum = "套餐商品";
break; break;
default: default:
this.typeEnum = typeEnum; this.typeEnum = typeEnum;
break; break;
} }
switch (typeEnum) {
case "normal":
this.typeEnum = this.typeEnum + ":单规格";
break;
case "sku":
this.typeEnum = this.typeEnum + "多规格";
break;
}
} }
@Data @Data