一周菜谱

This commit is contained in:
sxu 2025-02-05 17:55:35 +08:00
parent 7c3e23bc9b
commit 91033c7c3f
21 changed files with 982 additions and 0 deletions

View File

@ -0,0 +1,42 @@
package com.bonus.core.account.constants;
import cn.hutool.core.collection.ListUtil;
import java.util.Arrays;
import java.util.List;
public enum AccStatusEnum {
NORMAL(1, "正常"),
DEACTIVATE(2, "停用"),
CANCEL(3, "注销"),
OVERDUE(4, "过期");
private final Integer key;
private final String desc;
private AccStatusEnum(Integer key, String desc) {
this.key = key;
this.desc = desc;
}
public static List<Integer> sendMqStatus() {
return Arrays.asList(DEACTIVATE.getKey(), OVERDUE.getKey());
}
public static List<Integer> accStatusForAppWork() {
return ListUtil.toList(new Integer[]{NORMAL.getKey(), DEACTIVATE.getKey(), OVERDUE.getKey()});
}
public static boolean ifNotAllowRechargeRepeal(Integer key) {
return ListUtil.toList(new Integer[]{CANCEL.getKey()}).contains(key);
}
public Integer getKey() {
return this.key;
}
public String getDesc() {
return this.desc;
}
}

View File

@ -0,0 +1,23 @@
//package com.bonus.core.common.enums;
//
//public enum DelFlagEnum {
// DEL_TRUE(1, "删除"),
// DEL_FALSE(2, "正常");
//
// private final Integer key;
// private final String value;
//
// private DelFlagEnum(Integer key, String value) {
// this.key = key;
// this.value = value;
// }
//
// public Integer key() {
// return this.key;
// }
//
// public String value() {
// return this.value;
// }
//
//}

View File

@ -0,0 +1,160 @@
//package com.bonus.core.common.utils;
//
//import cn.hutool.core.text.CharSequenceUtil;
//import javax.annotation.PostConstruct;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//import java.io.InputStream;
//import java.net.URLDecoder;
//import java.nio.charset.StandardCharsets;
//import java.util.stream.Collectors;
//
//@Component
//public class SysUtil {
// private static final Logger log = LoggerFactory.getLogger(SysUtil.class);
// @Value("${system.sysfile.prefixOffline}")
// private String prefixOffline;
// @Value("${system.sysfile.bucket}")
// private String prefixBucket;
// @Value("${system.sysfile.prefixOnline}")
// private String prefixOnline;
// private static final SysUtilProxy sysUtilProxy = new SysUtilProxy();
// private static String prefixOn;
// private static String bucket;
// private static String prefixOff;
//
// @PostConstruct
// public void init() {
// prefixOn = this.prefixOnline;
// bucket = this.prefixBucket;
// prefixOff = this.prefixOffline;
// }
//
// public static String getPrefix() {
// return sysUtilProxy.getPrefix(prefixOn, prefixOff);
// }
//
// public static String getBucket() {
// return bucket;
// }
//
// public static String getCutFileUrl(String fileUrl) {
// log.info("出参_补图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
// String cutFileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket());
// log.info("出参_补图_补图后路径:{}", cutFileUrl);
// return cutFileUrl;
// }
//
// public static String getCutPath(String fileUrl) {
// log.info("入参_裁图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()});
// if (!CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getBucket())) {
// if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
// return fileUrl.replace(getPrefix(), getBucket());
// } else {
// fileUrl = getUnEncodeUrl(fileUrl);
// fileUrl = fileUrl.replace(getPrefix(), getBucket());
// fileUrl = getCutSignUrl(fileUrl);
// log.info("入参_裁图_裁剪后路径:{}", fileUrl);
// return fileUrl;
// }
// } else {
// return fileUrl;
// }
// }
//
// public static String getCutPathMulti(String fileUrl) {
// return CharSequenceUtil.contains(fileUrl, ",") ? (String)CharSequenceUtil.split(fileUrl, ",", true, true).stream().map(SysUtil::getCutPath).collect(Collectors.joining(",")) : getCutPath(fileUrl);
// }
//
// public static String getFilePath(String fileUrl) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else {
// String cutPath = getCutPath(fileUrl);
// return cutPath.replace(getBucket(), "");
// }
// }
//
// public static String getObjectName(String fileUrl) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else {
// String cutPath = getCutPath(fileUrl);
// String replace = cutPath.replace(getBucket(), "");
// if (CharSequenceUtil.startWith(replace, "/")) {
// replace = replace.substring(1);
// }
//
// return replace;
// }
// }
//
// public static InputStream getInputStream(String fileUrl) {
// OssTemplate ossTemplate = (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
// OssProperties ossProperties = (OssProperties)SpringContextHolder.getBean(OssProperties.class);
// return ossTemplate.getObject(ossProperties.getBucketName(), getObjectName(fileUrl));
// }
//
// public static void removeOssObject(String fileUrl) {
// if (!CharSequenceUtil.isBlank(fileUrl)) {
// OssTemplate ossTemplate = (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
// OssProperties ossProperties = (OssProperties)SpringContextHolder.getBean(OssProperties.class);
//
// try {
// ossTemplate.removeObject(ossProperties.getBucketName(), getObjectName(fileUrl));
// } catch (Exception var4) {
// log.error("路径:{}删除异常:{}", new Object[]{fileUrl, var4.getMessage(), var4});
// }
//
// }
// }
//
// public static OssTemplate getOssTemplate() {
// return (OssTemplate)SpringContextHolder.getBean(OssTemplate.class);
// }
//
// public static OssProperties getOssProperties() {
// return (OssProperties)SpringContextHolder.getBean(OssProperties.class);
// }
//
// public static String getUnEncodeUrl(String url) {
// if (CharSequenceUtil.isBlank(url)) {
// return url;
// } else {
// try {
// String decodedUrl = URLDecoder.decode(url, StandardCharsets.UTF_8);
// return !decodedUrl.equals(url) ? decodedUrl : url;
// } catch (IllegalArgumentException var2) {
// log.info("图片url解码失败,图片url:{},异常信息_:{},详情_:", new Object[]{url, var2.getMessage(), var2});
// return url;
// }
// }
// }
//
// public static String getCutSignUrl(String fileUrl) {
// return CharSequenceUtil.isNotBlank(fileUrl) && fileUrl.contains("?") ? fileUrl.substring(0, fileUrl.indexOf("?")) : fileUrl;
// }
//
// public static String getCutFileUrl(String fileUrl, String filePrefix, String prefixBucket) {
// if (CharSequenceUtil.isBlank(fileUrl)) {
// return fileUrl;
// } else if (Boolean.FALSE.equals(getOssProperties().getUseToken())) {
// return !fileUrl.startsWith("http") && !fileUrl.startsWith("https") ? fileUrl.replace(prefixBucket, filePrefix) : fileUrl;
// } else {
// if (fileUrl.startsWith("http") || fileUrl.startsWith("https")) {
// fileUrl = fileUrl.replace(filePrefix + "/", "");
// }
//
// fileUrl = getCutSignUrl(fileUrl);
// fileUrl = fileUrl.replace(prefixBucket + "/", "");
// return getOssTemplate().getObjectURL(prefixBucket, fileUrl, getOssProperties().getExpiresTime());
// }
// }
//
// public static String getCutFileUrl4Open(String fileUrl) {
// fileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket());
// return !CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getBucket()) ? fileUrl.replace(getPrefix(), getBucket()) : fileUrl;
// }
//}

View File

@ -0,0 +1,19 @@
//package com.bonus.core.common.utils;
//
//import javax.servlet.http.HttpServletRequest;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import java.util.Objects;
//
//public class SysUtilProxy {
// public String getPrefix(String prefixOn, String prefixOff) {
// if (RequestContextHolder.getRequestAttributes() != null) {
// HttpServletRequest request = ((ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
// String headerValue = request.getHeader("X-Env");
// return "online".equals(headerValue) ? prefixOn : prefixOff;
// } else {
// return prefixOff;
// }
// }
//}

View File

@ -0,0 +1,27 @@
package com.bonus.core.marketing.constants;
/** @deprecated */
@Deprecated
public enum MktEffTypeEnum {
USER_SORT(1, "人员类"),
CANTEEN_SORT(2, "食堂类"),
PRODUCT_SORT(3, "商品类"),
WAREHOUSE_SORT(4, "仓库类");
private final Integer key;
private final String value;
MktEffTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public Integer key() {
return this.key;
}
public String value() {
return this.value;
}
}

View File

@ -0,0 +1,24 @@
package com.bonus.core.marketing.constants;
/** @deprecated */
@Deprecated
public enum MktUserTypeEnum {
INTERSECTION(1, "交集"),
UNION_SET(2, "并集");
private final Integer key;
private final String value;
MktUserTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public Integer key() {
return this.key;
}
public String value() {
return this.value;
}
}

View File

@ -0,0 +1,18 @@
package com.bonus.core.marketing.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/** @deprecated */
@Deprecated
@Data
public class MktEffectiveUserVO implements Serializable {
private Long effId;
private Integer userType;
// private Long orgId;
// private Integer psnType;
private List<Long> orgIdList;
private List<Integer> psnTypeList;
}

View File

@ -0,0 +1,31 @@
package com.bonus.core.menu.controller;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.service.MenuRecipeService;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/v2/applet/menurecipe")
public class AppletRecipeV2Controller {
private static final Logger log = LoggerFactory.getLogger(AppletRecipeV2Controller.class);
@Lazy
@Autowired
private MenuRecipeService menuRecipeService;
@PostMapping({"/list/week/canteen"})
@ApiOperation("获取一周菜谱食堂列表")
public List<AppletWeekCanteenVO> getWeekMealList(@RequestBody AppletWeekCanteenDTO appletWeekCanteenDTO) {
return this.menuRecipeService.getWeekMealList(appletWeekCanteenDTO);
}
}

View File

@ -0,0 +1,11 @@
package com.bonus.core.menu.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AppletWeekCanteenDTO {
@ApiModelProperty("人员id")
private Long custId;
}

View File

@ -0,0 +1,13 @@
package com.bonus.core.menu.mapper;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
@Mapper
public interface MenuAppRecipeMapper {
List<AppletWeekCanteenVO> selectWeekCanteenList(@Param("effIdSet") Set<Long> effIdSet);
}

View File

@ -0,0 +1,15 @@
package com.bonus.core.menu.mapper;
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
import com.bonus.domain.CustInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MenuRecipeMapper {
CustInfo selectOrgAndPsnByCustLimitId(CustInfo custInfo);
List<MktEffectiveUserVO> selectAllUserEff(@Param("effType") Integer effType, @Param("delFlag") Integer delFlag);
}

View File

@ -0,0 +1,10 @@
package com.bonus.core.menu.service;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import java.util.List;
public interface MenuRecipeService {
List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content);
}

View File

@ -0,0 +1,77 @@
package com.bonus.core.menu.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.constant.DelFlagEnum;
import com.bonus.core.marketing.constants.MktEffTypeEnum;
import com.bonus.core.marketing.constants.MktUserTypeEnum;
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.mapper.MenuRecipeMapper;
import com.bonus.core.menu.service.MenuRecipeService;
import com.bonus.core.menu.mapper.MenuAppRecipeMapper;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import com.bonus.domain.CustInfo;
import com.google.common.collect.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class MenuRecipeServiceImpl implements MenuRecipeService {
private static final Logger log = LoggerFactory.getLogger(MenuRecipeServiceImpl.class);
@Autowired
private MenuAppRecipeMapper menuAppRecipeMapper;
@Autowired
private MenuRecipeMapper menuRecipeMapper;
public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) {
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
if (ObjectUtil.isEmpty(effIdSet)) {
effIdSet = Sets.newTreeSet();
((Set)effIdSet).add(-1L);
}
return this.menuAppRecipeMapper.selectWeekCanteenList((Set)effIdSet);
}
public Set<Long> getShopstallIdListByCustId(Long custId, boolean checkCustInfo) {
Set<Long> effIdSet = Sets.newTreeSet();
CustInfo custInfoQuery = new CustInfo();
custInfoQuery.setCustId(custId);
custInfoQuery.setCustState(1);
CustInfo custInfo = menuRecipeMapper.selectOrgAndPsnByCustLimitId(custInfoQuery);
if (ObjectUtil.isNull(custInfo)) {
if (checkCustInfo) {
throw new ServiceException("菜单绑定错误");
} else {
log.info("***[获取全档口菜谱信息]_未查询到人员信息,直接返回********************");
return (Set)effIdSet;
}
} else {
List<MktEffectiveUserVO> effectiveUserVOList = menuRecipeMapper.selectAllUserEff(MktEffTypeEnum.USER_SORT.key(), DelFlagEnum.DEL_FALSE.key());
Long orgId = custInfo.getOrgId();
Integer psnType = custInfo.getPsnType();
if (ObjectUtil.isNotEmpty(effectiveUserVOList)) {
List<MktEffectiveUserVO> collect = (List)effectiveUserVOList.stream().filter((u) -> {
boolean containsOrg = ObjectUtil.isNotEmpty(u.getOrgIdList()) && u.getOrgIdList().contains(orgId);
boolean containsPsn = ObjectUtil.isNotEmpty(u.getPsnTypeList()) && u.getPsnTypeList().contains(psnType);
return MktUserTypeEnum.INTERSECTION.key().equals(u.getUserType()) && containsOrg && containsPsn || MktUserTypeEnum.UNION_SET.key().equals(u.getUserType()) && (containsOrg || containsPsn);
}).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(collect)) {
effIdSet = (Set)collect.stream().map(MktEffectiveUserVO::getEffId).collect(Collectors.toSet());
((Set)effIdSet).add(-1L);
}
}
log.info("***[获取指定人员折扣比例]_指定人员的生效范围effIdSet: {}", effIdSet);
return (Set)effIdSet;
}
}
}

View File

@ -0,0 +1,32 @@
package com.bonus.core.menu.vo;
import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalTime;
import java.util.List;
@ApiModel("获取当餐点餐食堂档口列表(食堂嵌套档口版)")
@Data
public class AppletCurrentCanteenVO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("档口菜谱")
private List<AppletCurrentStallVO> stallList;
public Integer getMonthlySales() {
return CollUtil.isNotEmpty(this.stallList) ? this.stallList.stream().mapToInt(AppletCurrentStallVO::getMonthlySales).sum() : 0;
}
}

View File

@ -0,0 +1,34 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalTime;
import java.util.List;
import java.util.Optional;
@ApiModel("档口菜谱")
@Data
public class AppletCurrentStallVO {
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口营业状态")
private Integer stallState;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("推荐菜品")
private List<AppletRecommendDishesVO> recommendList;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
}

View File

@ -0,0 +1,18 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("推荐菜品")
@Data
public class AppletRecommendDishesVO {
@ApiModelProperty("菜品id")
private Long dishesId;
@ApiModelProperty("菜品名称")
private String dishesName;
@ApiModelProperty("菜品价格")
private Integer dishesPrice;
@ApiModelProperty("菜品图片")
private String dishesImgUrl;
}

View File

@ -0,0 +1,37 @@
package com.bonus.core.menu.vo;
import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
@ApiModel("获取预定餐食堂列表(食堂嵌套档口版)")
public class AppletReserveCanteenVO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("食堂营业状态")
private Integer canteenState;
@ApiModelProperty("食堂图片")
private String canteenImgUrl;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("档口菜谱")
private List<AppletReserveStallVO> stallList;
// public String getCanteenImgUrl() {
// return SysUtil.getCutFileUrl(this.canteenImgUrl);
// }
//
// public Integer getMonthlySales() {
// return CollUtil.isNotEmpty(this.stallList) ? this.stallList.stream().mapToInt(AppletReserveStallVO::getMonthlySales).sum() : 0;
// }
}

View File

@ -0,0 +1,36 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
import java.util.Optional;
@ApiModel("档口菜谱")
public class AppletReserveStallVO {
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口营业状态")
private Integer stallState;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("营业开始时间")
private LocalTime stallStartTime;
@ApiModelProperty("营业结束时间")
private LocalTime stallEndTime;
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("推荐菜品")
private List<AppletRecommendDishesVO> recommendList;
}

View File

@ -0,0 +1,25 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel("获取一周菜谱食堂列表")
@Data
public class AppletWeekCanteenVO {
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("食堂图片")
private String canteenImgUrl;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("档口标签")
private List<String> labelList;
// @ApiModelProperty("档口标签")
// private String labelName;
}

View File

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.core.menu.mapper.MenuAppRecipeMapper">
<resultMap id="appletCurrentCanteenVO" type="com.bonus.core.menu.vo.AppletCurrentCanteenVO">
<result property="canteenId" column="canteen_id"/>
<result property="canteenName" column="canteen_name"/>
<result property="startBusinessTime" column="start_business_time_ac"/>
<result property="endBusinessTime" column="end_business_time_ac"/>
<result property="businessState" column="business_state_ac"/>
<collection property="stallList" ofType="com.bonus.core.menu.vo.AppletCurrentStallVO">
<result property="stallId" column="stall_id"/>
<result property="stallName" column="stall_name"/>
<result property="stallImgUrl" column="stall_img_url"/>
<result property="recipeId" column="recipe_id"/>
<result property="startBusinessTime" column="start_business_time"/>
<result property="endBusinessTime" column="end_business_time"/>
<result property="businessState" column="business_state"/>
</collection>
</resultMap>
<!-- 获取当餐点餐食堂列表(无餐次版) -->
<select id="selectCurrentShopstallList" resultMap="appletCurrentCanteenVO">
select distinct
ac.canteen_id,
ac.canteen_name,
ass.stall_id,
ass.stall_name,
ass.img_url as stall_img_url,
mr.recipe_id,
ac.start_business_time as start_business_time_ac,
ac.end_business_time as end_business_time_ac,
ac.business_state as business_state_ac,
ass.start_business_time,
ass.end_business_time,
ass.business_state
from
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join menu_recipe_detail mrd on mr.recipe_id = mrd.recipe_id
and mrd.apply_date = curdate()
left join menu_recipe_dishes m on mrd.detail_id = m.detail_id
left join menu_dishes md on m.dishes_id = md.dishes_id
left join alloc_kind ak on mr.stall_id = ak.stall_id
where
bind_type = 1
<if test="kindName != null and kindName != ''">
and ak.kind_name = #{kindName}
</if>
<if test="keyword != null and keyword != ''">
and md.dishes_name like #{keyword}
</if>
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<resultMap id="appletWeekCanteenVO" type="com.bonus.core.menu.vo.AppletWeekCanteenVO">
<result property="recipeId" column="recipe_id"/>
<result property="stallName" column="stall_name"/>
<result property="canteenName" column="canteen_name"/>
<result property="canteenImgUrl" column="canteen_img_url"/>
<result property="stallImgUrl" column="stall_img_url"/>
<collection property="labelList" ofType="string">
<result property="labelName" column="label_name"/>
</collection>
</resultMap>
<!-- 获取一周菜谱食堂列表 -->
<select id="selectWeekCanteenList" resultMap="appletWeekCanteenVO">
select
mr.recipe_id,
ass.stall_name,
ac.canteen_name,
ac.img_url as canteen_img_url,
ass.img_url as stall_img_url,
al.label_name
from
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join alloc_label al on ass.stall_id = al.stall_id
where
bind_type = 3
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<!-- 获取菜谱id -->
<select id="selectWeekRecipeId" resultType="java.lang.Long">
select
mar.recipe_id
from
menu_app_recipe mar
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>
</select>
<!-- <resultMap id="appletReserveCanteenVO" type="com.bonus.core.menu.vo.AppletReserveCanteenVO">-->
<!-- <result property="canteenId" column="canteen_id"/>-->
<!-- <result property="canteenName" column="canteen_name"/>-->
<!-- <result property="canteenImgUrl" column="canteen_img_url"/>-->
<!-- <result property="startBusinessTime" column="start_business_time_ac"/>-->
<!-- <result property="endBusinessTime" column="end_business_time_ac"/>-->
<!-- <result property="businessState" column="business_state_ac"/>-->
<!-- <collection property="stallList" ofType="com.bonus.core.menu.vo.AppletReserveStallVO">-->
<!-- <result property="stallId" column="stall_id"/>-->
<!-- <result property="stallName" column="stall_name"/>-->
<!-- <result property="stallImgUrl" column="stall_img_url"/>-->
<!-- <result property="recipeId" column="recipe_id"/>-->
<!-- <result property="startBusinessTime" column="start_business_time"/>-->
<!-- <result property="endBusinessTime" column="end_business_time"/>-->
<!-- <result property="businessState" column="business_state"/>-->
<!-- </collection>-->
<!-- </resultMap>-->
<!-- <select id="selectReserveMealCanteenList" resultMap="appletReserveCanteenVO">-->
<!-- select-->
<!-- ac.canteen_id,-->
<!-- ac.canteen_name,-->
<!-- ac.img_url as canteen_img_url,-->
<!-- ass.stall_id,-->
<!-- ass.stall_name,-->
<!-- ass.img_url as stall_img_url,-->
<!-- mr.recipe_id,-->
<!-- ac.start_business_time as start_business_time_ac,-->
<!-- ac.end_business_time as end_business_time_ac,-->
<!-- ac.business_state as business_state_ac,-->
<!-- ass.start_business_time,-->
<!-- ass.end_business_time,-->
<!-- ass.business_state-->
<!-- from-->
<!-- menu_app_recipe mar-->
<!-- left join menu_recipe mr on mar.recipe_id = mr.recipe_id-->
<!-- left join alloc_canteen ac on mr.canteen_id = ac.canteen_id-->
<!-- left join alloc_stall ass on mr.stall_id = ass.stall_id-->
<!-- where-->
<!-- bind_type = 2-->
<!-- and mr.eff_id in-->
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
<!-- #{effId}-->
<!-- </foreach>-->
<!-- </select>-->
<select id="selectCurrentShopstallListByPlaceId" resultMap="appletCurrentCanteenVO">
select distinct
ac.canteen_id,
ac.canteen_name,
ass.stall_id,
ass.stall_name,
ass.img_url as stall_img_url,
mr.recipe_id,
ac.start_business_time as start_business_time_ac,
ac.end_business_time as end_business_time_ac,
ac.business_state as business_state_ac,
ass.start_business_time,
ass.end_business_time,
ass.business_state
from
alloc_table_recipe atr
left join menu_app_recipe mar on mar.recipe_id = atr.recipe_id
left join menu_recipe mr on atr.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join menu_recipe_detail mrd on mr.recipe_id = mrd.recipe_id
and mrd.apply_date = curdate()
left join menu_recipe_dishes m on mrd.detail_id = m.detail_id
left join menu_dishes md on m.dishes_id = md.dishes_id
left join alloc_kind ak on mr.stall_id = ak.stall_id
where
mar.bind_type = 1 and atr.table_id = #{placeId}
<if test="kindName != null and kindName != ''">
and ak.kind_name = #{kindName}
</if>
<if test="keyword != null and keyword != ''">
and md.dishes_name like concat('%', #{keyword}, '%')
</if>
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<!-- <select id="selectRecipeByStallIdsAndBindType" resultType="com.bonus.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="selectRecipeInSameShop" resultType="java.lang.Long">
select mar.recipe_id
from menu_app_recipe mar
inner join menu_recipe mr on mar.recipe_id = mr.recipe_id
where mar.bind_type = #{bindType}
and mr.stall_id = #{stallId}
<if test="effId !=null">
and mr.eff_id = #{effId}
</if>
<if test="mealLineId !=null">
and mar.meal_line_id= #{mealLineId}
</if>
</select>
<!-- <select id="getBindByTypeAndStalls" resultType="com.bonus.core.device.manage.dto.DeviceRecipeDTO">-->
<!-- SELECT-->
<!-- t2.stall_id,-->
<!-- t2.canteen_id,-->
<!-- t1.recipe_id,-->
<!-- t1.meal_line_id-->
<!-- FROM-->
<!-- menu_app_recipe t1-->
<!-- LEFT JOIN menu_recipe t2 ON t1.recipe_id = t2.recipe_id-->
<!-- WHERE t1.bind_type = #{bindType} AND-->
<!-- <foreach collection="deviceBinds" separator="OR" open="(" close=")" item="item">-->
<!-- ( t2.stall_id = #{item.stallId}-->
<!-- AND t2.canteen_id = #{item.canteenId}-->
<!-- <if test="item.mealLineId !=null ">-->
<!-- AND t1.meal_line_id = #{item.mealLineId}-->
<!-- </if>-->
<!-- )-->
<!-- </foreach>-->
<!-- </select>-->
<!-- <resultMap id="AppletWeekCanteenStallVO" type="com.bonus.core.menu.vo.AppletWeekCanteenStallVO">-->
<!-- <result property="canteenId" column="canteen_id"/>-->
<!-- <result property="canteenName" column="canteen_name"/>-->
<!-- <result property="canteenImgUrl" column="canteen_img_url"/>-->
<!-- <result property="startBusinessTime" column="start_business_time_ac"/>-->
<!-- <result property="endBusinessTime" column="end_business_time_ac"/>-->
<!-- <result property="businessState" column="business_state_ac"/>-->
<!-- <collection property="stallList" ofType="com.bonus.core.menu.vo.AppletWeekStallVO">-->
<!-- <result property="stallId" column="stall_id"/>-->
<!-- <result property="stallName" column="stall_name"/>-->
<!-- <result property="stallImgUrl" column="stall_img_url"/>-->
<!-- <result property="recipeId" column="recipe_id"/>-->
<!-- <result property="startBusinessTime" column="start_business_time"/>-->
<!-- <result property="endBusinessTime" column="end_business_time"/>-->
<!-- <result property="businessState" column="business_state"/>-->
<!-- </collection>-->
<!-- </resultMap>-->
<!-- <select id="getWeekMealCanteenList" resultMap="AppletWeekCanteenStallVO">-->
<!-- select-->
<!-- ac.canteen_id,-->
<!-- ac.canteen_name,-->
<!-- ac.img_url as canteen_img_url,-->
<!-- ass.stall_id,-->
<!-- ass.stall_name,-->
<!-- ass.img_url as stall_img_url,-->
<!-- mr.recipe_id,-->
<!-- ac.start_business_time as start_business_time_ac,-->
<!-- ac.end_business_time as end_business_time_ac,-->
<!-- ac.business_state as business_state_ac,-->
<!-- ass.start_business_time,-->
<!-- ass.end_business_time,-->
<!-- ass.business_state-->
<!-- from-->
<!-- menu_app_recipe mar-->
<!-- left join menu_recipe mr on mar.recipe_id = mr.recipe_id-->
<!-- left join alloc_canteen ac on mr.canteen_id = ac.canteen_id-->
<!-- left join alloc_stall ass on mr.stall_id = ass.stall_id-->
<!-- where-->
<!-- bind_type = 3-->
<!-- and mr.eff_id in-->
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
<!-- #{effId}-->
<!-- </foreach>-->
<!-- </select>-->
</mapper>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.core.menu.mapper.MenuRecipeMapper">
<resultMap type="com.bonus.core.marketing.vo.MktEffectiveUserVO" id="mktEffectiveUserVO">
<result property="effId" column="eff_id"/>
<result property="userType" column="user_type"/>
<!-- <result property="orgId" column="org_id"/>-->
<!-- <result property="psnType" column="psn_type"/>-->
<collection property="orgIdList" ofType="Long">
<result property="orgId" column="org_id"/>
</collection>
<collection property="psnTypeList" ofType="Integer">
<result property="psnType" column="psn_type"/>
</collection>
</resultMap>
<select id="selectOrgAndPsnByCustLimitId" parameterType="com.bonus.domain.CustInfo" resultType="com.bonus.domain.CustInfo">
select org_id, psn_type
from cust_info
where cust_id = #{custId} and cust_state = 1
</select>
<!-- 获取指定类型的生效范围详情 -->
<select id="selectAllUserEff" resultMap="mktEffectiveUserVO">
select me.eff_id,
me.user_type,
med.org_id,
med.psn_type
from mkt_effective me
left join mkt_effective_detail med on me.eff_id = med.eff_id
where me.eff_type = #{effType}
and me.del_flag = #{delFlag}
</select>
</mapper>