Commit 6950ee5f authored by shiyu's avatar shiyu

首页置顶商品

parent 103c3d6f
......@@ -185,6 +185,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
criteria.andTypeIn(dto.getTypeList());
criteria.andStockGreaterThan(0);
criteria.andIsDeletedEqualTo(false);
criteria.andSortNotEqualTo(-100);
JdbcHelper.ifPresent(dto.getFilterIds(), criteria::andIdNotIn);
// criteria.andIsOnSaleEqualTo(true);
if (!CollectionUtils.isEmpty(dto.getIds())) {
......@@ -193,6 +194,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
orCriteria.andTypeIn(dto.getTypeList());
orCriteria.andStockGreaterThan(0);
orCriteria.andIsDeletedEqualTo(false);
criteria.andSortNotEqualTo(-100);
// orCriteria.andIsOnSaleEqualTo(true);
}
// supplierItemExample.setOrderByClause(" create_time desc");
......
......@@ -1273,6 +1273,10 @@ public class SupplierItemServiceImpl implements SupplierItemService {
searchDto.setPage(1);
List<SupplierItem> supplierItemList = supplierItemDao.findForHomePage(searchDto);
PageInfo<SupplierItem> pageInfo = new PageInfo(supplierItemList);
SupplierItem topSupplierItem = supplierItemDao.findTopItem();
if (topSupplierItem != null) {
supplierItemList.add(0, topSupplierItem);
}
List<Long> filterItemIds = supplierItemList.stream().map(SupplierItem::getId).collect(Collectors.toList());
if (redisUtils.hasKey(viewKey)) {
List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey);
......@@ -1281,11 +1285,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
} else {
redisUtils.set(viewKey, filterItemIds, 60 * 60 * 2);
}
//如果是第一页,就加上置顶的商品
SupplierItem topSupplierItem = supplierItemDao.findTopItem();
if (topSupplierItem != null) {
supplierItemList.add(0, topSupplierItem);
}
Date now = new Date();
supplierItemList.forEach(supplierItem -> {
SupplierItemVo supplierItemVo = new SupplierItemVo();
......
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