Commit bcac572a authored by 姬鋆屾's avatar 姬鋆屾
parents 76ddda51 06abac86
...@@ -116,3 +116,7 @@ PRIMARY KEY (`id`) ...@@ -116,3 +116,7 @@ PRIMARY KEY (`id`)
ALTER TABLE mortals_xhx_company ADD COLUMN `background` varchar(256) default '' COMMENT '背景图片'; 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,表示这是哪个名片的收藏'; 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>{ ...@@ -85,6 +85,7 @@ public class ProductApiController extends AbstractBaseController<ProductReq>{
query.setCategoryId(String.valueOf(productReq.getCategoryId())); query.setCategoryId(String.valueOf(productReq.getCategoryId()));
} }
query.setHot(productReq.getHot()); query.setHot(productReq.getHot());
query.setShelves(1);
query.setOrderColList(Arrays.asList(new OrderCol("publishTime", OrderCol.DESCENDING))); query.setOrderColList(Arrays.asList(new OrderCol("publishTime", OrderCol.DESCENDING)));
Result<ProductEntity> result = productService.find(query, pageInfo, context); Result<ProductEntity> result = productService.find(query, pageInfo, context);
List<ProductEntity> collect = result.getList().stream().map(item -> { List<ProductEntity> collect = result.getList().stream().map(item -> {
......
...@@ -13,70 +13,74 @@ import com.mortals.xhx.module.product.model.vo.ProductVo; ...@@ -13,70 +13,74 @@ import com.mortals.xhx.module.product.model.vo.ProductVo;
import com.mortals.xhx.module.product.model.ProductQuestionEntity; import com.mortals.xhx.module.product.model.ProductQuestionEntity;
import lombok.Data; import lombok.Data;
/** /**
* 产品实体对象 * 产品实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-09-18 * @date 2024-12-26
*/ */
@Data @Data
public class ProductEntity extends ProductVo { public class ProductEntity extends ProductVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 产品名称,名称唯一 * 产品名称,名称唯一
*/ */
@Excel(name = "产品名称,名称唯一") @Excel(name = "产品名称,名称唯一")
private String productName; private String productName;
/** /**
* 产品编码 * 产品编码
*/ */
private String productCode; private String productCode;
/** /**
* 产品slogan * 产品slogan
*/ */
private String productSlogan; private String productSlogan;
/** /**
* 产品图标 * 产品图标
*/ */
private String productLogoPath; private String productLogoPath;
/** /**
* 产品封面图片 * 产品封面图片
*/ */
private String productFacePath; private String productFacePath;
/** /**
* 产品视频,多个视频逗号分割 * 产品视频,多个视频逗号分割
*/ */
private String productVideoPath; private String productVideoPath;
/** /**
* 产品宣传图片,多个视频逗号分割 * 产品宣传图片,多个视频逗号分割
*/ */
private String productPicPath; private String productPicPath;
/** /**
* 产品介绍 * 产品介绍
*/ */
private String productIntroduction; private String productIntroduction;
/** /**
* 产品详情 * 产品详情
*/ */
private String productDetail; private String productDetail;
/** /**
* 发布时间 * 发布时间
*/ */
private Date publishTime; private Date publishTime;
/** /**
* 是否热门(0.否,1.是) * 是否热门(0.否,1.是)
*/ */
private Integer hot; private Integer hot;
/** /**
* 备注 * 备注
*/ */
private String productRemark; private String productRemark;
/** /**
* 产品常见问题信息 * 是否上架(0.否,1.是)
*/ */
private Integer shelves;
/**
* 产品常见问题信息
*/
private List<ProductQuestionEntity> productQuestionList=new ArrayList<>();; private List<ProductQuestionEntity> productQuestionList=new ArrayList<>();;
public List<ProductQuestionEntity> getProductQuestionList(){ public List<ProductQuestionEntity> getProductQuestionList(){
return productQuestionList; return productQuestionList;
} }
public void setProductQuestionList(List<ProductQuestionEntity> productQuestionList){ public void setProductQuestionList(List<ProductQuestionEntity> productQuestionList){
...@@ -84,7 +88,7 @@ public class ProductEntity extends ProductVo { ...@@ -84,7 +88,7 @@ public class ProductEntity extends ProductVo {
} }
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -92,24 +96,25 @@ public class ProductEntity extends ProductVo { ...@@ -92,24 +96,25 @@ public class ProductEntity extends ProductVo {
if (obj instanceof ProductEntity) { if (obj instanceof ProductEntity) {
ProductEntity tmp = (ProductEntity) obj; ProductEntity tmp = (ProductEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
} }
public void initAttrValue(){ public void initAttrValue(){
this.productName = ""; this.productName = "";
this.productCode = ""; this.productCode = "";
this.productSlogan = ""; this.productSlogan = "";
this.productLogoPath = ""; this.productLogoPath = "";
this.productFacePath = ""; this.productFacePath = "";
this.productVideoPath = ""; this.productVideoPath = "";
this.productPicPath = ""; this.productPicPath = "";
this.productIntroduction = ""; this.productIntroduction = "";
this.productDetail = ""; this.productDetail = "";
this.publishTime = new Date(); this.publishTime = new Date();
this.hot = 0; this.hot = 0;
this.productRemark = ""; this.productRemark = "";
this.shelves = 1;
} }
} }
\ No newline at end of file
...@@ -76,7 +76,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -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.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.setList(productList);
productEntityResult.setPageInfo(productCategoryResult.getPageInfo()); productEntityResult.setPageInfo(productCategoryResult.getPageInfo());
productEntityResult.setDict(productCategoryResult.getDict()); productEntityResult.setDict(productCategoryResult.getDict());
...@@ -90,6 +92,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -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.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.setList(productList);
productEntityResult.setPageInfo(companyProductEntityResult.getPageInfo()); productEntityResult.setPageInfo(companyProductEntityResult.getPageInfo());
productEntityResult.setDict(companyProductEntityResult.getDict()); productEntityResult.setDict(companyProductEntityResult.getDict());
...@@ -108,6 +113,9 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -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.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); productEntityResult.setList(collect);
pageInfo.setTotalResult(collect.size()); pageInfo.setTotalResult(collect.size());
productEntityResult.setPageInfo(pageInfo); productEntityResult.setPageInfo(pageInfo);
...@@ -150,6 +158,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ...@@ -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()) productList = productList.stream().sorted(Comparator.comparing(ProductEntity::getPublishTime).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
return productList; return productList;
......
...@@ -74,6 +74,7 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product ...@@ -74,6 +74,7 @@ public class ProductController extends BaseCRUDJsonBodyMappingController<Product
this.addDict(model, "hot", YesNoEnum.getEnumMap()); 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, "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, "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); 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