会员统计

This commit is contained in:
曹磊 2025-07-04 17:31:46 +08:00
parent 92776fde1c
commit 1914643278
5 changed files with 82 additions and 35 deletions

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,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);
} }
/** /**