Compare commits

..

2 Commits

Author SHA1 Message Date
曹磊 1914643278 会员统计 2025-07-04 17:31:46 +08:00
曹磊 92776fde1c 区域统计 2025-07-04 15:44:12 +08:00
7 changed files with 174 additions and 98 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,7 @@
package org.jeecg.modules.zh.view.hy.controller; package org.jeecg.modules.zh.view.hy.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.zh.view.hy.entity.Hy; import org.jeecg.modules.zh.view.hy.entity.Hy;
@ -7,6 +9,7 @@ import org.jeecg.modules.zh.view.hy.service.IHyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -52,8 +55,11 @@ public class HyController {
* 会员投递次数排行榜 * 会员投递次数排行榜
*/ */
@RequestMapping(value = "/queryHyTdcsList", method = RequestMethod.GET) @RequestMapping(value = "/queryHyTdcsList", method = RequestMethod.GET)
public Result queryHyTdcsList(Hy hy) { public Result queryHyTdcsList(Hy hy,
List<Hy> list = service.queryHyTdcsList(hy); @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<Hy> page = new Page<Hy>(pageNo, pageSize);
IPage<Hy> list = service.queryHyTdcsList(page,hy);
return Result.ok(list); return Result.ok(list);
} }

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;
} }

View File

@ -1,6 +1,9 @@
package org.jeecg.modules.zh.view.hy.mapper; package org.jeecg.modules.zh.view.hy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.zh.view.hy.entity.Hy; import org.jeecg.modules.zh.view.hy.entity.Hy;
import java.util.List; import java.util.List;
@ -13,7 +16,7 @@ public interface HyMapper extends BaseMapper<Hy>{
List<Hy> queryHousingestateList(); List<Hy> queryHousingestateList();
List<Hy> queryHyRegisterList(Hy hy); List<Hy> queryHyRegisterList(Hy hy);
List<Hy> queryHyXzList(Hy hy); List<Hy> queryHyXzList(Hy hy);
List<Hy> queryHyTdcsList(Hy hy); IPage<Hy> queryHyTdcsList(Page<Hy> page, @Param("hy")Hy hy);
List<Hy> queryHyTdzlList(Hy hy); List<Hy> queryHyTdzlList(Hy hy);
List<Hy> queryHyWgList(Hy hy); List<Hy> queryHyWgList(Hy hy);

View File

@ -29,27 +29,38 @@
</select> </select>
<select id="queryHyXzList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryHyXzList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select DATE_FORMAT(register_date,'%Y-%m-%d') as shortDay,count(*) as cn select
from bl_user_info @row_num := @row_num + 1 AS rowNumber,
where register_date >= #{beginTime} t.*
and register_date &lt;= #{endTime} from (SELECT @row_num := 0) r,
group by DATE_FORMAT(register_date,'%Y-%m-%d') (
order by DATE_FORMAT(register_date,'%Y-%m-%d') select DATE_FORMAT(register_date,'%Y-%m-%d') as shortDay,count(*) as cn
from bl_user_info
where register_date >= #{beginTime}
and register_date &lt;= #{endTime}
group by DATE_FORMAT(register_date,'%Y-%m-%d')
) t
ORDER BY t.shortDay asc
</select> </select>
<select id="queryHyTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryHyTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
phone, @row_num := @row_num + 1 AS rowNumber,
count(*) as cn t.*
from bl_order_info from (SELECT @row_num := 0) r,
where add_time >= #{beginTime} (
and add_time &lt;= #{endTime} select
<if test="housingestateId!=null and housingestateId!=''"> phone,
and housingestate_id = #{housingestateId} count(*) as cn
</if> from bl_order_info
group by phone where add_time >= #{hy.beginTime}
order by cn desc and add_time &lt;= #{hy.endTime}
limit 10 <if test="hy.housingestateId!=null and hy.housingestateId!=''">
and housingestate_id = #{hy.housingestateId}
</if>
group by phone
) t
order by t.cn desc
</select> </select>
<select id="queryHyTdzlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryHyTdzlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
@ -108,18 +119,41 @@
<select id="queryHyjlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy"> <select id="queryHyjlList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select select
phone, @row_num := @row_num + 1 AS rowNumber,
money, t.*
weight, from (SELECT @row_num := 0) r,
add_time as addTime, (
invalid, select
start_weight as startWeight, a.phone,
end_weight as endWeight, a.money,
updated_at as updatedAt, a.weight,
deduct_money as deductMoney a.add_time as addTime,
from bl_order_info a.invalid,
where phone = #{phone} a.start_weight as startWeight,
order by add_time desc a.end_weight as endWeight,
a.updated_at as updatedAt,
a.deduct_money as deductMoney,
b.name as housingestateName,
c.content,
a.cause
from bl_order_info a
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
inner join bl_device_info c on a.imei = c.imei
where a.phone = #{phone}
<if test="beginTime != null and beginTime !=''">
and a.add_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and a.add_time &lt;= #{endTime}
</if>
<if test="invalid != null and invalid !=''">
and a.invalid = #{invalid}
</if>
<if test="housingestateId!=null and housingestateId!=''">
and a.housingestate_id = #{housingestateId}
</if>
) t
order by t.addTime desc
</select> </select>
</mapper> </mapper>

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.zh.view.hy.service; package org.jeecg.modules.zh.view.hy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.zh.view.hy.entity.Hy; import org.jeecg.modules.zh.view.hy.entity.Hy;
import java.util.List; import java.util.List;
@ -13,7 +15,7 @@ public interface IHyService extends IService<Hy> {
List<Hy> queryHousingestateList(); List<Hy> queryHousingestateList();
List<Hy> queryHyRegisterList(Hy hy); List<Hy> queryHyRegisterList(Hy hy);
List<Hy> queryHyXzList(Hy hy); List<Hy> queryHyXzList(Hy hy);
List<Hy> queryHyTdcsList(Hy hy); IPage<Hy> queryHyTdcsList(Page<Hy> page, Hy hy);
List<Hy> queryHyTdzlList(Hy hy); List<Hy> queryHyTdzlList(Hy hy);
List<Hy> queryHyWgList(Hy hy); List<Hy> queryHyWgList(Hy hy);

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.zh.view.hy.service.impl; package org.jeecg.modules.zh.view.hy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.system.entity.SysDataLog; import org.jeecg.modules.system.entity.SysDataLog;
import org.jeecg.modules.zh.view.hy.entity.Hy; import org.jeecg.modules.zh.view.hy.entity.Hy;
@ -44,8 +46,8 @@ public class HyServiceImpl extends ServiceImpl<HyMapper, Hy> implements IHyServi
* 会员投递次数排行榜 * 会员投递次数排行榜
*/ */
@Override @Override
public List<Hy> queryHyTdcsList(Hy hy) { public IPage<Hy> queryHyTdcsList(Page<Hy> page, Hy hy) {
return baseMapper.queryHyTdcsList(hy); return baseMapper.queryHyTdcsList(page,hy);
} }
/** /**