Commit 06abac86 authored by 廖旭伟's avatar 廖旭伟

产品增加上下架属性

parent d291d231
......@@ -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,11 +13,11 @@ 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;
......@@ -71,6 +71,10 @@ public class ProductEntity extends ProductVo {
* 备注
*/
private String productRemark;
/**
* 是否上架(0.否,1.是)
*/
private Integer shelves;
/**
* 产品常见问题信息
*/
......@@ -111,5 +115,6 @@ public class ProductEntity extends ProductVo {
this.publishTime = new Date();
this.hot = 0;
this.productRemark = "";
this.shelves = 1;
}
}
\ No newline at end of file
......@@ -5,11 +5,11 @@ import java.util.Date;
import java.util.List;
import com.mortals.xhx.module.product.model.ProductEntity;
/**
* 产品查询对象
*
* @author zxfei
* @date 2023-09-18
*/
* 产品查询对象
*
* @author zxfei
* @date 2024-12-26
*/
public class ProductQuery extends ProductEntity {
/** 开始 主键ID,主键,自增长 */
private Long idStart;
......@@ -139,6 +139,21 @@ public class ProductQuery extends ProductEntity {
/** 结束 更新时间 */
private String updateTimeEnd;
/** 开始 是否上架(0.否,1.是) */
private Integer shelvesStart;
/** 结束 是否上架(0.否,1.是) */
private Integer shelvesEnd;
/** 增加 是否上架(0.否,1.是) */
private Integer shelvesIncrement;
/** 是否上架(0.否,1.是)列表 */
private List <Integer> shelvesList;
/** 是否上架(0.否,1.是)排除列表 */
private List <Integer> shelvesNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<ProductQuery> orConditionList;
......@@ -887,6 +902,87 @@ public class ProductQuery extends ProductEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 开始 是否上架(0.否,1.是)
* @return shelvesStart
*/
public Integer getShelvesStart(){
return this.shelvesStart;
}
/**
* 设置 开始 是否上架(0.否,1.是)
* @param shelvesStart
*/
public void setShelvesStart(Integer shelvesStart){
this.shelvesStart = shelvesStart;
}
/**
* 获取 结束 是否上架(0.否,1.是)
* @return $shelvesEnd
*/
public Integer getShelvesEnd(){
return this.shelvesEnd;
}
/**
* 设置 结束 是否上架(0.否,1.是)
* @param shelvesEnd
*/
public void setShelvesEnd(Integer shelvesEnd){
this.shelvesEnd = shelvesEnd;
}
/**
* 获取 增加 是否上架(0.否,1.是)
* @return shelvesIncrement
*/
public Integer getShelvesIncrement(){
return this.shelvesIncrement;
}
/**
* 设置 增加 是否上架(0.否,1.是)
* @param shelvesIncrement
*/
public void setShelvesIncrement(Integer shelvesIncrement){
this.shelvesIncrement = shelvesIncrement;
}
/**
* 获取 是否上架(0.否,1.是)
* @return shelvesList
*/
public List<Integer> getShelvesList(){
return this.shelvesList;
}
/**
* 设置 是否上架(0.否,1.是)
* @param shelvesList
*/
public void setShelvesList(List<Integer> shelvesList){
this.shelvesList = shelvesList;
}
/**
* 获取 是否上架(0.否,1.是)
* @return shelvesNotList
*/
public List<Integer> getShelvesNotList(){
return this.shelvesNotList;
}
/**
* 设置 是否上架(0.否,1.是)
* @param shelvesNotList
*/
public void setShelvesNotList(List<Integer> shelvesNotList){
this.shelvesNotList = shelvesNotList;
}
/**
* 设置 主键ID,主键,自增长
* @param id
......@@ -1296,6 +1392,60 @@ public class ProductQuery extends ProductEntity {
}
/**
* 设置 是否上架(0.否,1.是)
* @param shelves
*/
public ProductQuery shelves(Integer shelves){
setShelves(shelves);
return this;
}
/**
* 设置 开始 是否上架(0.否,1.是)
* @param shelvesStart
*/
public ProductQuery shelvesStart(Integer shelvesStart){
this.shelvesStart = shelvesStart;
return this;
}
/**
* 设置 结束 是否上架(0.否,1.是)
* @param shelvesEnd
*/
public ProductQuery shelvesEnd(Integer shelvesEnd){
this.shelvesEnd = shelvesEnd;
return this;
}
/**
* 设置 增加 是否上架(0.否,1.是)
* @param shelvesIncrement
*/
public ProductQuery shelvesIncrement(Integer shelvesIncrement){
this.shelvesIncrement = shelvesIncrement;
return this;
}
/**
* 设置 是否上架(0.否,1.是)
* @param shelvesList
*/
public ProductQuery shelvesList(List<Integer> shelvesList){
this.shelvesList = shelvesList;
return this;
}
/**
* 设置 是否上架(0.否,1.是)
* @param shelvesNotList
*/
public ProductQuery shelvesNotList(List<Integer> shelvesNotList){
this.shelvesNotList = shelvesNotList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
......@@ -76,6 +76,7 @@ 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);
......@@ -91,6 +92,7 @@ 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);
......@@ -111,6 +113,7 @@ 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);
......@@ -155,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