|
|
|
@ -4,35 +4,66 @@ |
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
|
|
|
<mapper namespace="com.cjy.back.ybsjHandset.dao.YbsjHandsetMapper"> |
|
|
|
|
|
|
|
|
|
<select id="getPeopleCounting" resultType="map"> |
|
|
|
|
<select id="getPeopleCounting" resultType="int"> |
|
|
|
|
SELECT |
|
|
|
|
SUM( |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN ( cm.appointment_type_id = 5701 AND nmd.write_off = 1 ) |
|
|
|
|
OR ( cm.appointment_type_id != 5701 AND cm.appointment_documents_write_off = 1 ) THEN |
|
|
|
|
IFNULL( cm.appointment_count, 1 ) ELSE 0 |
|
|
|
|
END |
|
|
|
|
) AS totalTicketCapacity, |
|
|
|
|
SUM( |
|
|
|
|
CASE |
|
|
|
|
|
|
|
|
|
WHEN ( cm.appointment_type_id = 5701 AND nmd.write_off IN ( 0, 1 ) ) |
|
|
|
|
OR ( cm.appointment_type_id != 5701 AND cm.appointment_documents_write_off IN ( 0, 1 ) ) THEN |
|
|
|
|
IFNULL( cm.appointment_count, 1 ) ELSE 0 |
|
|
|
|
END |
|
|
|
|
) AS totalBookingCapacity |
|
|
|
|
IFNULL(subquery1.count_result + subquery2.sum_result,0) |
|
|
|
|
FROM |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
COUNT(nmd.id) AS count_result |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info cm |
|
|
|
|
LEFT JOIN ybsj_appointment_people_info nmd ON cm.id = nmd.appointment_documents_id |
|
|
|
|
AND cm.appointment_type_id = 5701 |
|
|
|
|
WHERE |
|
|
|
|
cm.appointment_date = CURDATE( ) |
|
|
|
|
cm.appointment_type_id IN (5701, 5702) |
|
|
|
|
AND cm.appointment_date = CURDATE() |
|
|
|
|
AND cm.scenic_id = #{scenicId} |
|
|
|
|
AND nmd.write_off IN (0, 1) |
|
|
|
|
AND cm.del_flag = 0 |
|
|
|
|
AND ( ( cm.appointment_type_id = 5701 AND nmd.id IS NOT NULL ) OR cm.appointment_type_id != 5701 ); |
|
|
|
|
) AS subquery1, |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
SUM(cm.appointment_count) AS sum_result |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info cm |
|
|
|
|
WHERE |
|
|
|
|
cm.appointment_type_id = 5703 |
|
|
|
|
AND cm.appointment_date = CURDATE() |
|
|
|
|
AND cm.scenic_id = #{scenicId} |
|
|
|
|
AND cm.appointment_documents_write_off IN (0, 1) |
|
|
|
|
AND cm.del_flag = 0 |
|
|
|
|
) AS subquery2; |
|
|
|
|
</select> |
|
|
|
|
<select id="getPeopleCountingTwo" resultType="int"> |
|
|
|
|
SELECT |
|
|
|
|
IFNULL(subquery1.count_result + subquery2.sum_result,0) |
|
|
|
|
FROM |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
COUNT(nmd.id) AS count_result |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info cm |
|
|
|
|
LEFT JOIN ybsj_appointment_people_info nmd ON cm.id = nmd.appointment_documents_id |
|
|
|
|
WHERE |
|
|
|
|
cm.appointment_type_id IN (5701, 5702) |
|
|
|
|
AND cm.appointment_date = CURDATE() |
|
|
|
|
AND cm.scenic_id = #{scenicId} |
|
|
|
|
AND nmd.write_off IN (1) |
|
|
|
|
AND cm.del_flag = 0 |
|
|
|
|
) AS subquery1, |
|
|
|
|
( |
|
|
|
|
SELECT |
|
|
|
|
SUM(cm.appointment_count) AS sum_result |
|
|
|
|
FROM |
|
|
|
|
ybsj_appointment_documents_info cm |
|
|
|
|
WHERE |
|
|
|
|
cm.appointment_type_id = 5703 |
|
|
|
|
AND cm.appointment_date = CURDATE() |
|
|
|
|
AND cm.scenic_id = #{scenicId} |
|
|
|
|
AND cm.appointment_documents_write_off IN (1) |
|
|
|
|
AND cm.del_flag = 0 |
|
|
|
|
) AS subquery2; |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="getHaveTicketsCheckedPage" parameterType="map" resultType="map"> |
|
|
|
|
SELECT |
|
|
|
|
CAST( cn.id AS CHAR) id, |
|
|
|
|