Commit bcac572a authored by 姬鋆屾's avatar 姬鋆屾
parents 76ddda51 06abac86
......@@ -116,3 +116,7 @@ PRIMARY KEY (`id`)
ALTER TABLE mortals_xhx_company ADD COLUMN `background` varchar(256) default '' COMMENT '背景图片';
ALTER TABLE `mortals_xhx_favorites_businesscard` CHANGE `staffId` `bussinesscardId` bigint(20) NOT NULL COMMENT '名片ID, 关联到名片表中的ID,表示这是哪个名片的收藏';
-- ----------------------------
-- 2024-12-26
-- ----------------------------
ALTER TABLE `mortals_xhx_product` ADD COLUMN `shelves` tinyint(1) DEFAULT '1' COMMENT '是否上架(0.否,1.是)';
......@@ -85,6 +85,7 @@ public class ProductApiController extends AbstractBaseController<ProductReq>{
query.setCategoryId(String.valueOf(productReq.getCategoryId()));
}
query.setHot(productReq.getHot());
query.setShelves(1);
query.setOrderColList(Arrays.asList(new OrderCol("publishTime", OrderCol.DESCENDING)));
Result<ProductEntity> result = productService.find(query, pageInfo, context);
List<ProductEntity> collect = result.getList().stream().map(item -> {
......
......@@ -13,70 +13,74 @@ import com.mortals.xhx.module.product.model.vo.ProductVo;
import com.mortals.xhx.module.product.model.ProductQuestionEntity;
import lombok.Data;
/**
* 产品实体对象
*
* @author zxfei
* @date 2023-09-18
*/
* 产品实体对象
*
* @author zxfei
* @date 2024-12-26
*/
@Data
public class ProductEntity extends ProductVo {
private static final long serialVersionUID = 1L;
/**
* 产品名称,名称唯一
*/
* 产品名称,名称唯一
*/
@Excel(name = "产品名称,名称唯一")
private String productName;
/**
* 产品编码
*/
* 产品编码
*/
private String productCode;
/**
* 产品slogan
*/
* 产品slogan
*/
private String productSlogan;
/**
* 产品图标
*/
* 产品图标
*/
private String productLogoPath;
/**
* 产品封面图片
*/
* 产品封面图片
*/
private String productFacePath;
/**
* 产品视频,多个视频逗号分割
*/
* 产品视频,多个视频逗号分割
*/
private String productVideoPath;
/**
* 产品宣传图片,多个视频逗号分割
*/
* 产品宣传图片,多个视频逗号分割
*/
private String productPicPath;
/**
* 产品介绍
*/
* 产品介绍
*/
private String productIntroduction;
/**
* 产品详情
*/
* 产品详情
*/
private String productDetail;
/**
* 发布时间
*/
* 发布时间
*/
private Date publishTime;
/**
* 是否热门(0.否,1.是)
*/
* 是否热门(0.否,1.是)
*/
private Integer hot;
/**
* 备注
*/
* 备注
*/
private String productRemark;
/**
* 产品常见问题信息
*/
* 是否上架(0.否,1.是)
*/
private Integer shelves;
/**
* 产品常见问题信息
*/
private List<ProductQuestionEntity> productQuestionList=new ArrayList<>();;
public List<ProductQuestionEntity> getProductQuestionList(){
return productQuestionList;
return productQuestionList;
}
public void setProductQuestionList(List<ProductQuestionEntity> productQuestionList){
......@@ -84,7 +88,7 @@ public class ProductEntity extends ProductVo {
}
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -92,24 +96,25 @@ public class ProductEntity extends ProductVo {
if (obj instanceof ProductEntity) {
ProductEntity tmp = (ProductEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
}
public void initAttrValue(){
this.productName = "";
this.productCode = "";
this.productSlogan = "";
this.productLogoPath = "";
this.productFacePath = "";
this.productVideoPath = "";
this.productPicPath = "";
this.productIntroduction = "";
this.productDetail = "";
this.publishTime = new Date();
this.hot = 0;
this.productRemark = "";
this.productName = "";
this.productCode = "";
this.productSlogan = "";
this.productLogoPath = "";
this.productFacePath = "";
this.productVideoPath = "";
this.productPicPath = "";
this.productIntroduction = "";
this.productDetail = "";
this.publishTime = new Date();
this.hot = 0;
this.productRemark = "";
this.shelves = 1;
}
}
\ No newline at end of file
......@@ -76,7 +76,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
//过滤热门与非热门
productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
}
productList = productList.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList());
productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList());
productEntityResult.setList(productList);
productEntityResult.setPageInfo(productCategoryResult.getPageInfo());
productEntityResult.setDict(productCategoryResult.getDict());
......@@ -90,6 +92,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
//过滤热门与非热门
productList = productList.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
}
productList = productList.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList());
productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList());
productEntityResult.setList(productList);
productEntityResult.setPageInfo(companyProductEntityResult.getPageInfo());
productEntityResult.setDict(companyProductEntityResult.getDict());
......@@ -108,6 +113,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
//过滤热门与非热门
collect = collect.stream().filter(f -> f.getHot() == hot).collect(Collectors.toList());
}
collect = collect.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList());
collect = collect.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList());
productEntityResult.setList(collect);
pageInfo.setTotalResult(collect.size());
productEntityResult.setPageInfo(pageInfo);
......@@ -150,6 +158,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
}
});
}
productList = productList.stream().filter(f -> f.getShelves() == 1).collect(Collectors.toList());
productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList());
return productList;
......
......@@ -74,6 +74,7 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product
this.addDict(model, "hot", YesNoEnum.getEnumMap());
this.addDict(model, "categoryId", categoryService.find(new CategoryQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName(), (o, n) -> n)));
this.addDict(model, "companyId", companyService.find(new CompanyQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getCompanyName(), (o, n) -> n)));
this.addDict(model, "shelves", YesNoEnum.getEnumMap());
super.init(model, context);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment