1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

创建微服务:microservice-provider-shop-8003;小程序商品列表筛选、商品详情完成

This commit is contained in:
2023-03-18 23:00:58 +08:00
parent ee7e2e9acb
commit 7eab148104
41 changed files with 1161 additions and 84 deletions

View File

@@ -0,0 +1,25 @@
package com.cxyxiaomo.epp.common.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Good {
Long id;
String goodsName;
Integer categoryId;
Integer brand;
String gallery;
String brief;
Boolean isOnSale;
String picUrl;
Integer type;
String unit;
Double counterPrice;
Double retailPrice;
String detail;
Boolean deleted;
}

View File

@@ -0,0 +1,14 @@
package com.cxyxiaomo.epp.common.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class GoodCategory {
Long id;
String categoryName;
Integer order;
}

View File

@@ -0,0 +1,41 @@
package com.cxyxiaomo.epp.common.vo;
import com.cxyxiaomo.epp.common.pojo.GoodCategory;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
// 数据库关系映射
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
// 微服务必须要实现Serializable
public class GoodCategoryVO implements Serializable {
Long id;
String categoryName;
Integer order;
public static GoodCategoryVO convertFrom(GoodCategory goodCategory) {
if (goodCategory == null) {
return null;
}
GoodCategoryVO goodCategoryVO = new GoodCategoryVO();
BeanUtils.copyProperties(goodCategory, goodCategoryVO);
return goodCategoryVO;
}
public static List<GoodCategoryVO> convertFrom(List<GoodCategory> goodCategoryList) {
if (goodCategoryList == null) {
return null;
}
List<GoodCategoryVO> goodCategoryVOList = goodCategoryList.stream().map(GoodCategoryVO::convertFrom).collect(Collectors.toList());
return goodCategoryVOList;
}
}

View File

@@ -0,0 +1,50 @@
package com.cxyxiaomo.epp.common.vo;
import com.cxyxiaomo.epp.common.pojo.Good;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
// 数据库关系映射
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
// 微服务必须要实现Serializable
public class GoodVO implements Serializable {
Long id;
String goodsName;
Integer categoryId;
Integer brand;
String gallery;
String brief;
Boolean isOnSale;
String picUrl;
Integer type;
String unit;
Double counterPrice;
Double retailPrice;
String detail;
public static GoodVO convertFrom(Good good) {
if (good == null) {
return null;
}
GoodVO goodVO = new GoodVO();
BeanUtils.copyProperties(good, goodVO);
return goodVO;
}
public static List<GoodVO> convertFrom(List<Good> goodList) {
if (goodList == null) {
return null;
}
List<GoodVO> goodVOList = goodList.stream().map(GoodVO::convertFrom).collect(Collectors.toList());
return goodVOList;
}
}