xz-szwhy/src/main/resources/mybatis/mapper/venuebooking/groundbooking/groundbooking-mapper.xml

283 lines
12 KiB
XML
Raw Normal View History

2022-08-03 16:21:06 +08:00
<?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="cn.com.tenlion.xzszwhy.venuebooking.dao.groundbooking.IGroundBookingDao">
<resultMap id="venuesInfoOwDTO" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.venuesinfo.VenuesInfoOwDTO">
<id property="owId" column="ow_id"></id>
<result property="venuesInfoId" column="venues_info_id"></result>
<result property="userId" column="user_di"></result>
</resultMap>
<resultMap id="groundBookingInfoDTO" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.bookingorder.GroundBookingInfoDTO">
<id property="groundBookingId" column="ground_booking_id"></id>
<result property="serial" column="serial"></result>
<result property="venuesInfoId" column="venues_info_id"></result>
<result property="venuesName" column="venues_name"></result>
<result property="venuesProjectId" column="venues_project_id"></result>
<result property="projectName" column="project_name"></result>
<result property="userName" column="user_name"></result>
<result property="idCardNumber" column="id_card_number"></result>
<result property="phoneNumber" column="phone_number"></result>
<result property="orderType" column="order_type"></result>
<result property="gmtCreate" column="gmt_create"></result>
<result property="venuePanorama" column="venue_panorama"></result>
</resultMap>
<resultMap id="groundBooingItemDTO" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.bookingorder.GroundBookingItemDTO">
<id property="bookingItemId" column="booking_item_id"></id>
<result property="bookingInfoId" column="booking_info_id"></result>
<result property="groundItemId" column="ground_item_id"></result>
<result property="bookingOrderDate" column="booking_order_date"></result>
<result property="timeStr" column="time_str"></result>
<result property="timeEnd" column="time_end"></result>
<result property="price" column="price"></result>
<result property="arriveType" column="arrive_type"></result>
<result property="orderType" column="order_type"></result>
<result property="reason" column="reason"></result>
<result property="groundName" column="ground_name"></result>
</resultMap>
<resultMap id="myTicketListDTO" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.bookingorder.MyTicketListDTO">
<id property="groundBookingId" column="ground_booking_id"></id>
<result property="serial" column="serial"></result>
<result property="venuesName" column="venues_name"></result>
<result property="venuePanorama" column="venue_panorama"></result>
<result property="projectName" column="project_name"></result>
<result property="gmtCreate" column="gmt_create"></result>
<result property="orderType" column="order_type"></result>
<result property="price" column="price"></result>
<result property="itemCount" column="item_count"></result>
</resultMap>
<resultMap id="venueProjectDTO" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.bookingorder.VenueProjectDTO">
<result property="venuesInfoId" column="venues_info_id"></result>
<result property="venueName" column="venue_name"></result>
<result property="venuesProjectId" column="venues_project_id"></result>
<result property="projectName" column="project_name"></result>
</resultMap>
<resultMap id="bookingOrderList" type="cn.com.tenlion.xzszwhy.venuebooking.pojo.dtos.bookingorder.BookingOrderList">
<id property="bookingItemId" column="booking_item_id"></id>
<result property="serial" column="serial"></result>
<result property="venuesName" column="venues_name"></result>
<result property="projectName" column="project_name"></result>
<result property="groundName" column="ground_name"></result>
<result property="bookingOrderDate" column="booking_order_date"></result>
<result property="timeStr" column="time_str"></result>
<result property="timeEnd" column="time_end"></result>
<result property="price" column="price"></result>
<result property="gmtCreate" column="gmt_create"></result>
<result property="nikeName" column="nike_name"></result>
<result property="userId" column="user_id"></result>
</resultMap>
<select id="listVenuesInfoOw" parameterType="map" resultMap="venuesInfoOwDTO">
SELECT
t1.ow_id,
t1.venues_info_id,
t1.user_id
FROM
gen_venue_ow t1
WHERE
t1.user_id = #{userId}
</select>
<select id="listPageBookingOrder" parameterType="map" resultMap="bookingOrderList">
SELECT
t1.booking_item_id,
t2.venues_name,
t2.project_name,
t1.ground_name,
t1.booking_order_date,
t1.time_str,
t1.time_end,
t1.price,
t1.gmt_create,
t2.nick_name,
t2.user_id
FROM
gen_booking_item t1
LEFT JOIN gen_booking_info t2 ON t2.ground_booking_id = t1.booking_info_id
WHERE
t1.is_delete = '0'
AND t1.order_type = '0'
<if test="data_authority != null and data_authority != ''">
<if test="data_authority == 'self' ">
AND FIND_IN_SET(t2.venues_info_id,#{venuesInfoIds})
</if>
</if>
<if test="keywords != null and keywords != ''">
AND (
t2.venues_name LIKE CONCAT('%',#{keywords},'%')
OR
t2.serial LIKE CONCAT('%',#{keywords},'%')
OR
t2.project_name LIKE CONCAT('%',#{keywords},'%')
)
</if>
ORDER BY
t1.gmt_create DESC,t1.booking_order_date ASC
</select>
<insert id="saveBookingInfo" parameterType="map">
INSERT INTO gen_booking_info
(ground_booking_id,serial,venues_info_id,venues_name,venues_project_id,project_name,user_id,nick_name,id_card_number,
phone_number,order_type,creator,gmt_create,modifier,gmt_modified,is_delete)
VALUES
(#{groundBookingId},#{serial},#{venuesInfoId},#{venuesName},#{venuesProjectId},#{projectName},#{userId},#{nickName},#{idCardNumber},
#{phoneNumber},#{orderType},#{creator},#{gmtCreate},#{modifier},#{gmtModified},#{isDelete})
</insert>
<insert id="saveBookingItem" parameterType="map">
INSERT INTO gen_booking_item
(booking_item_id,booking_info_id,ground_item_id,ground_name,booking_order_date,time_str,time_end,price,arrive_type,
creator,gmt_create,modifier,gmt_modified,is_delete)
VALUES
(#{bookingItemId},#{bookingInfoId},#{groundItemId},#{groundName},#{bookingOrderDate},#{timeStr},#{timeEnd},
#{price},#{arriveType},#{creator},#{gmtCreate},#{modifier},#{gmtModified},#{isDelete})
</insert>
<select id="getVenueFromProject" parameterType="map" resultMap="venueProjectDTO">
SELECT
t1.venues_project_id,
t2.dictionary_name project_name,
t3.venues_info_id,
t3.venue_name
FROM
gen_venues_project t1
LEFT JOIN gen_venues_icon_data t2 ON t2.dictionary_id = t1.project_category
2022-08-03 16:21:06 +08:00
LEFT JOIN gen_venues_info t3 ON t3.venues_info_id = t1.venue_id
WHERE
t1.venues_project_id = #{venuesProjectId}
</select>
<select id="listPageMyTicket" parameterType="map" resultMap="myTicketListDTO">
SELECT
t1.ground_booking_id,
t1.serial,
t1.venues_name,
t1.project_name,
t1.order_type,
t1.gmt_create,
t2.venue_panorama,
IFNULL(SUM(t3.price),'0') price,
COUNT(t3.booking_item_id) item_count
FROM
gen_booking_info t1
LEFT JOIN gen_venues_info t2 ON t2.venues_info_id = t1.venues_info_id
LEFT JOIN gen_booking_item t3 ON t3.booking_info_id = t1.ground_booking_id AND t3.order_type <![CDATA[<>]]> '1'
WHERE
t1.user_id = #{userId}
<if test="showSwitch != null and showSwitch != '' and showSwitch == 'normal'">
AND t1.order_type = '0'
</if>
<if test="showSwitch != null and showSwitch != '' and showSwitch == 'cancel'">
AND t1.order_type = '1'
</if>
GROUP BY
2022-12-13 15:12:42 +08:00
t1.ground_booking_id,
t1.serial,
t1.venues_name,
t1.project_name,
t1.order_type,
t1.gmt_create,
t2.venue_panorama,
t3.price,
t3.booking_item_id
2022-08-03 16:21:06 +08:00
ORDER BY
t1.order_type ASC,t1.gmt_create DESC
</select>
<select id="getItemByDateTime" parameterType="map" resultMap="groundBooingItemDTO">
SELECT
t1.booking_item_id,
t1.booking_info_id,
t1.ground_item_id,
t1.booking_order_date,
t1.time_str,
t1.time_end,
t1.price,
t1.arrive_type,
t1.reason
FROM
gen_booking_item t1
WHERE
t1.booking_info_id = #{bookingInfoId}
AND t1.order_type <![CDATA[<>]]> '1'
AND CONCAT(t1.booking_order_date,' ',t1.time_end) > #{nowDateTime}
</select>
<select id="getBookingInfo" parameterType="map" resultMap="groundBookingInfoDTO">
SELECT
t1.ground_booking_id,
t1.serial,
t1.venues_info_id,
t1.venues_name,
t1.venues_project_id,
t1.project_name,
t1.user_id,
t1.nick_name,
t1.id_card_number,
t1.phone_number,
t1.order_type,
t1.gmt_create,
t2.venue_panorama
FROM
gen_booking_info t1
LEFT JOIN gen_venues_info t2 ON t2.venues_info_id = t1.venues_info_id
WHERE
t1.ground_booking_id = #{groundBookingId}
AND t1.user_id = #{userId}
</select>
<select id="listMyBookingItem" parameterType="map" resultMap="groundBooingItemDTO">
SELECT
t1.booking_item_id,
t1.booking_info_id,
t1.ground_item_id,
t1.ground_name,
t1.booking_order_date,
t1.time_str,
t1.time_end,
t1.price,
t1.arrive_type,
t1.order_type
FROM
gen_booking_item t1
WHERE
t1.booking_info_id = #{bookingInfoId}
ORDER BY
t1.booking_order_date,t1.time_str DESC
</select>
<update id="removeMyTicket" parameterType="map">
UPDATE gen_booking_info SET
order_type = '1',
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
user_id = #{userId}
AND ground_booking_id = #{groundBookingId}
</update>
<update id="removeMyItemTicket" parameterType="map">
UPDATE gen_booking_item SET
order_type = '1',
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
creator = #{userId}
AND booking_info_id = #{groundBookingId}
</update>
<update id="removeMyTicketItem" parameterType="map">
UPDATE gen_booking_item SET
order_type = '1',
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
creator = #{userId}
AND booking_item_id = #{bookingItemId}
</update>
</mapper>