增加查询会员数量接口

This commit is contained in:
lxd 2025-06-19 09:18:11 +08:00
parent 1394344ff1
commit 2a1b3d0e32
5 changed files with 31 additions and 1 deletions

View File

@ -64,7 +64,12 @@ public class PersonController {
personService.deletePerson(id); personService.deletePerson(id);
return success(true); return success(true);
} }
@GetMapping("/get-member-register-count")
@Operation(summary = "时间范围获取会员数量")
public CommonResult< List<Map<String, Object>>> getVipCountByDay(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
List<Map<String, Object>> list = personService.getVipCountByDay(startDate, endDate);
return success(list);
}
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得用户基本信息") @Operation(summary = "获得用户基本信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.person.PersonDO; import cn.iocoder.yudao.module.system.dal.dataobject.person.PersonDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.person.vo.*; import cn.iocoder.yudao.module.system.controller.admin.person.vo.*;
import org.apache.ibatis.annotations.Param;
/** /**
* 用户基本信息 Mapper * 用户基本信息 Mapper
@ -42,4 +43,10 @@ public interface PersonMapper extends BaseMapperX<PersonDO> {
} }
Integer selectMaxFamilyId(); Integer selectMaxFamilyId();
/**
* 按天统计开通会员的人数
*/
List<Map<String, Object>> countVipByDay(@Param("startDate") String startDate, @Param("endDate") String endDate);
} }

View File

@ -32,6 +32,10 @@ public interface PersonService {
* 根据主键ID 更新家庭成员 信息 * 根据主键ID 更新家庭成员 信息
* */ * */
Integer updatefamilyinfo(PersonUpfamilyInfoVO updateReqVO); Integer updatefamilyinfo(PersonUpfamilyInfoVO updateReqVO);
/*
* 根据日期范围查询会员数
* */
List<Map<String, Object>> getVipCountByDay(String startDate, String endDate);
/** /**
* 删除用户基本信息 * 删除用户基本信息

View File

@ -58,6 +58,10 @@ public class PersonServiceImpl implements PersonService {
return maxfamilyid; return maxfamilyid;
} }
@Override @Override
public List<Map<String, Object>> getVipCountByDay(String startDate, String endDate) {
return personMapper.countVipByDay(startDate, endDate);
}
@Override
public void deletePerson(Integer id) { public void deletePerson(Integer id) {
// 校验存在 // 校验存在
validatePersonExists(id); validatePersonExists(id);

View File

@ -11,4 +11,14 @@
<select id="selectMaxFamilyId" resultType="int"> <select id="selectMaxFamilyId" resultType="int">
SELECT MAX(familyid) FROM tb_user SELECT MAX(familyid) FROM tb_user
</select> </select>
<select id="countVipByDay" resultType="map">
SELECT DATE_FORMAT(vipStartTime, '%Y-%m-%d') AS date, COUNT(*) AS count
FROM tb_user
WHERE isVip = 1
AND vipStartTime BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE_FORMAT(vipStartTime, '%Y-%m-%d')
ORDER BY date
</select>
</mapper> </mapper>