i国网:一周菜谱

This commit is contained in:
sxu 2025-07-07 18:10:01 +08:00
parent 2954e53c05
commit e5776dd910
4 changed files with 30 additions and 3 deletions

View File

@ -22,6 +22,9 @@ public class WeekRecipeDetailVO {
@ApiModelProperty(value = "餐次(早中晚)")
private int mealType;
@ApiModelProperty(value = "菜品id")
private Long dishesId;
@ApiModelProperty(value = "菜品名称")
private String cookName;
@ -65,7 +68,7 @@ public class WeekRecipeDetailVO {
return FileUrlUtil.getFileUrl(this.imgUrl);
}
public String getCookPic() {
return Base64Util.convertImgToBase64(this.getImgUrl());
}
// public String getCookPic() {
// return Base64Util.convertImgToBase64(this.getImgUrl());
// }
}

View File

@ -1,6 +1,7 @@
package com.bonus.canteen.core.zhhq.mapper;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeDetailVO;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeIngredientVO;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
@ -16,4 +17,6 @@ public interface ZhhqCookRecipeMapper {
public List<Long> selectWeekRecipeList();
public List<WeekRecipeDetailVO> selectWeekRecipeDetail(@Param("weekDates") List<LocalDate> weekDates, @Param("recipeIds") List<Long> recipeIds);
public List<WeekRecipeIngredientVO> getCookMaterialById(Long dishesId);
}

View File

@ -5,6 +5,7 @@ import com.bonus.canteen.core.basic.mapper.BasicCanteenMapper;
import com.bonus.canteen.core.common.utils.DateUtil;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeDTO;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeDetailVO;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeIngredientVO;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeVO;
import com.bonus.canteen.core.zhhq.mapper.ZhhqCookRecipeMapper;
import com.bonus.canteen.core.zhhq.service.IZhhqCookRecipeService;
@ -46,6 +47,11 @@ public class ZhhqCookRecipeServiceImpl implements IZhhqCookRecipeService {
//查询一周菜谱详情
List<Long> recipeIds = zhhqCookRecipeMapper.selectWeekRecipeList();
List<WeekRecipeDetailVO> recipeDetails = zhhqCookRecipeMapper.selectWeekRecipeDetail(weekDates, recipeIds);
for (WeekRecipeDetailVO detailVO : recipeDetails) {
Long dishesId = detailVO.getDishesId();
List<WeekRecipeIngredientVO> cookMaterials = zhhqCookRecipeMapper.getCookMaterialById(dishesId);
detailVO.setIngredients(cookMaterials);
}
//组装原料及营养信息
weekRecipeVO.setRecipeDetails(recipeDetails);
return weekRecipeVO;

View File

@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="WeekRecipeDetailVO" type="com.bonus.canteen.core.zhhq.domain.WeekRecipeDetailVO">
<result property="mealType" column="mealtime_type"/>
<result property="typeName" column="type_name"/>
<result property="dishesId" column="dishes_id"/>
<result property="cookName" column="dishes_name"/>
<result property="recommendType" column="recommend_flag"/>
<result property="price" column="dishes_price"/>
@ -72,5 +73,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by
md.dishes_id asc
</select>
<select id="getCookMaterialById" resultType="com.bonus.canteen.core.zhhq.domain.WeekRecipeIngredientVO">
SELECT cm.material_id,
cm.material_name,
cm.material_code,
cm.img_url,
cdm.weight,
cdm.material_type,
cn.nutrition_type_id as little_type
FROM cook_material cm
LEFT JOIN cook_dishes_material cdm ON cm.material_id = cdm.material_id
LEFT JOIN cook_nutrition cn ON cn.nutrition_id = cm.nutrition_id
WHERE cdm.dishes_id = #{dishesId}
</select>
</mapper>