1.添加mybatisPlus依赖
2.排队取号接口
This commit is contained in:
62
src/main/resources/mapper/TbCallQueueMapper.xml
Normal file
62
src/main/resources/mapper/TbCallQueueMapper.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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.chaozhanggui.system.cashierservice.mapper.TbCallQueueMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbCallQueue">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="callTableId" column="call_table_id" jdbcType="INTEGER"/>
|
||||
<result property="phone" column="phone" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="shopName" column="shop_name" jdbcType="VARCHAR"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="TINYINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="callTime" column="call_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="callCount" column="call_count" jdbcType="INTEGER"/>
|
||||
<result property="passTime" column="pass_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="cancelTime" column="cancel_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="note" column="note" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="openId" column="open_id" jdbcType="VARCHAR"/>
|
||||
<result property="subState" column="sub_state" jdbcType="TINYINT"/>
|
||||
<result property="confirmTime" column="confirm_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,call_table_id,phone,
|
||||
name,shop_name,shop_id,
|
||||
state,create_time,call_time,
|
||||
call_count,pass_time,cancel_time,
|
||||
note,user_id,open_id,
|
||||
sub_state,confirm_time
|
||||
</sql>
|
||||
<select id="selectInfoByOpenId"
|
||||
resultType="com.chaozhanggui.system.cashierservice.entity.vo.CallQueueInfoVO">
|
||||
SELECT
|
||||
a.call_num,
|
||||
a.id, -- 用户的排队记录ID
|
||||
a.state,
|
||||
a.user_id, -- 用户ID
|
||||
b.name AS table_name, -- 桌子名称
|
||||
b.note AS table_note, -- 桌子备注
|
||||
COUNT(c.id) AS waiting_count, -- 前面有几个人
|
||||
COUNT(c.id) * b.wait_time AS wait_time -- 预计等待时间
|
||||
FROM
|
||||
tb_call_queue a
|
||||
LEFT JOIN
|
||||
tb_call_table b ON a.call_table_id = b.id
|
||||
LEFT JOIN
|
||||
tb_call_queue c ON c.call_table_id = a.call_table_id
|
||||
AND c.create_time < a.create_time
|
||||
AND c.state IN (0, 1) -- 前面的人
|
||||
WHERE
|
||||
a.open_id=#{openId} and a.shop_id=#{shopId} -- 替换为目标用户的user_id
|
||||
GROUP BY
|
||||
a.id, a.user_id, b.name, b.note, b.wait_time
|
||||
ORDER BY
|
||||
a.create_time ASC;
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
28
src/main/resources/mapper/TbCallTableMapper.xml
Normal file
28
src/main/resources/mapper/TbCallTableMapper.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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.chaozhanggui.system.cashierservice.mapper.TbCallTableMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbCallTable">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="note" column="note" jdbcType="VARCHAR"/>
|
||||
<result property="waitTime" column="wait_time" jdbcType="INTEGER"/>
|
||||
<result property="prefix" column="prefix" jdbcType="VARCHAR"/>
|
||||
<result property="start" column="start" jdbcType="INTEGER"/>
|
||||
<result property="nearNum" column="near_num" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="TINYINT"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="qrcode" column="qrcode" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,note,
|
||||
wait_time,prefix,start,
|
||||
near_num,state,shop_id,
|
||||
qrcode,create_time,update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -369,6 +369,10 @@
|
||||
update tb_cashier_cart set status = #{status} where table_id = #{tableId} and status = 'create'
|
||||
</update>
|
||||
|
||||
<update id="updateStatusByOrderIdForMini">
|
||||
update tb_cashier_cart set status = #{status} where table_id = #{tableId} and status = 'create' and master_id is null
|
||||
</update>
|
||||
|
||||
<update id="updateStatusById">
|
||||
update tb_cashier_cart set status = #{status} where id = #{id}
|
||||
</update>
|
||||
@@ -382,4 +386,4 @@
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user