菜品,菜谱,档口相关问题修复,接口编写,更新此版本 本地数据库需执行添加以下sql语句:
ALTER TABLE menu_dishes ADD COLUMN label_id VARCHAR(32) COMMENT '标签id' AFTER remark, ADD COLUMN taste_id VARCHAR(32) COMMENT '口味id' AFTER label_id, ADD COLUMN season_id VARCHAR(32) COMMENT '分类id' AFTER taste_id, ADD COLUMN suit_id VARCHAR(32) COMMENT '适宜人群id' AFTER season_id, ADD COLUMN meal_id VARCHAR(32) COMMENT '餐次id' AFTER suit_id;
This commit is contained in:
parent
28782ce71c
commit
e4473d5c8a
|
|
@ -118,13 +118,13 @@ public class MenuDishesController extends BaseController {
|
|||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("menu:dishes:edit")
|
||||
@SysLog(title = "菜品信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改菜品信息")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody MenuDishes menuDishes) {
|
||||
try {
|
||||
return toAjax(menuDishesService.updateMenuDishes(menuDishes));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
@PostMapping("/deitMenuDishes")
|
||||
public AjaxResult deitMenuDishes(@RequestBody MenuDishesDTO menuDishesDTO) {
|
||||
//try {
|
||||
return toAjax(menuDishesService.updateMenuDishes(menuDishesDTO));
|
||||
// } catch (Exception e) {
|
||||
// return error("系统错误, " + e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ import javax.validation.Valid;
|
|||
|
||||
import com.bonus.canteen.core.common.utils.RedisUtil;
|
||||
import com.bonus.canteen.core.common.utils.TenantContextHolder;
|
||||
import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuRecipeBindDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuRecipeParamDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuTypeDishesDTO;
|
||||
import com.bonus.canteen.core.menu.dto.*;
|
||||
import com.bonus.canteen.core.menu.service.IMenuRecipeService;
|
||||
import com.bonus.canteen.core.menu.vo.AllocRecipeStallVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO;
|
||||
import com.bonus.canteen.core.menu.vo.*;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
|
|
@ -48,12 +49,21 @@ public class MenuRecipeController extends BaseController {
|
|||
/**
|
||||
* 查询菜品计划信息列表
|
||||
*/
|
||||
// @ApiOperation(value = "查询菜品计划信息列表")
|
||||
// //@RequiresPermissions("menu:recipe:list")
|
||||
// @GetMapping("/list")
|
||||
// public TableDataInfo list(MenuRecipe menuRecipe) {
|
||||
// startPage();
|
||||
// List<MenuRecipeVO> list = menuRecipeService.selectMenuRecipeList(menuRecipe);
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "查询菜品计划信息列表")
|
||||
//@RequiresPermissions("menu:recipe:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MenuRecipe menuRecipe) {
|
||||
public TableDataInfo list(AllocRecipeStallDTO dto) {
|
||||
startPage();
|
||||
List<MenuRecipeVO> list = menuRecipeService.selectMenuRecipeList(menuRecipe);
|
||||
List<AllocRecipeStallVO> list = menuRecipeService.selectMenuRecipeListV2(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
|||
import com.bonus.canteen.core.common.utils.FileUrlUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -186,6 +187,38 @@ public class MenuDishes extends Model<MenuDishes> {
|
|||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("食堂名称")
|
||||
@TableField(exist = false)
|
||||
private String canteenName;
|
||||
@ApiModelProperty("档口名称")
|
||||
@TableField(exist = false)
|
||||
private String stallName;
|
||||
|
||||
@Getter
|
||||
@ApiModelProperty("区域名称")
|
||||
@TableField(exist = false)
|
||||
private String areaName;
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return canteenName;
|
||||
}
|
||||
|
||||
public void setCanteenName(String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return stallName;
|
||||
}
|
||||
|
||||
public void setStallName(String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.menu.domain;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -15,7 +16,6 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
* @date 2025-04-03
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
public class MenuNutrition extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.bonus.canteen.core.menu.domain;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/4/18 9:44
|
||||
*/
|
||||
public class MenuRecipeDetailAndDish {
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
/**
|
||||
* 菜品计划菜品关联对象 menu_recipe_dishes
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
|
|
@ -52,7 +52,7 @@ public class MenuRecipeDishes extends Model<MenuRecipeDishes> {
|
|||
@ApiModelProperty("是否推荐")
|
||||
private Integer recommendFlag;
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNum;
|
||||
private Integer sortNum = -1;
|
||||
@ApiModelProperty("乐观锁")
|
||||
private Integer revision;
|
||||
@TableField(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,148 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class AllocRecipeStallDTO {
|
||||
@ApiModelProperty("区域id")
|
||||
private Long areaId;
|
||||
private List<Long> areaIds;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
private List<Long> canteenIds;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
private List<Long> stallIds;
|
||||
@ApiModelProperty("餐线类型")
|
||||
private Integer mealLineType;
|
||||
@ApiModelProperty("餐线id")
|
||||
private Long mealLineId;
|
||||
@ApiModelProperty("菜谱名称")
|
||||
private String recipeName;
|
||||
@ApiModelProperty("菜谱绑定类型")
|
||||
private Integer bindType;
|
||||
@ApiModelProperty("设备类型")
|
||||
private List<Integer> deviceTypeList;
|
||||
@ApiModelProperty("是否查询餐线")
|
||||
private Integer ifQueryMealLine;
|
||||
private Integer key;
|
||||
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) // for "yyyy-MM-dd" format
|
||||
private LocalDate applyDate;
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public List<Long> getAreaIds() {
|
||||
return this.areaIds;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public List<Long> getCanteenIds() {
|
||||
return this.canteenIds;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public List<Long> getStallIds() {
|
||||
return this.stallIds;
|
||||
}
|
||||
|
||||
public Integer getMealLineType() {
|
||||
return this.mealLineType;
|
||||
}
|
||||
|
||||
public Long getMealLineId() {
|
||||
return this.mealLineId;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return this.recipeName;
|
||||
}
|
||||
|
||||
public Integer getBindType() {
|
||||
return this.bindType;
|
||||
}
|
||||
|
||||
public List<Integer> getDeviceTypeList() {
|
||||
return this.deviceTypeList;
|
||||
}
|
||||
|
||||
public Integer getIfQueryMealLine() {
|
||||
return this.ifQueryMealLine;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public LocalDate getApplyDate() {
|
||||
return this.applyDate;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaIds(final List<Long> areaIds) {
|
||||
this.areaIds = areaIds;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenIds(final List<Long> canteenIds) {
|
||||
this.canteenIds = canteenIds;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setStallIds(final List<Long> stallIds) {
|
||||
this.stallIds = stallIds;
|
||||
}
|
||||
|
||||
public void setMealLineType(final Integer mealLineType) {
|
||||
this.mealLineType = mealLineType;
|
||||
}
|
||||
|
||||
public void setMealLineId(final Long mealLineId) {
|
||||
this.mealLineId = mealLineId;
|
||||
}
|
||||
|
||||
public void setRecipeName(final String recipeName) {
|
||||
this.recipeName = recipeName;
|
||||
}
|
||||
|
||||
public void setBindType(final Integer bindType) {
|
||||
this.bindType = bindType;
|
||||
}
|
||||
|
||||
public void setDeviceTypeList(final List<Integer> deviceTypeList) {
|
||||
this.deviceTypeList = deviceTypeList;
|
||||
}
|
||||
|
||||
public void setIfQueryMealLine(final Integer ifQueryMealLine) {
|
||||
this.ifQueryMealLine = ifQueryMealLine;
|
||||
}
|
||||
|
||||
public void setKey(final Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setApplyDate(final LocalDate applyDate) {
|
||||
this.applyDate = applyDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -126,7 +126,14 @@ public class MenuDishesDTO {
|
|||
@ApiModelProperty("餐次")
|
||||
private List<Integer> mealList;
|
||||
|
||||
private String labelId;
|
||||
private String tasteId;
|
||||
private String seasonId;
|
||||
private String suitId;
|
||||
private String mealId;
|
||||
|
||||
private Integer customId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,27 @@ public class MenuRecipeBindDTO implements Serializable {
|
|||
@ApiModelProperty("餐线id")
|
||||
private Long mealLineId;
|
||||
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
|
||||
public Long getStallId() {
|
||||
return stallId;
|
||||
}
|
||||
|
||||
public void setStallId(Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenId(Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MenuRecipeV2PageDTO {
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("菜谱名称")
|
||||
private String recipeName;
|
||||
@ApiModelProperty("区域Id")
|
||||
private Long areaId;
|
||||
private List<Long> areaIds;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
private List<Long> canteenIds;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
private List<Long> stallIds;
|
||||
@ApiModelProperty("菜谱类型")
|
||||
private Integer recipeType;
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return this.recipeName;
|
||||
}
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public List<Long> getAreaIds() {
|
||||
return this.areaIds;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public List<Long> getCanteenIds() {
|
||||
return this.canteenIds;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public List<Long> getStallIds() {
|
||||
return this.stallIds;
|
||||
}
|
||||
|
||||
public Integer getRecipeType() {
|
||||
return this.recipeType;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setRecipeName(final String recipeName) {
|
||||
this.recipeName = recipeName;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaIds(final List<Long> areaIds) {
|
||||
this.areaIds = areaIds;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenIds(final List<Long> canteenIds) {
|
||||
this.canteenIds = canteenIds;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setStallIds(final List<Long> stallIds) {
|
||||
this.stallIds = stallIds;
|
||||
}
|
||||
|
||||
public void setRecipeType(final Integer recipeType) {
|
||||
this.recipeType = recipeType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
public class StallAndRecipeBindDto {
|
||||
private Long stallId;
|
||||
private Long recipeId;
|
||||
private Integer bindType;
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public Integer getBindType() {
|
||||
return this.bindType;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setBindType(final Integer bindType) {
|
||||
this.bindType = bindType;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import com.bonus.canteen.core.menu.domain.MenuDishesRelation;
|
|||
import com.bonus.canteen.core.menu.dto.MenuDishesAddMaterialDTO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuDishesDTO;
|
||||
import com.bonus.canteen.core.utils.NutritionEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 菜品信息Mapper接口
|
||||
|
|
@ -43,10 +44,10 @@ public interface MenuDishesMapper {
|
|||
/**
|
||||
* 修改菜品信息
|
||||
*
|
||||
* @param menuDishes 菜品信息
|
||||
* @param menuDishesDTO 菜品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenuDishes(MenuDishes menuDishes);
|
||||
public int updateMenuDishes(MenuDishesDTO menuDishesDTO);
|
||||
|
||||
/**
|
||||
* 删除菜品信息
|
||||
|
|
@ -62,17 +63,22 @@ public interface MenuDishesMapper {
|
|||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuDishesByIds(Long[] ids);
|
||||
public int deleteMenuDishesByIds(@Param("dishesIds") Long[] ids);
|
||||
List<Long> getBassIdByDishesId(@Param("dishesIds") Long[] ids);
|
||||
|
||||
int deleteBaseDishesByIds(@Param("baseDishesIds") Long[] ids);
|
||||
|
||||
List<MapBean> getDishesType(MapBean mapBean);
|
||||
|
||||
MenuDishes getOne(MenuDishesDTO menuDishesDTO);
|
||||
|
||||
int addMenuDishesBase(MenuDishesDTO menuDishesDTO);
|
||||
int updateMenuDishesBase(MenuDishesDTO menuDishesDTO);
|
||||
|
||||
int addMenuDishes(MenuDishesDTO menuDishesDTO);
|
||||
|
||||
int editMenuDishes(MenuDishesDTO menuDishesDTO);
|
||||
NutritionEntity getNutritionEntity(MenuDishesAddMaterialDTO dto);
|
||||
|
||||
int addFinalNutrition(NutritionEntity nutritionEntity);
|
||||
int addFinalNutrition(@Param("nutritionEntity") NutritionEntity nutritionEntity,@Param("dishesId") Long dishesId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
* @return 菜品计划信息集合
|
||||
*/
|
||||
public List<MenuRecipeVO> selectMenuRecipeList(MenuRecipe menuRecipe);
|
||||
public List<AllocRecipeStallVO> selectMenuRecipeListV2(AllocRecipeStallDTO menuRecipe);
|
||||
|
||||
List<StallAndRecipeBindDto> selectRecipeByStallIdsAndBindType(@Param("stallIds") List<Long> stallIds, @Param("bindType") Integer bindType);
|
||||
|
||||
List<MenuRecipeDateVO> selectTmpBetweenDateDetailList(@Param("recipeIds") List<Long> recipeIds, @Param("applyStartDate") LocalDate applyStartDate, @Param("applyEndDate") LocalDate applyEndDate);
|
||||
|
||||
List<MenuRecipeDishesVO>getDishesListByDetailId(String detailsId);
|
||||
|
||||
|
|
@ -110,6 +115,8 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
*/
|
||||
List<RecipeDishesCountDTO> getDishesCountByRecipeIds(@Param("recipeIds") List<Long> recipeIds);
|
||||
|
||||
List<MenuRecipeDetail> getMenuDishDeatilList(@Param("recipeIds") List<Long> recipeIds);
|
||||
|
||||
/**
|
||||
* 根据recipeIds获取日期
|
||||
*
|
||||
|
|
@ -217,4 +224,10 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
List<MealTimeVO> getMealTimeList(Long stallId);
|
||||
|
||||
List<DeviceMealtimeVO> getBasicsTimeIntervals(Long stallId);
|
||||
|
||||
|
||||
List<MenuRecipeDetail> MenuRecipeDetailList(Long recipeId);
|
||||
|
||||
|
||||
List<MenuRecipeV2PageVO> getMenuRecipeList(MenuRecipeV2PageDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ public interface IMenuDishesService {
|
|||
/**
|
||||
* 修改菜品信息
|
||||
*
|
||||
* @param menuDishes 菜品信息
|
||||
* @param menuDishesDTO 菜品信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenuDishes(MenuDishes menuDishes);
|
||||
public int updateMenuDishes(MenuDishesDTO menuDishesDTO);
|
||||
|
||||
/**
|
||||
* 批量删除菜品信息
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ import java.util.List;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipe;
|
||||
import com.bonus.canteen.core.menu.dto.*;
|
||||
import com.bonus.canteen.core.menu.vo.AllocRecipeStallVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO;
|
||||
import com.bonus.canteen.core.menu.dto.MenuRecipeBindDTO;
|
||||
import com.bonus.canteen.core.menu.vo.*;
|
||||
import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO;
|
||||
|
|
@ -41,6 +46,9 @@ public interface IMenuRecipeService extends IService<MenuRecipe> {
|
|||
public List<MenuRecipeVO> selectMenuRecipeList(MenuRecipe menuRecipe);
|
||||
AjaxResult getDishesList(MenuRecipeParamDTO dto);
|
||||
|
||||
AjaxResult getDishesListV2(MenuRecipeV2PageDTO dto);
|
||||
|
||||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*
|
||||
|
|
@ -95,4 +103,6 @@ public interface IMenuRecipeService extends IService<MenuRecipe> {
|
|||
IssueRecipeCompressVO getMenuInfoBySn(String machineSn);
|
||||
|
||||
DviceTimeIntervalVO intervalConfig(String machineSn);
|
||||
|
||||
List<AllocRecipeStallVO> selectMenuRecipeListV2(AllocRecipeStallDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.lang.reflect.Method;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.bonus.canteen.core.menu.domain.MapBean;
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishesRelation;
|
||||
|
|
@ -84,17 +85,53 @@ public class MenuDishesServiceImpl implements IMenuDishesService {
|
|||
/**
|
||||
* 修改菜品信息
|
||||
*
|
||||
* @param menuDishes 菜品信息
|
||||
* @param menuDishesDTO 菜品信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenuDishes(MenuDishes menuDishes) {
|
||||
menuDishes.setUpdateTime(LocalDateTime.now());
|
||||
try {
|
||||
return menuDishesMapper.updateMenuDishes(menuDishes);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
public int updateMenuDishes(MenuDishesDTO menuDishesDTO) {
|
||||
// try {
|
||||
if(menuDishesDTO.getDishesId() == null){
|
||||
throw new ServiceException("菜品ID不能为空");
|
||||
}
|
||||
if(menuDishesDTO.getBaseDishesId() == null){
|
||||
throw new ServiceException("菜品基础ID不能为空");
|
||||
}
|
||||
MenuDishes menuDishesOne = menuDishesMapper.getOne(menuDishesDTO);
|
||||
if(menuDishesOne !=null && !String.valueOf(menuDishesOne.getDishesId()).equals(menuDishesDTO.getDishesId())){
|
||||
throw new ServiceException("菜品已存在");
|
||||
}
|
||||
addIds(menuDishesDTO);
|
||||
menuDishesDTO.setUpdateBy(SecurityUtils.getUsername());
|
||||
int baseNum = menuDishesMapper.updateMenuDishesBase(menuDishesDTO);
|
||||
int dishesNum = menuDishesMapper.editMenuDishes(menuDishesDTO);
|
||||
List<MenuDishesAddMaterialDTO> materialList= menuDishesDTO.getMaterialList();
|
||||
List<NutritionEntity> nutritionEntityList = new ArrayList<>();
|
||||
System.err.println("长度:"+materialList.size());
|
||||
for (MenuDishesAddMaterialDTO i: materialList) {
|
||||
NutritionEntity nutritionEntity = menuDishesMapper.getNutritionEntity(i);
|
||||
if(nutritionEntity !=null){
|
||||
System.err.println(i.getMaterialId()+",开始值:"+nutritionEntity.getCalcium());
|
||||
nutritionEntity.setWeight(i.getWeight());
|
||||
nutritionEntity.setBaseWeight(100.0);
|
||||
nutritionEntityList.add(nutritionEntity);
|
||||
}
|
||||
}
|
||||
NutritionEntityUtil nutritionEntityUtil = new NutritionEntityUtil();
|
||||
NutritionEntity nutritionEntity = nutritionEntityUtil.countNutrition(nutritionEntityList);
|
||||
if(nutritionEntityList !=null && nutritionEntityList.size() >0){
|
||||
System.err.println("总和:"+nutritionEntity.getCalcium());
|
||||
//计算营养成分
|
||||
nutritionEntity = countNum(nutritionEntity,menuDishesDTO.getWeight());
|
||||
System.err.println("计算后:"+nutritionEntity.getCalcium());
|
||||
return menuDishesMapper.addFinalNutrition(nutritionEntity,Long.parseLong(menuDishesDTO.getDishesId()));
|
||||
}
|
||||
|
||||
|
||||
return menuDishesMapper.editMenuDishes(menuDishesDTO);
|
||||
// } catch (Exception e) {
|
||||
// throw new ServiceException(e.toString());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -105,6 +142,11 @@ public class MenuDishesServiceImpl implements IMenuDishesService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteMenuDishesByIds(Long[] ids) {
|
||||
List<Long> baseDishesIds = menuDishesMapper.getBassIdByDishesId(ids);
|
||||
if(baseDishesIds != null && baseDishesIds.size() >0){
|
||||
menuDishesMapper.deleteBaseDishesByIds(baseDishesIds.toArray(new Long[baseDishesIds.size()]));
|
||||
}
|
||||
|
||||
return menuDishesMapper.deleteMenuDishesByIds(ids);
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +182,7 @@ public class MenuDishesServiceImpl implements IMenuDishesService {
|
|||
menuDishesDTO.setBaseDishesId(baseDishesId+"");
|
||||
menuDishesDTO.setDishesId(dishesId+"");
|
||||
menuDishesDTO.setCustomId(-1);
|
||||
addIds(menuDishesDTO);
|
||||
int baseNum = menuDishesMapper.addMenuDishesBase(menuDishesDTO);
|
||||
//添加主要信息
|
||||
int dishesNum = menuDishesMapper.addMenuDishes(menuDishesDTO);
|
||||
|
|
@ -163,11 +206,46 @@ public class MenuDishesServiceImpl implements IMenuDishesService {
|
|||
//计算营养成分
|
||||
nutritionEntity = countNum(nutritionEntity,menuDishesDTO.getWeight());
|
||||
System.err.println("计算后:"+nutritionEntity.getCalcium());
|
||||
return menuDishesMapper.addFinalNutrition(nutritionEntity);
|
||||
return menuDishesMapper.addFinalNutrition(nutritionEntity,dishesId);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void addIds(MenuDishesDTO menuDishesDTO){
|
||||
|
||||
List<Integer> labelIdList = menuDishesDTO.getLabelIdList();
|
||||
|
||||
List<Integer> tasteIdList = menuDishesDTO.getTasteIdList();
|
||||
|
||||
List<Integer> season = menuDishesDTO.getSeason();
|
||||
|
||||
List<Integer> suitIdList = menuDishesDTO.getSuitIdList();
|
||||
|
||||
List<Integer> mealList = menuDishesDTO.getMealList();
|
||||
|
||||
if(labelIdList !=null && !labelIdList.isEmpty()){
|
||||
String result = labelIdList.stream() .map(String::valueOf).collect(Collectors.joining(","));
|
||||
menuDishesDTO.setLabelId(result);
|
||||
}
|
||||
if(tasteIdList !=null && !tasteIdList.isEmpty()){
|
||||
String result = tasteIdList.stream() .map(String::valueOf).collect(Collectors.joining(","));
|
||||
menuDishesDTO.setTasteId(result);
|
||||
}
|
||||
if(season !=null && !season.isEmpty()){
|
||||
String result = season.stream() .map(String::valueOf).collect(Collectors.joining(","));
|
||||
menuDishesDTO.setSeasonId(result);
|
||||
}
|
||||
if(suitIdList !=null && !suitIdList.isEmpty()){
|
||||
String result = suitIdList.stream() .map(String::valueOf).collect(Collectors.joining(","));
|
||||
menuDishesDTO.setSuitId(result);
|
||||
}
|
||||
if(mealList !=null && !mealList.isEmpty()){
|
||||
String result = mealList.stream() .map(String::valueOf).collect(Collectors.joining(","));
|
||||
menuDishesDTO.setMealId(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private NutritionEntity countNum(NutritionEntity nutritionEntity,Double weight) {
|
||||
Field[] fields = nutritionEntity.getClass().getDeclaredFields();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class MenuMaterialCategoryServiceImpl extends ServiceImpl<MenuMaterialCat
|
|||
Long countParent = this.baseMapper.selectCount(Wrappers.lambdaQuery(MenuMaterialCategory.class)
|
||||
.eq(MenuMaterialCategory::getCategoryId, parentId));
|
||||
if (ObjectUtil.isNull(countParent) || countParent <= 0L) {
|
||||
throw new ServiceException(I18n.getMessage("menu_parent_type_not_exist", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("菜单无父级节点", new Object[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import com.bonus.canteen.core.menu.model.*;
|
|||
import com.bonus.canteen.core.menu.service.IMenuRecipeService;
|
||||
import com.bonus.canteen.core.menu.vo.*;
|
||||
import com.bonus.canteen.core.utils.BnsConstants;
|
||||
import com.bonus.canteen.core.utils.CurrentToNextSunday;
|
||||
import com.bonus.canteen.core.utils.DeviceMqMessage;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDataVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO;
|
||||
|
|
@ -128,10 +129,72 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
return menuRecipeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AllocRecipeStallVO> selectMenuRecipeListV2(AllocRecipeStallDTO content) {
|
||||
Map<Integer, MenuRecipeSortEnum> bindTypeMap = MenuRecipeSortEnum.getKeyMap();
|
||||
MenuRecipeSortEnum sortEnum = bindTypeMap.get(content.getKey());
|
||||
List<AllocRecipeStallVO> records = new ArrayList<>();
|
||||
if (ObjectUtil.isEmpty(sortEnum)) {
|
||||
throw new ServiceException(I18n.getMessage("参数错误", new Object[0]));
|
||||
}else{
|
||||
content.setDeviceTypeList(sortEnum.getDeviceType());
|
||||
content.setBindType(sortEnum.getBindType());
|
||||
records = menuRecipeMapper.selectMenuRecipeListV2(content);
|
||||
if (ObjectUtil.isNotEmpty(records)) {
|
||||
List<Long> recipeIds;
|
||||
Map<Long ,Long> maping;
|
||||
List<Long> menuRecipeDateVOS;
|
||||
menuRecipeDateVOS = records.stream().map(AllocRecipeStallVO::getStallId).collect(Collectors.toList());
|
||||
List<StallAndRecipeBindDto> stallAndRecipeBindDtos = this.menuRecipeMapper.selectRecipeByStallIdsAndBindType(menuRecipeDateVOS, content.getBindType());
|
||||
maping = stallAndRecipeBindDtos.stream().collect(Collectors.toMap(StallAndRecipeBindDto::getStallId, StallAndRecipeBindDto::getRecipeId));
|
||||
recipeIds = stallAndRecipeBindDtos.stream().map(StallAndRecipeBindDto::getRecipeId).distinct().collect(Collectors.toList());
|
||||
this.generateRecipe(recipeIds, content.getApplyDate());
|
||||
List<MenuRecipeDateVO> menuRecipeDateVOS1 = this.menuRecipeMapper.selectTmpBetweenDateDetailList(recipeIds, content.getApplyDate(), content.getApplyDate());
|
||||
Map<Long, MenuRecipe> recipeMap = (recipeIds == null || recipeIds.isEmpty())
|
||||
? new HashMap<>()
|
||||
: this.list(Wrappers.lambdaQuery(MenuRecipe.class)
|
||||
.in(MenuRecipe::getRecipeId, recipeIds))
|
||||
.stream()
|
||||
.collect(Collectors.toMap(MenuRecipe::getRecipeId, Function.identity()));
|
||||
Map<Long, MenuRecipeDateVO> detailMap = menuRecipeDateVOS1.stream().collect(Collectors.toMap(MenuRecipeDateVO::getRecipeId, Function.identity(), (t1, t2) -> {
|
||||
return t1;
|
||||
}));
|
||||
|
||||
AllocRecipeStallVO item;
|
||||
long count;
|
||||
for(Iterator<AllocRecipeStallVO> var12 = records.iterator(); var12.hasNext(); item.setDishesCount(count)) {
|
||||
item = var12.next();
|
||||
Long recipeId;
|
||||
recipeId = maping.get(item.getStallId());
|
||||
|
||||
item.setRecipeId(recipeId);
|
||||
item.setDetail(detailMap.get(recipeId));
|
||||
item.setRecipeName(Optional.ofNullable(recipeMap.get(recipeId)).map(MenuRecipe::getRecipeName).orElse(null));
|
||||
// item.setUptime(Optional.ofNullable(recipeMap.get(recipeId)).map(MenuRecipe::getUptime).orElse(null));
|
||||
count = 0L;
|
||||
if (ObjectUtil.isNotEmpty(item.getDetail()) && ObjectUtil.isNotEmpty(item.getDetail().getDetails())) {
|
||||
count = item.getDetail().getDetails().stream().filter((x) -> {
|
||||
return ObjectUtil.isNotEmpty(x.getDishesList());
|
||||
}).flatMap((x) -> {
|
||||
return x.getDishesList().stream();
|
||||
}).map(MenuRecipeDetailDishesVO::getDishesId).distinct().count();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindAppRecipe(MenuRecipeBindDTO content) {
|
||||
MenuRecipe menuRecipe = this.menuRecipeMapper.selectMenuRecipe(content.getRecipeId());
|
||||
if(content.getStallId() !=null && content.getCanteenId() !=null){
|
||||
List<Integer> deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(content.getCanteenId()), String.valueOf(content.getStallId()));
|
||||
if(deviceInfoList == null || deviceInfoList.isEmpty()){
|
||||
throw new ServiceException(I18n.getMessage("该食堂档口下没有设备信息", new Object[0]));
|
||||
}
|
||||
}
|
||||
MenuRecipeSortEnum sortEnum = MenuRecipeSortEnum.getBindTypeMap().get(content.getBindType());
|
||||
MenuAppRecipe mar = new MenuAppRecipe();
|
||||
mar.setRecipeId(content.getRecipeId());
|
||||
|
|
@ -152,7 +215,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
}
|
||||
exists = this.menuRecipeMapper.exists(mar);
|
||||
if (exists) {
|
||||
throw new ServiceException(I18n.getMessage("menu_recipe_issue_repeat", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("菜谱已被使用,请勿重复绑定", new Object[0]));
|
||||
}
|
||||
List<Long> sourceRecipeList = this.menuRecipeMapper.selectRecipeInSameShop(menuRecipe.getStallId(), null, content.getBindType(), content.getMealLineId());
|
||||
if (ObjectUtil.isNotEmpty(sourceRecipeList)) {
|
||||
|
|
@ -319,6 +382,15 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDishesListV2(MenuRecipeV2PageDTO dto) {
|
||||
|
||||
List<MenuRecipeV2PageVO> list = menuRecipeMapper.getMenuRecipeList(dto);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜品计划信息
|
||||
*
|
||||
|
|
@ -372,10 +444,24 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
result.setMenuRecipe(recipe);
|
||||
result.setAdd(add);
|
||||
this.processResult(result);
|
||||
|
||||
return recipeId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addReplaceDishes( Long recipeId) {
|
||||
|
||||
//获取当前日期后的日期
|
||||
Map<DayOfWeek, CurrentToNextSunday.DateInfo> dateMap = CurrentToNextSunday.getDatesFromTodayToNextSunday(LocalDate.now());
|
||||
|
||||
List<MenuRecipeDetail> menuRecipeDetailList = menuRecipeMapper.MenuRecipeDetailList(recipeId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuRecipeDetailDateVO> getDetail(MenuRecipeParamDTO dto) {
|
||||
return this.menuRecipeMapper.getDetail(dto);
|
||||
|
|
@ -387,9 +473,9 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
Integer recipeMacBindNumber = this.menuRecipeMapper.getRecipeBindCount(recipeId);
|
||||
int appCount = this.menuRecipeMapper.selectMenuAppRecipeCount(recipeId);
|
||||
if (recipeMacBindNumber > 0) {
|
||||
throw new ServiceException(I18n.getMessage("menu_recipe_mac_bind_del", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("设备已被绑定", new Object[0]));
|
||||
} else if (appCount > 0) {
|
||||
throw new ServiceException(I18n.getMessage("menu_recipe_applet_bind_del", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("菜谱已绑定设备", new Object[0]));
|
||||
} else {
|
||||
// this.baseMapper.delete( Wrappers.lambdaUpdate(MenuRecipe.class)
|
||||
// .in(MenuRecipe::getRecipeId, recipeId));
|
||||
|
|
@ -908,7 +994,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
.map(MenuRecipeDateAddDTO::getDetailList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDetailAddDTO::getMealtimeType)
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null")));
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("详情id为空")));
|
||||
}
|
||||
return menuRecipeMapper.selectDetailIds(getRecipeDto, mealType);
|
||||
}
|
||||
|
|
@ -924,7 +1010,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
.map(MenuRecipeDateAddDTO::getDetailList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDetailAddDTO::getMealtimeType)
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null")));
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("详情id为空")));
|
||||
}
|
||||
return this.menuRecipeMapper.selectDetailsList(getRecipeDto, LocalDate.now(), mealType);
|
||||
}
|
||||
|
|
@ -1126,7 +1212,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
return x.getSizeType() != 3L;
|
||||
}).count();
|
||||
if (count > 99L) {
|
||||
throw new ServiceException(I18n.getMessage("menu_issue_dishes_max", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("菜谱信息达到上限", new Object[0]));
|
||||
} else {
|
||||
dishesList.stream().filter((x) -> {
|
||||
return x.getSizeType() == 3L;
|
||||
|
|
@ -1137,7 +1223,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
return Integer.valueOf(1).equals(d.getRecommendFlag());
|
||||
}).count();
|
||||
if (dishesCount > 3L) {
|
||||
throw new ServiceException(I18n.getMessage("menu_recommend_dishes_over_three", new Object[0]));
|
||||
throw new ServiceException(I18n.getMessage("无推荐菜谱", new Object[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,146 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDateVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AllocRecipeStallVO {
|
||||
@ApiModelProperty("区域id")
|
||||
private Long areaId;
|
||||
@ApiModelProperty("当前区域名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
@ApiModelProperty("食堂名称")
|
||||
private String canteenName;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
@ApiModelProperty("档口名称")
|
||||
private String stallName;
|
||||
@ApiModelProperty("餐线类型")
|
||||
private Integer mealLineType;
|
||||
@ApiModelProperty("餐线id")
|
||||
private Long mealLineId;
|
||||
@ApiModelProperty("餐线名称")
|
||||
private String mealLineName;
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("菜谱名称")
|
||||
private String recipeName;
|
||||
private Long DishesCount;
|
||||
private MenuRecipeDateVO detail;
|
||||
private LocalDateTime uptime;
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return this.areaName;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return this.canteenName;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return this.stallName;
|
||||
}
|
||||
|
||||
public Integer getMealLineType() {
|
||||
return this.mealLineType;
|
||||
}
|
||||
|
||||
public Long getMealLineId() {
|
||||
return this.mealLineId;
|
||||
}
|
||||
|
||||
public String getMealLineName() {
|
||||
return this.mealLineName;
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return this.recipeName;
|
||||
}
|
||||
|
||||
public Long getDishesCount() {
|
||||
return this.DishesCount;
|
||||
}
|
||||
|
||||
public MenuRecipeDateVO getDetail() {
|
||||
return this.detail;
|
||||
}
|
||||
|
||||
public LocalDateTime getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaName(final String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenName(final String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setStallName(final String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public void setMealLineType(final Integer mealLineType) {
|
||||
this.mealLineType = mealLineType;
|
||||
}
|
||||
|
||||
public void setMealLineId(final Long mealLineId) {
|
||||
this.mealLineId = mealLineId;
|
||||
}
|
||||
|
||||
public void setMealLineName(final String mealLineName) {
|
||||
this.mealLineName = mealLineName;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setRecipeName(final String recipeName) {
|
||||
this.recipeName = recipeName;
|
||||
}
|
||||
|
||||
public void setDishesCount(final Long DishesCount) {
|
||||
this.DishesCount = DishesCount;
|
||||
}
|
||||
|
||||
public void setDetail(final MenuRecipeDateVO detail) {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public void setUptime(final LocalDateTime uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class MenuRecipeDateVO {
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate day;
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("数据详情")
|
||||
private List<MenuRecipeDetailDateVO> details;
|
||||
|
||||
public LocalDate getDay() {
|
||||
return this.day;
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public List<MenuRecipeDetailDateVO> getDetails() {
|
||||
return this.details;
|
||||
}
|
||||
|
||||
public void setDay(final LocalDate day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setDetails(final List<MenuRecipeDetailDateVO> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
package com.bonus.canteen.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("菜谱计划发布记录列表")
|
||||
public class MenuRecipeV2PageVO {
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
@ApiModelProperty("菜谱类型")
|
||||
private Integer recipeType;
|
||||
@ApiModelProperty("菜谱名称")
|
||||
private String recipeName;
|
||||
@ApiModelProperty("区域id")
|
||||
private Long areaId;
|
||||
@ApiModelProperty("区域名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
@ApiModelProperty("食堂名称")
|
||||
private String canteenName;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
@ApiModelProperty("档口名称")
|
||||
private String stallName;
|
||||
@ApiModelProperty("菜品数量")
|
||||
private Integer dishesCount;
|
||||
@ApiModelProperty("生效范围id")
|
||||
private Long effId;
|
||||
@ApiModelProperty("生效范围名称")
|
||||
private String effName;
|
||||
@ApiModelProperty("创建人")
|
||||
private String crby;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime crtime;
|
||||
@ApiModelProperty("已排菜日期")
|
||||
private List<LocalDate> applyDateList;
|
||||
@ApiModelProperty("已排菜日期(月-日)")
|
||||
private List<String> applyDateStringList;
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public Integer getRecipeType() {
|
||||
return this.recipeType;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return this.recipeName;
|
||||
}
|
||||
|
||||
public Long getAreaId() {
|
||||
return this.areaId;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return this.areaName;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return this.canteenName;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return this.stallName;
|
||||
}
|
||||
|
||||
public Integer getDishesCount() {
|
||||
return this.dishesCount;
|
||||
}
|
||||
|
||||
public Long getEffId() {
|
||||
return this.effId;
|
||||
}
|
||||
|
||||
public String getEffName() {
|
||||
return this.effName;
|
||||
}
|
||||
|
||||
public String getCrby() {
|
||||
return this.crby;
|
||||
}
|
||||
|
||||
public LocalDateTime getCrtime() {
|
||||
return this.crtime;
|
||||
}
|
||||
|
||||
public List<LocalDate> getApplyDateList() {
|
||||
return this.applyDateList;
|
||||
}
|
||||
|
||||
public List<String> getApplyDateStringList() {
|
||||
return this.applyDateStringList;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setRecipeType(final Integer recipeType) {
|
||||
this.recipeType = recipeType;
|
||||
}
|
||||
|
||||
public void setRecipeName(final String recipeName) {
|
||||
this.recipeName = recipeName;
|
||||
}
|
||||
|
||||
public void setAreaId(final Long areaId) {
|
||||
this.areaId = areaId;
|
||||
}
|
||||
|
||||
public void setAreaName(final String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenName(final String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setStallName(final String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public void setDishesCount(final Integer dishesCount) {
|
||||
this.dishesCount = dishesCount;
|
||||
}
|
||||
|
||||
public void setEffId(final Long effId) {
|
||||
this.effId = effId;
|
||||
}
|
||||
|
||||
public void setEffName(final String effName) {
|
||||
this.effName = effName;
|
||||
}
|
||||
|
||||
public void setCrby(final String crby) {
|
||||
this.crby = crby;
|
||||
}
|
||||
|
||||
public void setCrtime(final LocalDateTime crtime) {
|
||||
this.crtime = crtime;
|
||||
}
|
||||
|
||||
public void setApplyDateList(final List<LocalDate> applyDateList) {
|
||||
this.applyDateList = applyDateList;
|
||||
}
|
||||
|
||||
public void setApplyDateStringList(final List<String> applyDateStringList) {
|
||||
this.applyDateStringList = applyDateStringList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.bonus.canteen.core.utils;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/4/17 18:45
|
||||
*/
|
||||
public class CurrentToNextSunday {
|
||||
public static void main(String[] args) {
|
||||
// 假设今天是周四(可以替换为LocalDate.now()获取真实当前日期)
|
||||
LocalDate today = LocalDate.of(2025, 4, 26); // 2025-04-17 周四
|
||||
System.out.println("当前日期: " + today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
|
||||
// 获取从今天到下周日的日期信息
|
||||
Map<DayOfWeek, DateInfo> dateMap = getDatesFromTodayToNextSunday(today);
|
||||
|
||||
// 打印结果
|
||||
System.out.println("\n从今天到下周日的日期信息:");
|
||||
System.out.println("星期\t日期\t\t天数差");
|
||||
dateMap.forEach((day, info) ->
|
||||
System.out.printf("%s\t%s\t%s%n",
|
||||
getChineseWeekday(day),
|
||||
info.date.format(DateTimeFormatter.ISO_LOCAL_DATE),
|
||||
formatDayDifference(info.difference))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取从今天到下周日的日期信息
|
||||
* @param today 当前日期(周四)
|
||||
* @return 有序的日期信息Map
|
||||
*/
|
||||
public static Map<DayOfWeek, DateInfo> getDatesFromTodayToNextSunday(LocalDate today) {
|
||||
Map<DayOfWeek, DateInfo> result = new LinkedHashMap<>();
|
||||
|
||||
// 获取下周日日期
|
||||
LocalDate nextSunday = today.with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
|
||||
|
||||
// 从今天开始,直到下周日,逐个日期处理
|
||||
LocalDate currentDate = today;
|
||||
while (!currentDate.isAfter(nextSunday)) {
|
||||
long difference = currentDate.toEpochDay() - today.toEpochDay();
|
||||
result.put(currentDate.getDayOfWeek(), new DateInfo(currentDate, difference));
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 以下辅助方法与之前相同
|
||||
private static String getChineseWeekday(DayOfWeek day) {
|
||||
switch (day) {
|
||||
case MONDAY: return "周一";
|
||||
case TUESDAY: return "周二";
|
||||
case WEDNESDAY: return "周三";
|
||||
case THURSDAY: return "周四";
|
||||
case FRIDAY: return "周五";
|
||||
case SATURDAY: return "周六";
|
||||
case SUNDAY: return "周日";
|
||||
default: return day.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static String formatDayDifference(long difference) {
|
||||
if (difference == 0) return "今天";
|
||||
else if (difference < 0) return Math.abs(difference) + "天前";
|
||||
else return difference + "天后";
|
||||
}
|
||||
|
||||
public static class DateInfo {
|
||||
LocalDate date;
|
||||
long difference;
|
||||
|
||||
DateInfo(LocalDate date, long difference) {
|
||||
this.date = date;
|
||||
this.difference = difference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -114,13 +114,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where
|
||||
bind_type = 3
|
||||
and mr.eff_id in
|
||||
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
|
||||
#{effId}
|
||||
</foreach>
|
||||
<if test="recipeId != null">
|
||||
and mar.recipe_id = #{recipeId}
|
||||
</if>
|
||||
<!-- and mr.eff_id in-->
|
||||
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
|
||||
<!-- #{effId}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- <if test="recipeId != null">-->
|
||||
<!-- and mar.recipe_id = #{recipeId}-->
|
||||
<!-- </if>-->
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -81,12 +81,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="remark" column="remark" />
|
||||
<result property="typeName" column="type_name" />
|
||||
|
||||
<result property="areaName" column="area_name" />
|
||||
<result property="canteenName" column="canteen_name" />
|
||||
<result property="stallName" column="stall_name" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMenuDishesVo">
|
||||
select b.*,a.type_name
|
||||
select b.*,a.type_name,aa.area_name,ac.canteen_name,als.stall_name
|
||||
from menu_dishes b
|
||||
LEFT JOIN menu_dishes_type a on a.type_id = b.type_id
|
||||
LEFT JOIN alloc_area aa on aa.area_id = b.area_id
|
||||
LEFT JOIN alloc_canteen ac on ac.canteen_id = b.canteen_id
|
||||
LEFT JOIN alloc_stall als on als.stall_id = b.shopstall_id
|
||||
</sql>
|
||||
|
||||
<select id="selectMenuDishesList" parameterType="com.bonus.canteen.core.menu.domain.MenuDishes" resultMap="MenuDishesResult">
|
||||
|
|
@ -350,13 +357,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<delete id="deleteMenuDishesById" parameterType="Long">
|
||||
delete from menu_dishes where id = #{id}
|
||||
delete from menu_dishes where dishes_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMenuDishesByIds" parameterType="String">
|
||||
delete from menu_dishes where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
<delete id="deleteMenuDishesByIds" parameterType="long">
|
||||
delete from menu_dishes where dishes_id in
|
||||
<foreach collection="dishesIds" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getBassIdByDishesId" resultType="long">
|
||||
select base_dishes_id from menu_dishes where dishes_id in
|
||||
<foreach collection="dishesIds" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteBaseDishesByIds">
|
||||
delete from menu_dishes_base where base_dishes_id in
|
||||
<foreach collection="baseDishesIds" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
|
@ -410,6 +431,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null">create_by,</if>
|
||||
<if test="customId != null">custom_id,</if>
|
||||
<if test="typeId != null">type_id,</if>
|
||||
|
||||
<if test="labelId != null">label_id,</if>
|
||||
<if test="tasteId != null">taste_id,</if>
|
||||
<if test="seasonId != null">season_id,</if>
|
||||
<if test="suitId != null">suit_id,</if>
|
||||
<if test="mealId != null">meal_id,</if>
|
||||
|
||||
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
|
|
@ -433,6 +463,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="customId != null">#{customId},</if>
|
||||
<if test="typeId != null">#{typeId},</if>
|
||||
|
||||
<if test="labelId != null">#{labelId},</if>
|
||||
<if test="tasteId != null">#{tasteId},</if>
|
||||
<if test="seasonId != null">#{seasonId},</if>
|
||||
<if test="suitId != null">#{suitId},</if>
|
||||
<if test="mealId != null">#{mealId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -441,19 +477,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
cholesterol,calcium,sodium,purine,iron,
|
||||
iodine,kalium,vitamin_a as vitaminA,vitamin_c as vitaminC,vitamin_e as vitaminE,
|
||||
magnesium,zinc,glycemic_index as glycemicIndex
|
||||
from menu_nutrition where nutrition_id = #{materialId}
|
||||
from menu_material_nutrition where material_id = #{materialId}
|
||||
</select>
|
||||
|
||||
<select id="addFinalNutrition" resultType="int">
|
||||
|
||||
update menu_nutrition set
|
||||
dible = #{dible}, water =#{water},calories =#{calories}, protein =#{protein}, fat =#{fat},
|
||||
carbohydrate =#{carbohydrate}, dietary_fiber =#{dietaryFiber}, cholesterol =#{cholesterol}, ash =#{ash}, vitamin_a =#{vitaminA},
|
||||
carotene =#{carotene}, thiamine =#{thiamine}, riboflavin =#{riboflavin}, niacin =#{niacin}, vitamin_c =#{vitaminC},
|
||||
vitamin_d =#{vitaminD}, vitamin_e =#{vitaminE}, choline =#{choline}, biotin =#{biotin},
|
||||
pantothenic_acid =#{pantothenicAcid}, guanine =#{guanine}, adenine =#{adenine}, hypoxanthine =#{hypoxanthine},
|
||||
xanthine =#{xanthine}, purine =#{purine}, glycemic_index =#{glycemicIndex}
|
||||
where nutrition_id = #{nutritionId}
|
||||
update menu_dishes set
|
||||
calories =#{nutritionEntity.calories}, protein =#{nutritionEntity.protein}, fat =#{nutritionEntity.fat},
|
||||
carbohydrate =#{nutritionEntity.carbohydrate}, dietary_fiber =#{nutritionEntity.dietaryFiber}, cholesterol =#{nutritionEntity.cholesterol}, vitamin_a =#{nutritionEntity.vitaminA},
|
||||
vitamin_c =#{nutritionEntity.vitaminC},
|
||||
vitamin_e =#{nutritionEntity.vitaminE}, purine =#{nutritionEntity.purine}, glycemic_index =#{nutritionEntity.glycemicIndex}
|
||||
where dishes_id = #{dishesId}
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateMenuDishesBase" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO">
|
||||
update menu_dishes_base set dishes_name = #{dishesName},update_by = #{updateBy}
|
||||
where base_dishes_id = #{baseDishesId}
|
||||
</update>
|
||||
|
||||
<update id="editMenuDishes" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO">
|
||||
update menu_dishes
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sizeType != null">size_type = #{sizeType},</if>
|
||||
<if test="materialCost != null">material_cost = #{materialCost},</if>
|
||||
<if test="publicDishes != null">public_dishes = #{publicDishes},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="canteenId != null">canteen_id =#{canteenId},</if>
|
||||
<if test="shopstallId != null">shopstall_id =#{shopstallId},</if>
|
||||
<if test="dishesNum != null">dishes_num = #{dishesNum},</if>
|
||||
<if test="dishesName != null">dishes_name = #{dishesName},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="weightDeviation != null">weight_deviation = #{weightDeviation},</if>
|
||||
<if test="imageUrl != null">image_url = #{imageUrl},</if>
|
||||
<if test="effectId != null">effect_id = #{effectId},</if>
|
||||
<if test="styleId != null">style_id = #{styleId},</if>
|
||||
<if test="cookId != null">cook_id = #{cookId},</if>
|
||||
<if test="classifyId != null">classify_id = #{classifyId},</if>
|
||||
<if test="customId != null">custom_id = #{customId},</if>
|
||||
<if test="typeId != null">type_id = #{typeId},</if>
|
||||
|
||||
<if test="labelId != null">label_id = #{labelId},</if>
|
||||
<if test="tasteId != null">taste_id = #{tasteId},</if>
|
||||
<if test="seasonId != null">season_id = #{seasonId},</if>
|
||||
<if test="suitId != null">suit_id = #{suitId},</if>
|
||||
<if test="mealId != null">meal_id = #{mealId},</if>
|
||||
</trim>
|
||||
|
||||
where dishes_id = #{dishesId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
<if test="nutritionCode != null and nutritionCode != ''"> and nutrition_code like concat('%', #{nutritionCode}, '%')</if>
|
||||
<if test="nutritionName != null and nutritionName != ''"> and nutrition_name like concat('%', #{nutritionName}, '%')</if>
|
||||
<if test="bigType != null and bigType != ''"> and big_type = #{bigType}</if>
|
||||
<if test="littleType != null and littleType != ''"> and little_type = #{littleType}</if>
|
||||
<if test="categoryId != null and categoryId != ''"> and category_id = #{categoryId}</if>
|
||||
<!-- <if test="bigType != null and bigType != ''"> and big_type = #{bigType}</if>-->
|
||||
<!-- <if test="littleType != null and littleType != ''"> and little_type = #{littleType}</if>-->
|
||||
<!-- <if test="categoryId != null and categoryId != ''"> and category_id = #{categoryId}</if>-->
|
||||
<if test="categoryIds != null and categoryIds.length > 0">
|
||||
and category_id in
|
||||
<foreach collection="categoryIds" item="item" index="index" separator="," open="(" close=")">
|
||||
|
|
|
|||
|
|
@ -844,79 +844,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
<insert id="insertMenuDetails">
|
||||
<foreach collection="menuDetails" item="menuDetail" separator=";">
|
||||
insert into menu_recipe_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDetails[0].detailId != null">detail_id,</if>
|
||||
<if test="menuDetails[0].saleTypeId != null">sale_type_id,</if>
|
||||
<if test="menuDetails[0].recipeId != null">recipe_id,</if>
|
||||
<if test="menuDetails[0].applyDate != null">apply_date,</if>
|
||||
<if test="menuDetails[0].applyWeek != null">apply_week,</if>
|
||||
<if test="menuDetails[0].mealtimeType != null">mealtime_type,</if>
|
||||
<if test="menuDetails[0].detailType != null">detail_type,</if>
|
||||
<if test="menuDetails[0].revision != null">revision,</if>
|
||||
<if test="menuDetails[0].createBy != null">create_by,</if>
|
||||
<if test="menuDetails[0].createTime != null">create_time,</if>
|
||||
<if test="menuDetails[0].updateBy != null">update_by,</if>
|
||||
<if test="menuDetails[0].updateTime != null">update_time,</if>
|
||||
<if test="menuDetail.detailId != null">detail_id,</if>
|
||||
<if test="menuDetail.saleTypeId != null">sale_type_id,</if>
|
||||
<if test="menuDetail.recipeId != null">recipe_id,</if>
|
||||
<if test="menuDetail.applyDate != null">apply_date,</if>
|
||||
<if test="menuDetail.applyWeek != null">apply_week,</if>
|
||||
<if test="menuDetail.mealtimeType != null">mealtime_type,</if>
|
||||
<if test="menuDetail.detailType != null">detail_type,</if>
|
||||
<if test="menuDetail.revision != null">revision,</if>
|
||||
<if test="menuDetail.createBy != null">create_by,</if>
|
||||
<if test="menuDetail.createTime != null">create_time,</if>
|
||||
<if test="menuDetail.updateBy != null">update_by,</if>
|
||||
<if test="menuDetail.updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="menuDetails" item="menuDetail" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDetails[0].detailId != null">#{menuDetail.detailId},</if>
|
||||
<if test="menuDetails[0].saleTypeId != null">#{menuDetail.saleTypeId},</if>
|
||||
<if test="menuDetails[0].recipeId != null">#{menuDetail.recipeId},</if>
|
||||
<if test="menuDetails[0].applyDate != null">#{menuDetail.applyDate},</if>
|
||||
<if test="menuDetails[0].applyWeek != null">#{menuDetail.applyWeek},</if>
|
||||
<if test="menuDetails[0].mealtimeType != null">#{menuDetail.mealtimeType},</if>
|
||||
<if test="menuDetails[0].detailType != null">#{menuDetail.detailType},</if>
|
||||
<if test="menuDetails[0].revision != null">#{menuDetail.revision},</if>
|
||||
<if test="menuDetails[0].createBy != null">#{menuDetail.createBy},</if>
|
||||
<if test="menuDetails[0].createTime != null">#{menuDetail.createTime},</if>
|
||||
<if test="menuDetails[0].updateBy != null">#{menuDetail.updateBy},</if>
|
||||
<if test="menuDetails[0].updateTime != null">#{menuDetail.updateTime},</if>
|
||||
</trim>
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDetail.detailId != null">#{menuDetail.detailId},</if>
|
||||
<if test="menuDetail.saleTypeId != null">#{menuDetail.saleTypeId},</if>
|
||||
<if test="menuDetail.recipeId != null">#{menuDetail.recipeId},</if>
|
||||
<if test="menuDetail.applyDate != null">#{menuDetail.applyDate},</if>
|
||||
<if test="menuDetail.applyWeek != null">#{menuDetail.applyWeek},</if>
|
||||
<if test="menuDetail.mealtimeType != null">#{menuDetail.mealtimeType},</if>
|
||||
<if test="menuDetail.detailType != null">#{menuDetail.detailType},</if>
|
||||
<if test="menuDetail.revision != null">#{menuDetail.revision},</if>
|
||||
<if test="menuDetail.createBy != null">#{menuDetail.createBy},</if>
|
||||
<if test="menuDetail.createTime != null">#{menuDetail.createTime},</if>
|
||||
<if test="menuDetail.updateBy != null">#{menuDetail.updateBy},</if>
|
||||
<if test="menuDetail.updateTime != null">#{menuDetail.updateTime},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertMenuDishes">
|
||||
<foreach collection="menuDishes" item="menuDish" separator=";">
|
||||
insert into menu_recipe_dishes
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDishes[0].detailId != null">detail_id,</if>
|
||||
<if test="menuDishes[0].dishesId != null">dishes_id,</if>
|
||||
<if test="menuDishes[0].price != null">price,</if>
|
||||
<if test="menuDishes[0].sizeType != null">size_type,</if>
|
||||
<if test="menuDishes[0].supplyNum != null">supply_num,</if>
|
||||
<if test="menuDishes[0].saleNum != null">sale_num,</if>
|
||||
<if test="menuDishes[0].surplusNum != null">surplus_num,</if>
|
||||
<if test="menuDishes[0].restrictNum != null">restrict_num,</if>
|
||||
<if test="menuDishes[0].salePrice != null">sale_price,</if>
|
||||
<if test="menuDishes[0].recommendFlag != null">recommend_flag,</if>
|
||||
<if test="menuDishes[0].sortNum != null">sort_num,</if>
|
||||
<if test="menuDishes[0].revision != null">revision,</if>
|
||||
<if test="menuDishes[0].createBy != null">create_by,</if>
|
||||
<if test="menuDishes[0].createTime != null">create_time,</if>
|
||||
<if test="menuDishes[0].updateBy != null">update_by,</if>
|
||||
<if test="menuDishes[0].updateTime != null">update_time,</if>
|
||||
<if test="menuDish.detailId != null">detail_id,</if>
|
||||
<if test="menuDish.dishesId != null">dishes_id,</if>
|
||||
<if test="menuDish.price != null">price,</if>
|
||||
<if test="menuDish.sizeType != null">size_type,</if>
|
||||
<if test="menuDish.supplyNum != null">supply_num,</if>
|
||||
<if test="menuDish.saleNum != null">sale_num,</if>
|
||||
<if test="menuDish.surplusNum != null">surplus_num,</if>
|
||||
<if test="menuDish.restrictNum != null">restrict_num,</if>
|
||||
<if test="menuDish.salePrice != null">sale_price,</if>
|
||||
<if test="menuDish.recommendFlag != null">recommend_flag,</if>
|
||||
<if test="menuDish.revision != null">revision,</if>
|
||||
<if test="menuDish.createBy != null">create_by,</if>
|
||||
<if test="menuDish.createTime != null">create_time,</if>
|
||||
<if test="menuDish.updateBy != null">update_by,</if>
|
||||
<if test="menuDish.updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="menuDishes" item="menuDish" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDishes[0].detailId != null">#{menuDish.detailId},</if>
|
||||
<if test="menuDishes[0].dishesId != null">#{menuDish.dishesId},</if>
|
||||
<if test="menuDishes[0].price != null">#{menuDish.price},</if>
|
||||
<if test="menuDishes[0].sizeType != null">#{menuDish.sizeType},</if>
|
||||
<if test="menuDishes[0].supplyNum != null">#{menuDish.supplyNum},</if>
|
||||
<if test="menuDishes[0].saleNum != null">#{menuDish.saleNum},</if>
|
||||
<if test="menuDishes[0].surplusNum != null">#{menuDish.surplusNum},</if>
|
||||
<if test="menuDishes[0].restrictNum != null">#{menuDish.restrictNum},</if>
|
||||
<if test="menuDishes[0].salePrice != null">#{menuDish.salePrice},</if>
|
||||
<if test="menuDishes[0].recommendFlag != null">#{menuDish.recommendFlag},</if>
|
||||
<if test="menuDishes[0].sortNum != null">#{menuDish.sortNum},</if>
|
||||
<if test="menuDishes[0].revision != null">#{menuDish.revision},</if>
|
||||
<if test="menuDishes[0].createBy != null">#{menuDish.createBy},</if>
|
||||
<if test="menuDishes[0].createTime != null">#{menuDish.createTime},</if>
|
||||
<if test="menuDishes[0].updateBy != null">#{menuDish.updateBy},</if>
|
||||
<if test="menuDishes[0].updateTime != null">#{menuDish.updateTime},</if>
|
||||
</trim>
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDish.detailId != null">#{menuDish.detailId},</if>
|
||||
<if test="menuDish.dishesId != null">#{menuDish.dishesId},</if>
|
||||
<if test="menuDish.price != null">#{menuDish.price},</if>
|
||||
<if test="menuDish.sizeType != null">#{menuDish.sizeType},</if>
|
||||
<if test="menuDish.supplyNum != null">#{menuDish.supplyNum},</if>
|
||||
<if test="menuDish.saleNum != null">#{menuDish.saleNum},</if>
|
||||
<if test="menuDish.surplusNum != null">#{menuDish.surplusNum},</if>
|
||||
<if test="menuDish.restrictNum != null">#{menuDish.restrictNum},</if>
|
||||
<if test="menuDish.salePrice != null">#{menuDish.salePrice},</if>
|
||||
<if test="menuDish.recommendFlag != null">#{menuDish.recommendFlag},</if>
|
||||
<if test="menuDish.revision != null">#{menuDish.revision},</if>
|
||||
<if test="menuDish.createBy != null">#{menuDish.createBy},</if>
|
||||
<if test="menuDish.createTime != null">#{menuDish.createTime},</if>
|
||||
<if test="menuDish.updateBy != null">#{menuDish.updateBy},</if>
|
||||
<if test="menuDish.updateTime != null">#{menuDish.updateTime},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateMenuRecipe" parameterType="com.bonus.canteen.core.menu.domain.MenuRecipe">
|
||||
|
|
@ -1063,5 +1061,209 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN device_bind b on a.device_id = b.device_id
|
||||
where b.canteen_id = #{canteenId} and b.stall_id = #{stallId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="MenuRecipeDetailList" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDetail">
|
||||
select id,detail_id as detailId,sale_type_id as saleTypeId,recipe_id as recipeId,apply_date as applyDate,
|
||||
apply_week as applyWeek,apply_month as applyMonth,mealtime_type as mealtimeType,detail_type as detailType,revision
|
||||
from menu_recipe_detail
|
||||
where recipe_id = #{recipeId}
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getMenuRecipeList" resultType="com.bonus.canteen.core.menu.vo.MenuRecipeV2PageVO">
|
||||
select
|
||||
mr.recipe_id as recipeId,
|
||||
mr.recipe_name as recipeName,
|
||||
mr.recipe_type as recipeType,
|
||||
ac.canteen_id as canteenId,
|
||||
ac.canteen_name as canteenName,
|
||||
aa.area_id as areaId,
|
||||
aa.area_name as areaName,
|
||||
a.stall_id as stallId,
|
||||
a.stall_name as stallName
|
||||
from
|
||||
menu_recipe mr
|
||||
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
|
||||
left join alloc_stall a on mr.stall_id = a.stall_id
|
||||
left join alloc_area aa on ac.area_id = aa.area_id
|
||||
where 1=1
|
||||
<if test="recipeId != null ">
|
||||
and mr.recipe_id = #{recipeId}
|
||||
</if>
|
||||
<if test="areaId ">
|
||||
and aa.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="recipeName != null and recipeName != ''">
|
||||
and mr.recipe_name like concat('%', #{recipeName}, '%')
|
||||
</if>
|
||||
<if test="canteenId != null and canteenId !=-1">
|
||||
and ac.canteen_id = #{canteenId}
|
||||
</if>
|
||||
<if test="content.stallId != null and content.stallId !=-1">
|
||||
and a.stall_id = #{content.stallId}
|
||||
</if>
|
||||
|
||||
<if test="content.areaId != null and content.areaId !=-1">
|
||||
and aa.area_id = #{content.areaId}
|
||||
</if>
|
||||
|
||||
<if test="content.recipeType != null">
|
||||
and mr.recipe_type = #{content.recipeType}
|
||||
</if>
|
||||
order by
|
||||
mr.crtime desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getMenuDishDeatilList" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDetail">
|
||||
SELECT
|
||||
recipe_id as recipeId,apply_date as applyDate
|
||||
FROM
|
||||
menu_recipe_detail
|
||||
|
||||
where
|
||||
apply_date >= curdate()
|
||||
<if test="recipeIds !=null and recipeIds.size()>0">
|
||||
AND recipe_id in
|
||||
<foreach collection="recipeIds" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMenuRecipeListV2" resultType="com.bonus.canteen.core.menu.vo.AllocRecipeStallVO">
|
||||
SELECT
|
||||
t3.area_id as areaId, t3.area_name as areaName, t2.canteen_id as canteenId,
|
||||
t2.canteen_name as canteenName, t1.stall_id as stallId, t1.stall_name as stallName,
|
||||
a.recipe_id as recipeId,a.recipe_name as recipeName
|
||||
FROM
|
||||
alloc_stall t1
|
||||
LEFT JOIN alloc_canteen t2 ON t1.canteen_id = t2.canteen_id
|
||||
LEFT JOIN alloc_area t3 ON t2.area_id = t3.area_id
|
||||
LEFT JOIN(
|
||||
select
|
||||
mar.recipe_id,
|
||||
mr.stall_id,
|
||||
mar.bind_type,
|
||||
mr.recipe_name
|
||||
from menu_app_recipe mar
|
||||
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where bind_type = #{bindType}
|
||||
) a on a.stall_id =t1.stall_id
|
||||
<if test="deviceTypeList != null and deviceTypeList.size() > 0">
|
||||
and
|
||||
EXISTS (
|
||||
SELECT NULL
|
||||
FROM
|
||||
device_bind t6
|
||||
LEFT JOIN device_info t7 ON t7.device_id = t6.device_id
|
||||
WHERE
|
||||
t6.canteen_id = t2.canteen_id
|
||||
AND t6.stall_id = t1.stall_id
|
||||
AND t7.device_type IN
|
||||
<foreach collection="deviceTypeList" item="deviceType" separator="," open="(" close=")">
|
||||
#{deviceType}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
where 1= 1
|
||||
|
||||
<if test="areaId !=null">
|
||||
and t3.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="canteenId !=null">
|
||||
and t2.canteen_id = #{canteenId}
|
||||
</if>
|
||||
<if test="stallId !=null ">
|
||||
and t1.stall_id = #{stallId}
|
||||
</if>
|
||||
|
||||
<!-- <if test="areaIds !=null and areaIds.size()>0">-->
|
||||
<!-- and t3.area_id in-->
|
||||
<!-- <foreach collection="areaIds" open="(" close=")" item="item" separator=",">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="canteenIds !=null and canteenIds.size()>0">-->
|
||||
<!-- and t2.canteen_id in-->
|
||||
<!-- <foreach collection="canteenIds" open="(" close=")" item="item" separator=",">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="stallIds !=null and stallIds.size()>0">-->
|
||||
<!-- and t1.stall_id in-->
|
||||
<!-- <foreach collection="stallIds" open="(" close=")" item="item" separator=",">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<if test="recipeName !=null and recipeName !=''">
|
||||
and a.recipe_name like concat('%', #{recipeName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectRecipeByStallIdsAndBindType"
|
||||
resultType="com.bonus.canteen.core.menu.dto.StallAndRecipeBindDto">
|
||||
select
|
||||
mar.recipe_id,
|
||||
mr.stall_id,
|
||||
mar.bind_type
|
||||
from menu_app_recipe mar
|
||||
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where bind_type = #{bindType}
|
||||
<if test="stallIds !=null and stallIds.size() > 0 ">
|
||||
and mr.stall_id IN
|
||||
<foreach collection="stallIds" item="stallId" separator="," open="(" close=")">
|
||||
#{stallId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectTmpBetweenDateDetailList" resultType="com.bonus.canteen.core.menu.vo.MenuRecipeDateVO">
|
||||
|
||||
select mrd.mealtime_type,
|
||||
mrd.recipe_id,
|
||||
mrd.detail_id,
|
||||
mdb.base_dishes_id as dishes_id,
|
||||
mdb.dishes_name,
|
||||
mrdd.id,
|
||||
mrdd.price,
|
||||
mrdd.size_type,
|
||||
mrdd.supply_num,
|
||||
mrdd.sale_num,
|
||||
mrdd.surplus_num,
|
||||
mrdd.restrict_num,
|
||||
mrdd.sale_price,
|
||||
mrdd.recommend_flag,
|
||||
mrdd.sort_num,
|
||||
md.sales_mode,
|
||||
md.unit_price,
|
||||
md.meal_type,
|
||||
md.dishes_num,
|
||||
ac.canteen_name,
|
||||
md.material_cost,
|
||||
md.type_id,
|
||||
mdt.type_name
|
||||
from menu_recipe_detail mrd
|
||||
left join menu_recipe_dishes mrdd on mrd.detail_id = mrdd.detail_id
|
||||
left join menu_dishes md on mrdd.dishes_id = md.dishes_id
|
||||
left join alloc_canteen ac on md.canteen_id = ac.canteen_id
|
||||
left join menu_dishes_base mdb on md.base_dishes_id = mdb.base_dishes_id
|
||||
left join menu_dishes_type mdt on md.type_id = mdt.type_id
|
||||
where 1=1
|
||||
<if test="recipeIds !=null and recipeIds.size() > 0">
|
||||
and mrd.recipe_id in
|
||||
<foreach collection="recipeIds" item="recipeId" separator="," open="(" close=")">
|
||||
#{recipeId}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
and mrd.apply_date between #{applyStartDate} and #{applyEndDate}
|
||||
order by mrd.apply_date,mrdd.sort_num
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue