zhangyuewww 2 years ago
parent
commit
d0aea6e8df

+ 13 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/tourism/impl/DishClassifyInfoServiceImpl.java

@@ -2,6 +2,8 @@ package com.iotechn.unimall.admin.api.tourism.impl;
 
 import java.util.List;
 
+import com.iotechn.unimall.data.domain.FoodDishesInfo;
+import com.iotechn.unimall.data.mapper.FoodDishesInfoMapper;
 import org.apache.ibatis.session.RowBounds;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -29,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
 public class DishClassifyInfoServiceImpl implements IDishClassifyInfoService{
 	@Autowired
 	private DishClassifyInfoMapper dishClassifyInfoMapper;
+	@Autowired
+	private FoodDishesInfoMapper foodDishesInfoMapper;
 	
 	@Override
 	public Boolean add(DishClassifyInfo dishClassifyInfo) throws ServiceException {
@@ -61,6 +65,15 @@ public class DishClassifyInfoServiceImpl implements IDishClassifyInfoService{
 				}
 							wrapper.eq("delete_flag", 0).orderBy("top_marking",false);
 		List<DishClassifyInfo> list = dishClassifyInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
+		if (!CollectionUtils.isEmpty(list)){
+			for (DishClassifyInfo dishClassifyInfo:list){
+				List<FoodDishesInfo> foodDishesInfoList = foodDishesInfoMapper.selectList(new EntityWrapper<FoodDishesInfo>()
+						.eq("food_id",dishClassifyInfo.getFoodId())
+						.eq("classify",dishClassifyInfo.getClassifyName())
+						.orderBy("top_marking",false).orderBy("gmt_create",false));
+				dishClassifyInfo.setDishesNum(foodDishesInfoList.size());
+			}
+		}
 		Integer count = dishClassifyInfoMapper.selectCount(wrapper);
 		return new Page<DishClassifyInfo>(list, page, limit, count);
 	}

+ 2 - 1
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/tourism/impl/FoodInfoServiceImpl.java

@@ -148,7 +148,8 @@ public class FoodInfoServiceImpl implements IFoodInfoService {
 					for (DishClassifyInfo dishClassifyInfo:dishClassifyInfoList){
 						List<FoodDishesInfo> foodDishesInfoList = foodDishesInfoMapper.selectList(new EntityWrapper<FoodDishesInfo>()
 								.eq("food_id",foodInfo.getId())
-								.eq("classify",dishClassifyInfo.getClassifyName()));
+								.eq("classify",dishClassifyInfo.getClassifyName())
+						 		.orderBy("top_marking",false).orderBy("gmt_create",false));
 						if (!CollectionUtils.isEmpty(foodDishesInfoList)){
 							dishClassifyInfo.setFoodDishesInfoList(foodDishesInfoList);
 							dishClassifyInfo.setDishesNum(foodDishesInfoList.size());

+ 1 - 1
unimall-data/src/main/resources/com/iotechn/unimall/data/mapper/FoodInfoMapper.xml

@@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND lci.common_id = #{commonId}
         WHERE
             f.delete_flag = 0
-          AND f.`status` = '已通过'
+          AND f.`status` = '显示中'
         <if test="label != null and label != ''">
             AND (lower(f.label) like lower(CONCAT('%',#{label},'%')))
         </if>