获取指定日期菜谱计划菜品详情
This commit is contained in:
parent
b3e5e86c69
commit
ace01ae9fd
|
|
@ -2,8 +2,9 @@ package com.bonus.canteen.core.cook.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||||
|
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||||
|
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit;
|
//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -75,6 +76,14 @@ public class CookRecipeController extends BaseController {
|
||||||
return success(cookRecipeService.selectCookRecipeByRecipeId(recipeId));
|
return success(cookRecipeService.selectCookRecipeByRecipeId(recipeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取指定日期菜谱计划菜品详情")
|
||||||
|
//@RequiresPermissions("cook:recipe:query")
|
||||||
|
@PostMapping({"/getRecipeDetailByDate"})
|
||||||
|
public AjaxResult getRecipeDetailByDate(@RequestBody CookRecipeDetailDTO dto) {
|
||||||
|
List<CookRecipeDetailVO> list = cookRecipeService.getRecipeDetailByDate(dto);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜品计划信息
|
* 新增菜品计划信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.bonus.canteen.core.cook.mapper;
|
package com.bonus.canteen.core.cook.mapper;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.canteen.core.cook.domain.CookRecipe;
|
import com.bonus.canteen.core.cook.domain.CookRecipe;
|
||||||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||||
|
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜品计划信息Mapper接口
|
* 菜品计划信息Mapper接口
|
||||||
|
|
@ -33,6 +36,8 @@ public interface CookRecipeMapper {
|
||||||
|
|
||||||
public int getDishesCount4Recycle(Long recipeId);
|
public int getDishesCount4Recycle(Long recipeId);
|
||||||
|
|
||||||
|
List<CookRecipeDetailVO> selectRecipeDetailList(@Param("recipeId") Long recipeId, @Param("applyDate") LocalDate applyDate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜品计划信息
|
* 新增菜品计划信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.bonus.canteen.core.cook.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.canteen.core.cook.domain.CookRecipe;
|
import com.bonus.canteen.core.cook.domain.CookRecipe;
|
||||||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||||
|
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||||
|
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜品计划信息Service接口
|
* 菜品计划信息Service接口
|
||||||
|
|
@ -27,6 +29,8 @@ public interface ICookRecipeService {
|
||||||
*/
|
*/
|
||||||
public List<CookRecipe> selectCookRecipeList(CookRecipe cookRecipe);
|
public List<CookRecipe> selectCookRecipeList(CookRecipe cookRecipe);
|
||||||
|
|
||||||
|
public List<CookRecipeDetailVO> getRecipeDetailByDate(CookRecipeDetailDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜品计划信息
|
* 新增菜品计划信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||||
import com.bonus.canteen.core.cook.dto.CookRecipeDishesDTO;
|
import com.bonus.canteen.core.cook.dto.CookRecipeDishesDTO;
|
||||||
import com.bonus.canteen.core.cook.mapper.CookRecipeDetailMapper;
|
import com.bonus.canteen.core.cook.mapper.CookRecipeDetailMapper;
|
||||||
import com.bonus.canteen.core.cook.mapper.CookRecipeDishesMapper;
|
import com.bonus.canteen.core.cook.mapper.CookRecipeDishesMapper;
|
||||||
|
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
|
@ -75,6 +76,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CookRecipeDetailVO> getRecipeDetailByDate(CookRecipeDetailDTO dto) {
|
||||||
|
//this.generateRecipe(dto.getRecipeId(), dto.getApplyDate());
|
||||||
|
List<CookRecipeDetailVO> menuRecipeDetails = cookRecipeMapper.selectRecipeDetailList(dto.getRecipeId(), dto.getApplyDate());
|
||||||
|
return menuRecipeDetails.stream().sorted(Comparator.comparing(CookRecipeDetailVO::getMealtimeType)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增菜品计划信息
|
* 新增菜品计划信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.cook.dto.CookRecipeDishesDTO;
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜品计划详情信息对象 cook_recipe_detail
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2025-05-25
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class CookRecipeDetailVO extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 菜谱详情id */
|
||||||
|
private Long recipeDetailId;
|
||||||
|
|
||||||
|
/** 菜品计划销售类别id(数据同步) */
|
||||||
|
@Excel(name = "菜品计划销售类别id(数据同步)")
|
||||||
|
@ApiModelProperty(value = "菜品计划销售类别id(数据同步)")
|
||||||
|
private String saleTypeId;
|
||||||
|
|
||||||
|
/** 菜谱id */
|
||||||
|
@Excel(name = "菜谱id")
|
||||||
|
@ApiModelProperty(value = "菜谱id")
|
||||||
|
private Long recipeId;
|
||||||
|
|
||||||
|
/** 启用时间(天) */
|
||||||
|
@ApiModelProperty(value = "启用时间(天)")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "启用时间(天)", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private LocalDate applyDate;
|
||||||
|
|
||||||
|
/** 启用时间(周) */
|
||||||
|
@Excel(name = "启用时间(周)")
|
||||||
|
@ApiModelProperty(value = "启用时间(周)")
|
||||||
|
private Long applyWeek;
|
||||||
|
|
||||||
|
/** 启用时间(月) */
|
||||||
|
@Excel(name = "启用时间(月)")
|
||||||
|
@ApiModelProperty(value = "启用时间(月)")
|
||||||
|
private Long applyMonth;
|
||||||
|
|
||||||
|
/** 餐次类型 */
|
||||||
|
@Excel(name = "餐次类型")
|
||||||
|
@ApiModelProperty(value = "餐次类型")
|
||||||
|
private Long mealtimeType;
|
||||||
|
|
||||||
|
/** 详情类型(1-模板,2-详情) */
|
||||||
|
@Excel(name = "详情类型(1-模板,2-详情)")
|
||||||
|
@ApiModelProperty(value = "详情类型(1-模板,2-详情)")
|
||||||
|
private Long detailType;
|
||||||
|
|
||||||
|
private List<CookRecipeDishesVO> dishesList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜品计划菜品关联对象 cook_recipe_dishes
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2025-05-25
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class CookRecipeDishesVO extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 菜谱详情id */
|
||||||
|
@Excel(name = "菜谱详情id")
|
||||||
|
@ApiModelProperty(value = "菜谱详情id")
|
||||||
|
private Long recipeDetailId;
|
||||||
|
|
||||||
|
/** 菜品id */
|
||||||
|
@Excel(name = "菜品id")
|
||||||
|
@ApiModelProperty(value = "菜品id")
|
||||||
|
private Long dishesId;
|
||||||
|
|
||||||
|
/** 菜品单价 */
|
||||||
|
@Excel(name = "菜品单价")
|
||||||
|
@ApiModelProperty(value = "菜品单价")
|
||||||
|
private Long price;
|
||||||
|
|
||||||
|
/** 菜品售价(优惠价) */
|
||||||
|
@Excel(name = "菜品售价(优惠价)")
|
||||||
|
@ApiModelProperty(value = "菜品售价(优惠价)")
|
||||||
|
private Long salePrice;
|
||||||
|
|
||||||
|
/** 规格类型(1-标准,2-大份,3-小份,4-50g,5-100g) */
|
||||||
|
@Excel(name = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
|
||||||
|
@ApiModelProperty(value = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
|
||||||
|
private Long sizeType;
|
||||||
|
|
||||||
|
/** 供应数量 */
|
||||||
|
@Excel(name = "供应数量")
|
||||||
|
@ApiModelProperty(value = "供应数量")
|
||||||
|
private Long supplyNum;
|
||||||
|
|
||||||
|
/** 销售数量 */
|
||||||
|
@Excel(name = "销售数量")
|
||||||
|
@ApiModelProperty(value = "销售数量")
|
||||||
|
private Long saleNum;
|
||||||
|
|
||||||
|
/** 剩余数量 */
|
||||||
|
@Excel(name = "剩余数量")
|
||||||
|
@ApiModelProperty(value = "剩余数量")
|
||||||
|
private Integer remanentNum;
|
||||||
|
|
||||||
|
/** 个人限购数量 */
|
||||||
|
@Excel(name = "个人限购数量")
|
||||||
|
@ApiModelProperty(value = "个人限购数量")
|
||||||
|
private Long limitNum;
|
||||||
|
|
||||||
|
/** 厨师id */
|
||||||
|
@Excel(name = "厨师id")
|
||||||
|
@ApiModelProperty(value = "厨师id")
|
||||||
|
private Long chefId;
|
||||||
|
|
||||||
|
/** 是否推荐(1-推荐,2-不推荐) */
|
||||||
|
@Excel(name = "是否推荐(1-推荐,2-不推荐)")
|
||||||
|
@ApiModelProperty(value = "是否推荐(1-推荐,2-不推荐)")
|
||||||
|
private Long recommendFlag;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -54,6 +54,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select count(1) from cook_recipe_dishes where recipe_detail_id in
|
select count(1) from cook_recipe_dishes where recipe_detail_id in
|
||||||
(select recipe_detail_id from cook_recipe_detail where recipe_id = #{recipeId} and detail_type = 1)
|
(select recipe_detail_id from cook_recipe_detail where recipe_id = #{recipeId} and detail_type = 1)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取指定日期菜谱详情 -->
|
||||||
|
<select id="selectRecipeDetailList" resultType="com.bonus.canteen.core.cook.vo.CookRecipeDetailVO">
|
||||||
|
select crd.mealtime_type,
|
||||||
|
crd.recipe_detail_id,
|
||||||
|
cd.dishes_id,
|
||||||
|
cdb.base_dishes_id,
|
||||||
|
cdb.dishes_name,
|
||||||
|
crdd.id,
|
||||||
|
crdd.price,
|
||||||
|
crdd.size_type,
|
||||||
|
crdd.supply_num,
|
||||||
|
crdd.sale_num,
|
||||||
|
crdd.remanent_num,
|
||||||
|
crdd.limit_num,
|
||||||
|
crdd.sale_price,
|
||||||
|
crdd.recommend_flag,
|
||||||
|
bc.canteen_name,
|
||||||
|
cd.sales_mode,
|
||||||
|
cd.unit_price,
|
||||||
|
cd.meal_type,
|
||||||
|
cd.type_id,
|
||||||
|
cdt.dishes_type_name,
|
||||||
|
cd.material_cost
|
||||||
|
from cook_recipe_detail crd
|
||||||
|
left join cook_recipe_dishes crdd on crd.recipe_detail_id = crdd.recipe_detail_id
|
||||||
|
left join cook_dishes cd on crdd.dishes_id = cd.dishes_id
|
||||||
|
left join basic_canteen bc on cd.canteen_id = bc.canteen_id
|
||||||
|
left join cook_dishes_base cdb on cd.base_dishes_id = cdb.base_dishes_id
|
||||||
|
left join cook_dishes_type cdt on cd.type_id = cdt.dishes_type_id
|
||||||
|
where crd.recipe_id = #{recipeId}
|
||||||
|
and crd.apply_date = #{applyDate}
|
||||||
|
order by crdd.dishes_id
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
|
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
|
||||||
<include refid="selectCookRecipeVo"/>
|
<include refid="selectCookRecipeVo"/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue