Commit 0376e878 authored by shiyu's avatar shiyu

Merge remote-tracking branch 'origin/quanku_v3.4' into quanku_v3.5

parents 60a5e2aa 6950ee5f
...@@ -57,6 +57,12 @@ public interface SupplierItemDao { ...@@ -57,6 +57,12 @@ public interface SupplierItemDao {
*/ */
SupplierItem findById(long itemId); SupplierItem findById(long itemId);
/**
* 查询置顶商品
* @return
*/
SupplierItem findTopItem();
int update(SupplierItem supplierItem); int update(SupplierItem supplierItem);
......
...@@ -127,6 +127,15 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -127,6 +127,15 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
return supplierItemMapper.selectOneByExampleWithBLOBs(supplierItemExample); 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 @Override
public int update(SupplierItem supplierItem) { public int update(SupplierItem supplierItem) {
supplierItem.setUpdateTime(new Date()); supplierItem.setUpdateTime(new Date());
...@@ -176,6 +185,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -176,6 +185,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
criteria.andTypeIn(dto.getTypeList()); criteria.andTypeIn(dto.getTypeList());
criteria.andStockGreaterThan(0); criteria.andStockGreaterThan(0);
criteria.andIsDeletedEqualTo(false); criteria.andIsDeletedEqualTo(false);
criteria.andSortNotEqualTo(-100);
JdbcHelper.ifPresent(dto.getFilterIds(), criteria::andIdNotIn); JdbcHelper.ifPresent(dto.getFilterIds(), criteria::andIdNotIn);
// criteria.andIsOnSaleEqualTo(true); // criteria.andIsOnSaleEqualTo(true);
if (!CollectionUtils.isEmpty(dto.getIds())) { if (!CollectionUtils.isEmpty(dto.getIds())) {
...@@ -184,6 +194,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -184,6 +194,7 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
orCriteria.andTypeIn(dto.getTypeList()); orCriteria.andTypeIn(dto.getTypeList());
orCriteria.andStockGreaterThan(0); orCriteria.andStockGreaterThan(0);
orCriteria.andIsDeletedEqualTo(false); orCriteria.andIsDeletedEqualTo(false);
criteria.andSortNotEqualTo(-100);
// orCriteria.andIsOnSaleEqualTo(true); // orCriteria.andIsOnSaleEqualTo(true);
} }
// supplierItemExample.setOrderByClause(" create_time desc"); // supplierItemExample.setOrderByClause(" create_time desc");
......
...@@ -1273,6 +1273,10 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -1273,6 +1273,10 @@ public class SupplierItemServiceImpl implements SupplierItemService {
searchDto.setPage(1); searchDto.setPage(1);
List<SupplierItem> supplierItemList = supplierItemDao.findForHomePage(searchDto); List<SupplierItem> supplierItemList = supplierItemDao.findForHomePage(searchDto);
PageInfo<SupplierItem> pageInfo = new PageInfo(supplierItemList); 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()); List<Long> filterItemIds = supplierItemList.stream().map(SupplierItem::getId).collect(Collectors.toList());
if (redisUtils.hasKey(viewKey)) { if (redisUtils.hasKey(viewKey)) {
List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey); List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey);
...@@ -1281,6 +1285,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -1281,6 +1285,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
} else { } else {
redisUtils.set(viewKey, filterItemIds, 60 * 60 * 2); redisUtils.set(viewKey, filterItemIds, 60 * 60 * 2);
} }
Date now = new Date(); Date now = new Date();
supplierItemList.forEach(supplierItem -> { supplierItemList.forEach(supplierItem -> {
SupplierItemVo supplierItemVo = new SupplierItemVo(); 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