预约段 接口
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?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.account.mapper.BkContactListMapper">
|
||||
|
||||
<select id="getUserList" resultType="com.czg.account.entity.BkContactList">
|
||||
SELECT
|
||||
`order`.call_phone AS phone,
|
||||
count( 1 ) AS orderNum,
|
||||
sum( CASE `order`.`status` WHEN '已取消' THEN 1 ELSE 0 END ) AS cannelNum,
|
||||
MAX(`order`.create_time) AS lastBookingTime
|
||||
FROM
|
||||
`bk_order` `order`
|
||||
INNER JOIN bk_contact_list contact ON `order`.call_phone = contact.phone AND contact.shop_id = #{shopId}
|
||||
WHERE
|
||||
`order`.shop_id = #{shopId}
|
||||
GROUP BY `order`.call_phone
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.account.mapper.BkOrderMapper">
|
||||
|
||||
<select id="bookings" resultType="com.czg.account.entity.BkOrder">
|
||||
SELECT
|
||||
o.*, IFNULL(GROUP_CONCAT(DISTINCT t.name SEPARATOR '、'), '') AS tableInFos
|
||||
FROM bk_order o
|
||||
LEFT JOIN bk_order_table t ON t.book_order_id = o.id
|
||||
WHERE o.shop_id = #{shopId}
|
||||
<if test="search != null and search != ''">
|
||||
AND (o.call_username LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.call_phone LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.booking_username LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.booking_phone LIKE CONCAT('%', #{search}, '%'))
|
||||
</if>
|
||||
<if test="start != null and end != null">
|
||||
AND o.booking_time >= CONCAT(#{start}, ' 00:00:00')
|
||||
AND o.booking_time <= CONCAT(#{end}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
<if test="status == '已超时'">
|
||||
AND o.status = '待到店'
|
||||
AND o.booking_time < DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="status != '已超时'">
|
||||
AND o.status = #{status}
|
||||
</if>
|
||||
</if>
|
||||
group by o.id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.account.mapper.BkOrderTableMapper">
|
||||
|
||||
<insert id="customInsertBatch">
|
||||
insert into bk_order_table (shop_id, book_order_id, table_area_id ,table_area_name,table_id,table_name)
|
||||
values
|
||||
<foreach collection="bkOrderTables" item="item" separator=",">
|
||||
(#{shopId}, #{bookOrderId}, #{item.tableAreaId}, #{item.tableAreaName}, #{item.tableId}, #{item.tableName})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="table" resultMap="BkTableVOResultMap">
|
||||
SELECT
|
||||
`table`.area_id,
|
||||
`area`.`name` as area_name,
|
||||
`table`.id as table_id,
|
||||
`table`.`name` as table_name,
|
||||
`order`.call_phone,
|
||||
`order`.call_username,
|
||||
`order`.booking_phone,
|
||||
`order`.booking_username,
|
||||
`order`.booking_time
|
||||
FROM
|
||||
`tb_shop_table` `table`
|
||||
LEFT JOIN tb_shop_table_area `area` on `table`.area_id = `area`.id
|
||||
LEFT JOIN bk_order `order` ON `table`.shop_id = `order`.shop_id
|
||||
AND DATE(`order`.booking_time) = #{day}
|
||||
<if test="seatTimeType != null and seatTimeType != ''">
|
||||
AND `order`.seat_time_type = #{seatTimeType}
|
||||
</if>
|
||||
LEFT JOIN bk_order_table oTable on oTable.book_order_id = `order`.id
|
||||
and `table`.id = oTable.table_id
|
||||
WHERE
|
||||
`table`.shop_id = #{shopId}
|
||||
AND `table`.`status` != 'unbound'
|
||||
<if test="areaId != null">
|
||||
AND `table`.area_id = #{areaId}
|
||||
</if>
|
||||
ORDER BY `table`.area_id, `table`.id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<resultMap id="BkTableVOResultMap" type="com.czg.account.vo.BkTableVO">
|
||||
<result property="areaId" column="area_id"/>
|
||||
<result property="areaName" column="area_name"/>
|
||||
<collection property="tables" ofType="com.czg.account.vo.BkTableVO$tableVO">
|
||||
<result property="tableName" column="table_name"/>
|
||||
<collection property="bkOrders" ofType="com.czg.account.vo.BkTableVO$BkOrder">
|
||||
<result property="callPhone" column="call_phone"/>
|
||||
<result property="callUsername" column="call_username"/>
|
||||
<result property="bookingPhone" column="booking_phone"/>
|
||||
<result property="bookingUsername" column="booking_username"/>
|
||||
</collection>
|
||||
</collection>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user