Files
ruoyi-vue-pro/yudao-module-mall/yudao-module-statistics-biz/src/main/resources/mapper/member/MemberStatisticsMapper.xml
2023-10-11 12:32:28 +08:00

38 lines
1.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.statistics.dal.mysql.member.MemberStatisticsMapper">
<select id="selectSummaryListByAreaId"
resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberAreaStatisticsRespVO">
SELECT area_id, COUNT(1) AS userCount
FROM member_user
WHERE deleted = FALSE
GROUP BY area_id
<!-- TODO @疯狂order by 是不是交给内存哈 -->
ORDER BY userCount DESC
</select>
<select id="selectSummaryListBySex"
resultType="cn.iocoder.yudao.module.statistics.controller.admin.member.vo.MemberSexStatisticsRespVO">
SELECT sex, COUNT(1) AS userCount
FROM member_user
WHERE deleted = FALSE
GROUP BY sex
<!-- TODO @疯狂order by 是不是交给内存哈 -->
ORDER BY userCount DESC
</select>
<select id="selectUserCount" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM member_user
WHERE deleted = FALSE
<if test="beginTime != null">
AND create_time >= #{beginTime}
</if>
<if test="endTime != null">
AND create_time &lt;= #{endTime}
</if>
</select>
</mapper>