区域统计

This commit is contained in:
曹磊 2025-07-04 15:44:12 +08:00
parent 0ad86f5010
commit 92776fde1c
2 changed files with 92 additions and 63 deletions

View File

@ -21,84 +21,113 @@
<select id="queryXqHyTdzlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryXqHyTdzlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
a.housingestate_id as housingestateId, @row_num := @row_num + 1 AS rowNumber,
b.name as housingestateName, t.*
round(sum(a.weight),2) as weight from (SELECT @row_num := 0) r,
from bl_order_info a (
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id select
and a.add_time >= #{hy.beginTime} a.housingestate_id as housingestateId,
and a.add_time &lt;= #{hy.endTime} b.name as housingestateName,
group by a.housingestate_id,b.name round(sum(a.weight),2) as weight
ORDER BY weight desc from bl_order_info a
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
and a.add_time >= #{hy.beginTime}
and a.add_time &lt;= #{hy.endTime}
group by a.housingestate_id,b.name
) t
ORDER BY t.weight desc
</select> </select>
<select id="queryXqHyXzList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryXqHyXzList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
a.housingestate_id as housingestateId, @row_num := @row_num + 1 AS rowNumber,
b.name as housingestateName, t.*
count(a.phone) as cn from (SELECT @row_num := 0) r,
from bl_user_info a (
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id select
where a.register_date >= #{hy.beginTime} a.housingestate_id as housingestateId,
and a.register_date &lt;= #{hy.endTime} b.name as housingestateName,
group by a.housingestate_id,b.name count(a.phone) as cn
ORDER BY cn desc from bl_user_info a
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
where a.register_date >= #{hy.beginTime}
and a.register_date &lt;= #{hy.endTime}
group by a.housingestate_id,b.name
) t
ORDER BY t.cn desc
</select> </select>
<select id="queryXqHyTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryXqHyTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
a.housingestate_id as housingestateId, @row_num := @row_num + 1 AS rowNumber,
b.name as housingestateName, t.*
count(a.id) as cn from (SELECT @row_num := 0) r,
from bl_order_info a (
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id select
where a.add_time >= #{hy.beginTime} a.housingestate_id as housingestateId,
and a.add_time &lt;= #{hy.endTime} b.name as housingestateName,
group by a.housingestate_id,b.name count(a.id) as cn
order by cn desc from bl_order_info a
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
where a.add_time >= #{hy.beginTime}
and a.add_time &lt;= #{hy.endTime}
group by a.housingestate_id,b.name
) t
ORDER BY t.cn desc
</select> </select>
<select id="queryXzhyDetailList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryXzhyDetailList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
a.phone,a.register_date,a.deliveries,a.violations,a.delivered_at,a.status,b.name as housingestateName,c.content @row_num := @row_num + 1 AS rowNumber,
from bl_user_info a t.*
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id from (SELECT @row_num := 0) r,
left join bl_device_info c on a.imei = c.imei (
<where> select
<if test="hy.housingestateId != null and hy.housingestateId !=''"> a.phone,a.register_date,a.deliveries,a.violations,a.delivered_at,a.status,b.name as housingestateName,c.content,a.imei
and a.housingestate_id = #{hy.housingestateId} from bl_user_info a
</if> inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
<if test="hy.beginTime != null and hy.beginTime !=''"> left join bl_device_info c on a.imei = c.imei
and a.register_date >= #{hy.beginTime} <where>
</if> <if test="hy.housingestateId != null and hy.housingestateId !=''">
<if test="hy.endTime != null and hy.endTime !=''"> and a.housingestate_id = #{hy.housingestateId}
and a.register_date &lt;= #{hy.endTime} </if>
</if> <if test="hy.beginTime != null and hy.beginTime !=''">
</where> and a.register_date >= #{hy.beginTime}
</if>
<if test="hy.endTime != null and hy.endTime !=''">
and a.register_date &lt;= #{hy.endTime}
</if>
</where>
) t
ORDER BY t.imei desc
</select> </select>
<select id="queryTdcsDetailList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryTdcsDetailList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
a.phone,a.add_time,a.weight,a.invalid,b.name as housingestateName,d.content,a.cause @row_num := @row_num + 1 AS rowNumber,
from bl_order_info a t.*
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id from (SELECT @row_num := 0) r,
inner join bl_user_info c on a.phone = c.phone (
inner join bl_device_info d on a.imei = d.imei select
<where> a.phone,a.add_time,a.weight,a.invalid,b.name as housingestateName,d.content,a.cause
<if test="hy.housingestateId != null and hy.housingestateId !=''"> from bl_order_info a
and a.housingestate_id = #{hy.housingestateId} inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
</if> inner join bl_user_info c on a.phone = c.phone
<if test="hy.beginTime != null and hy.beginTime !=''"> inner join bl_device_info d on a.imei = d.imei
and a.add_time >= #{hy.beginTime} <where>
</if> <if test="hy.housingestateId != null and hy.housingestateId !=''">
<if test="hy.endTime != null and hy.endTime !=''"> and a.housingestate_id = #{hy.housingestateId}
and a.add_time &lt;= #{hy.endTime} </if>
</if> <if test="hy.beginTime != null and hy.beginTime !=''">
</where> and a.add_time >= #{hy.beginTime}
order by a.add_time desc </if>
<if test="hy.endTime != null and hy.endTime !=''">
and a.add_time &lt;= #{hy.endTime}
</if>
</where>
) t
ORDER BY t.add_time desc
</select> </select>
</mapper> </mapper>

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.zh.view.hy.entity; package org.jeecg.modules.zh.view.hy.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -38,8 +39,7 @@ public class Hy implements Serializable {
private String deliveredAt;//最后投递时间 private String deliveredAt;//最后投递时间
private String status;//用户状态0:拉黑 1:正常 private String status;//用户状态0:拉黑 1:正常
private String cause;//原因 private String cause;//原因
private Integer rowNumber;
} }