会员统计

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;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -52,8 +55,11 @@ public class HyController {
* 会员投递次数排行榜
*/
@RequestMapping(value = "/queryHyTdcsList", method = RequestMethod.GET)
public Result queryHyTdcsList(Hy hy) {
List<Hy> list = service.queryHyTdcsList(hy);
public Result queryHyTdcsList(Hy 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);
}

View File

@ -1,6 +1,9 @@
package org.jeecg.modules.zh.view.hy.mapper;
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 java.util.List;
@ -13,7 +16,7 @@ public interface HyMapper extends BaseMapper<Hy>{
List<Hy> queryHousingestateList();
List<Hy> queryHyRegisterList(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> queryHyWgList(Hy hy);

View File

@ -29,27 +29,38 @@
</select>
<select id="queryHyXzList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
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')
order by DATE_FORMAT(register_date,'%Y-%m-%d')
) t
ORDER BY t.shortDay asc
</select>
<select id="queryHyTdcsList" parameterType="org.jeecg.modules.zh.view.hy.entity.Hy" resultType="org.jeecg.modules.zh.view.hy.entity.Hy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
phone,
count(*) as cn
from bl_order_info
where add_time >= #{beginTime}
and add_time &lt;= #{endTime}
<if test="housingestateId!=null and housingestateId!=''">
and housingestate_id = #{housingestateId}
where add_time >= #{hy.beginTime}
and add_time &lt;= #{hy.endTime}
<if test="hy.housingestateId!=null and hy.housingestateId!=''">
and housingestate_id = #{hy.housingestateId}
</if>
group by phone
order by cn desc
limit 10
) t
order by t.cn desc
</select>
<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
phone,
money,
weight,
add_time as addTime,
invalid,
start_weight as startWeight,
end_weight as endWeight,
updated_at as updatedAt,
deduct_money as deductMoney
from bl_order_info
where phone = #{phone}
order by add_time desc
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
a.phone,
a.money,
a.weight,
a.add_time as addTime,
a.invalid,
a.start_weight as startWeight,
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>
</mapper>

View File

@ -1,5 +1,7 @@
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 org.jeecg.modules.zh.view.hy.entity.Hy;
import java.util.List;
@ -13,7 +15,7 @@ public interface IHyService extends IService<Hy> {
List<Hy> queryHousingestateList();
List<Hy> queryHyRegisterList(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> queryHyWgList(Hy hy);

View File

@ -1,5 +1,7 @@
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 org.jeecg.modules.system.entity.SysDataLog;
import org.jeecg.modules.zh.view.hy.entity.Hy;
@ -44,8 +46,8 @@ public class HyServiceImpl extends ServiceImpl<HyMapper, Hy> implements IHyServi
* 会员投递次数排行榜
*/
@Override
public List<Hy> queryHyTdcsList(Hy hy) {
return baseMapper.queryHyTdcsList(hy);
public IPage<Hy> queryHyTdcsList(Page<Hy> page, Hy hy) {
return baseMapper.queryHyTdcsList(page,hy);
}
/**