后厨 页面 按台桌查看 按商品查看

This commit is contained in:
2025-11-26 18:15:32 +08:00
parent 7167163076
commit 8a9d096781
6 changed files with 337 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package com.czg.service.order.mapper;
import com.czg.order.vo.KitchenFoodVO;
import com.czg.order.vo.KitchenTableFoodVO;
import com.czg.order.vo.KitchenTableVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 后厨 台桌列表/商品列表
*
* @author ww
* @description
*/
@Mapper
public interface KitchenDetailMapper {
/**
* 按台桌查看
*/
List<KitchenTableVO> getKitchenTable(Long shopId, String tableName, Long areaId);
/**
* 按台桌查看商品内容
*/
List<KitchenTableFoodVO> getKitchenTableFoods(Long shopId, Long orderId, String tableCode, Long isNoTable);
/**
* 按台桌查看商品列表
*/
List<KitchenFoodVO> getKitchenFood(Long shopId, String productName);
}

View File

@@ -0,0 +1,118 @@
<?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.czg.service.order.mapper.KitchenDetailMapper">
<select id="getKitchenFood" resultMap="KitchenFoodVOResultMap">
SELECT detail.product_id AS productId,
detail.is_temporary AS isTemporary,
detail.product_name AS productName,
detail.sku_name AS skuName,
`order`.id AS orderId,
detail.id AS orderDetailId,
COALESCE(`table`.`name`, '无台桌') AS tableName,
CASE WHEN `table`.id IS NULL THEN '吧台' ELSE COALESCE(`area`.`name`, '') END AS areaName,
`staff`.`name` AS staffName,
sum(detail.num - detail.return_num) AS num,
detail.sub_status AS subStatus,
detail.order_time AS orderTime,
detail.start_order_time AS startOrderTime,
detail.dish_out_time AS dishOutTime,
detail.food_serve_time AS foodServeTime
FROM `tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_staff` `staff` ON staff.id = `order`.staff_id
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_table_area` `area` ON `table`.area_id = `area`.id
WHERE detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="productName != null and productName != ''">
AND detail.product_name like concat('%',#{productName},'%')
</if>
GROUP BY `order`.id, detail.product_id, detail.sku_id, detail.place_num
</select>
<select id="getKitchenTable" resultType="com.czg.order.vo.KitchenTableVO">
SELECT
`order`.id AS orderId,
`table`.id AS tableId,
CASE WHEN `table`.id IS NULL THEN '' ELSE COALESCE (`order`.table_code, '') END AS tableCode,
COALESCE(`table`.`name`, '无台桌') AS tableName,
`table`.`area_id` AS areaId,
CASE WHEN `table`.id IS NULL THEN '吧台' ELSE COALESCE(`area`.`name`, '') END AS areaName,
count( detail.id ) AS pendingDishCount
FROM
`tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_table_area` `area` ON `table`.area_id = `area`.id
WHERE
detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="tableName != null and tableName != ''">
AND `table`.`name` like concat('%',#{tableName},'%')
</if>
<if test="areaId != null">
AND `table`.`area_id` = #{areaId}
</if>
GROUP BY detail.order_id,tableName
</select>
<select id="getKitchenTableFoods" resultType="com.czg.order.vo.KitchenTableFoodVO">
SELECT
detail.product_id AS productId,
detail.product_name AS productName,
detail.is_temporary AS isTemporary,
`staff`.`name` AS staffName,
detail.id AS orderDetailId,
detail.sku_name AS skuName,
sum(detail.num - detail.return_num) AS num,
detail.sub_status AS subStatus,
detail.order_time AS orderTime,
detail.start_order_time AS startOrderTime,
detail.dish_out_time AS dishOutTime,
detail.food_serve_time AS foodServeTime
FROM `tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_staff` `staff` ON staff.id = `order`.staff_id
WHERE detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="orderId != null">
AND detail.order_id = #{orderId}
</if>
<if test="tableCode != null and tableCode != ''">
AND `table`.`table_code` = #{tableCode}
</if>
<if test="isNoTable != null">
AND `table`.`table_code` is null
</if>
GROUP BY `order`.id, detail.product_id, detail.sku_id, detail.place_num
</select>
<resultMap id="KitchenFoodVOResultMap" type="com.czg.order.vo.KitchenFoodVO">
<result property="productId" column="productId"/>
<result property="isTemporary" column="isTemporary"/>
<result property="productName" column="productName"/>
<collection property="foodItems" ofType="com.czg.order.vo.KitchenFoodVO$KitchenFoodItemVO">
<constructor>
<arg column="orderId" javaType="java.lang.Long"/>
<arg column="staffName" javaType="java.lang.String"/>
<arg column="tableName" javaType="java.lang.String"/>
<arg column="areaName" javaType="java.lang.String"/>
<arg column="orderDetailId" javaType="java.lang.Long"/>
<arg column="num" javaType="java.lang.Long"/>
<arg column="subStatus" javaType="java.lang.String"/>
<arg column="orderTime" javaType="java.lang.String"/>
<arg column="startOrderTime" javaType="java.lang.String"/>
<arg column="dishOutTime" javaType="java.lang.String"/>
<arg column="foodServeTime" javaType="java.lang.String"/>
</constructor>
</collection>
</resultMap>
</mapper>