RealtimeInfoSMapper.xml 2.27 KB
<?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.zteits.park.mapper.smapper.RealtimeInfoSMapper">
<select id="getEscapePaymentInfoDuring24hs" resultType="com.zteits.pay.domain.EscapesPaymentDataDO">
	select 
		EscapeCountDuring12To18, 
		PaymentCountDuring12To18,
		EscapeCountDuring18To24,
		PaymentCountDuring18To24,
		EscapeCountDuring0To6,
		PaymentCountDuring0To6,
		EscapeCountDuring6To12,
		PaymentCountDuring6To12
	 from
		(select count(1) EscapeCountDuring12To18 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL -12 HOUR) 
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL -6 HOUR) and order_state = 5) as EscapeCountDuring12To181,
		(select count(1) PaymentCountDuring12To18 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL -12 HOUR) 
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL -6 HOUR) and order_type = 5) as PaymentCountDuring12To181,
		(select count(1) EscapeCountDuring18To24 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL -6 HOUR) 
			and create_date  &lt; curdate() and order_state = 5) as EscapeCountDuring18To24,
		(select count(1) PaymentCountDuring18To24 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL -6 HOUR) 
			and create_date  &lt; curdate() and order_type = 5) as PaymentCountDuring18To24,
		(select count(1) EscapeCountDuring0To6 from td_b_order where
			create_date >= curdate()
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL 6 HOUR) and order_state = 5) as EscapeCountDuring0To6,
		(select count(1) PaymentCountDuring0To6 from td_b_order where
			create_date >= curdate() 
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL 6 HOUR)  and order_type = 5) as PaymentCountDuring0To6,
		(select count(1) EscapeCountDuring6To12 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL 6 HOUR) 
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL 12 HOUR) and order_state = 5) as EscapeCountDuring6To12,
		(select count(1) PaymentCountDuring6To12 from td_b_order where
			create_date >= DATE_ADD(curdate(), INTERVAL 6 HOUR) 
			and create_date  &lt; DATE_ADD(curdate(), INTERVAL 12 HOUR) and order_type = 5) as PaymentCountDuring6To12
</select>
</mapper>