Commit 103c3d6f authored by shiyu's avatar shiyu

首页置顶商品

parent 81609478
......@@ -57,6 +57,12 @@ public interface SupplierItemDao {
*/
SupplierItem findById(long itemId);
/**
* 查询置顶商品
* @return
*/
SupplierItem findTopItem();
int update(SupplierItem supplierItem);
......
......@@ -127,6 +127,15 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
return supplierItemMapper.selectOneByExampleWithBLOBs(supplierItemExample);
}
@Override
public SupplierItem findTopItem() {
SupplierItemExample supplierItemExample = new SupplierItemExample();
SupplierItemExample.Criteria criteria = supplierItemExample.createCriteria();
criteria.andSortEqualTo(-100);
return supplierItemMapper.selectOneByExampleWithBLOBs(supplierItemExample);
}
@Override
public int update(SupplierItem supplierItem) {
supplierItem.setUpdateTime(new Date());
......
......@@ -1281,6 +1281,11 @@ 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