|
@@ -6,20 +6,109 @@
|
|
|
|
|
|
<!-- 加载当前用户所有的停车场基本信息 -->
|
|
<!-- 加载当前用户所有的停车场基本信息 -->
|
|
<select id="loadMyParkingSites" resultType="java.util.HashMap">
|
|
<select id="loadMyParkingSites" resultType="java.util.HashMap">
|
|
- select a.parking_name,a.id from base_parking_info a
|
|
|
|
|
|
+ select a.parking_name,a.id,a.address_,a.total_parking_number from base_parking_info a
|
|
inner join base_parking_user_relation b on a.id = b.parking_id
|
|
inner join base_parking_user_relation b on a.id = b.parking_id
|
|
where b.reg_user_id = #{0} and a.del_flag=false and b.del_flag=false
|
|
where b.reg_user_id = #{0} and a.del_flag=false and b.del_flag=false
|
|
order by a.parking_name
|
|
order by a.parking_name
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <!-- 获取指定停车场已用车位数 可传多个停车场id参数,根据是否有出场时间判断是否占用车位 -->
|
|
|
|
- <select id="getUsingCount" resultType="java.lang.Integer">
|
|
|
|
- select count(distinct car_num) from base_parking_record pr
|
|
|
|
- where pr.del_flag=false
|
|
|
|
- and pr.out_parking_time is null
|
|
|
|
|
|
+ <select id="get" resultType="java.util.HashMap">
|
|
|
|
+ select a.parking_name,a.id,a.address_,a.total_parking_number,pic_url
|
|
|
|
+ from base_parking_info a
|
|
|
|
+ where a.del_flag=false and a.id=#{0}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <!-- 获取指定停车场车位使用信息.设备在线状态 可传多个停车场id参数,根据放行状态(1:放行,0:未放行)判断是否占用车位 -->
|
|
|
|
+ <!-- 设备在线状态判断,离线=离线状态或在线但更新时间已滞后30分钟-->
|
|
|
|
+ <select id="getCrtSeatInfo" resultType="java.util.HashMap">
|
|
|
|
+
|
|
|
|
+ select prtab.using_seat_count,p.id,p.total_parking_number,
|
|
|
|
+ (p.total_parking_number-prtab.using_seat_count) idle_seat_count,
|
|
|
|
+ <![CDATA[
|
|
|
|
+ (select sum((case when channel_status='2' or (channel_status='1' and date_add(update_time, interval 30 minute)<sysdate()) then 1 else 0 end)) offline_count
|
|
|
|
+ from base_parking_channel pc where pc.del_flag=false and pc.park_id=p.id) online_dev_count
|
|
|
|
+ ]]>
|
|
|
|
+ from base_parking_info p
|
|
|
|
+ left join (
|
|
|
|
+ select pr.park_id,count(distinct car_num) using_seat_count from base_parking_record pr
|
|
|
|
+ where pr.del_flag=false
|
|
|
|
+ and pr.release_status='0'
|
|
|
|
+ group by pr.park_id
|
|
|
|
+ ) prtab on p.id=prtab.park_id
|
|
|
|
+ where p.del_flag=false
|
|
|
|
+ and p.id in
|
|
|
|
+ <foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 获取指定停车场的运营动态 可传多个停车场id参数 -->
|
|
|
|
+ <select id="loadTodayTrend" resultType="java.util.HashMap">
|
|
|
|
+ <![CDATA[
|
|
|
|
+ select park_id,sum(total_amount) should_pay,sum(pay_amount) real_pay,
|
|
|
|
+ sum((case when pr.release_status='1' and pay_amount<=0 then 1 else 0 end)) free_pay_count
|
|
|
|
+ ]]>
|
|
|
|
+ from base_parking_record pr
|
|
|
|
+ where pr.del_flag=false
|
|
and park_id in
|
|
and park_id in
|
|
|
|
+ <foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ group by park_id
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 统计指定停车场支付金额、笔数(时间维度:月、今天、全部) -->
|
|
|
|
+ <select id="rptPay" resultType="java.util.HashMap">
|
|
|
|
+ select park_id,sum(pay_amount) total_pay_amount,sum((case when pay_month=#{rptMonth} then pay_amount else 0 end)) month_pay_amount,
|
|
|
|
+ sum((case when pay_date=#{rptDate} then pay_amount else 0 end)) today_pay_amount,
|
|
|
|
+ sum((case when pay_date=#{rptDate} then 1 else 0 end)) today_pay_count
|
|
|
|
+ from (
|
|
|
|
+ select pr.park_id,pp.pay_amount,pp.id,date_format(pp.pay_time,'%Y-%m') pay_month,date_format(pp.pay_time,'%Y-%m-%d') pay_date
|
|
|
|
+ from base_parking_pay pp
|
|
|
|
+ inner join base_parking_record pr on pp.parking_record_id=pr.id
|
|
|
|
+ where pp.del_flag=false and pr.del_flag=false
|
|
|
|
+ and pr.park_id in
|
|
<foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
<foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
- #{id}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+
|
|
|
|
+ ) tab
|
|
|
|
+ group by park_id
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 统计某日的车流量(进入、出去) -->
|
|
|
|
+ <select id="rptDailyCarFlow" resultType="java.util.HashMap">
|
|
|
|
+ select count(car_num) flow_count,date_format(in_parking_time,'%H') flow_hour,'in' flow_type
|
|
|
|
+ from base_parking_record pr
|
|
|
|
+ where pr.del_flag=false and date_format(in_parking_time,'%Y-%m-%d')=#{rptDate}
|
|
|
|
+ and pr.park_id in
|
|
|
|
+ <foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ group by date_format(in_parking_time,'%H')
|
|
|
|
+
|
|
|
|
+ union all
|
|
|
|
+
|
|
|
|
+ select count(car_num) flow_count,date_format(out_parking_time,'%H') flow_hour,'out' flow_type
|
|
|
|
+ from base_parking_record pr
|
|
|
|
+ where pr.del_flag=false and pr.release_status='1' and date_format(out_parking_time,'%Y-%m-%d')=#{rptDate}
|
|
|
|
+ and pr.park_id in
|
|
|
|
+ <foreach collection="parkingIds" item="id" index="index" open="(" close=")" separator=",">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ group by date_format(out_parking_time,'%H')
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 获取某个停车场的匝道设备情况 -->
|
|
|
|
+ <select id="loadParkSitDevs" resultType="java.util.HashMap">
|
|
|
|
+ select channel_name,channel_type,channel_status
|
|
|
|
+ from base_parking_channel
|
|
|
|
+ where del_flag=false and park_id=#{0}
|
|
|
|
+
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|