| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?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="com.ruoyi.user.mapper.UserMapper">
- <resultMap type="com.ruoyi.user.domain.User" id="UserResult">
- <result property="id" column="id"/>
- <result property="mobile" column="mobile"/>
- <result property="nickname" column="nickname"/>
- <result property="headPhoto" column="head_photo"/>
- <result property="age" column="age"/>
- <result property="gender" column="gender"/>
- <result property="realName" column="real_name"/>
- <result property="birthday" column="birthday"/>
- <result property="status" column="status"/>
- <result property="lastLoginTime" column="last_login_time"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
- <select id="selectUserRegister" resultType="com.ruoyi.user.domain.vo.UserStatisticsVo">
- SELECT
- create_day,
- COUNT(1) user_sum
- FROM tb_user
- WHERE create_day >= #{start} AND create_day <= #{end}
- GROUP BY create_day
- </select>
- <select id="activeUserCount" resultType="java.lang.Long">
- select count(u.id) from tb_user u
- <if test="businessId != null">
- join tb_user_business_role ub on u.id = ub.user_id
- </if>
- where u.last_login_time >= #{start}
- <if test="businessId != null">
- and ub.business_id = #{businessId}
- </if>
- </select>
- <select id="queryUserCount" resultType="java.lang.Long">
- select count(u.id) from tb_user u
- <if test="businessId != null">
- join tb_user_business_role ub on u.id = ub.user_id
- </if>
- <where>
- <if test="businessId != null">
- and ub.business_id = #{businessId}
- </if>
- <if test="startTime != null">
- and u.create_time >= #{startTime}
- </if>
- <if test="endTime != null">
- and u.create_time <= #{endTime}
- </if>
- </where>
- </select>
- <select id="queryUserStatisticsList" resultType="com.ruoyi.user.domain.vo.UserStatisticsVo">
- select u.create_day, count(u.id) userSum from tb_user u
- <if test="businessId != null">
- join tb_user_business_role ub on u.id = ub.user_id
- </if>
- <where>
- <if test="businessId != null">
- and ub.business_id = #{businessId}
- </if>
- <if test="start != null">
- and u.create_day >= #{start}
- </if>
- <if test="end != null">
- and u.create_day <= #{end}
- </if>
- </where>
- group by u.create_day
- </select>
- <select id="queryUserYearStatisticsList" resultType="com.ruoyi.user.domain.vo.UserStatisticsVo">
- select DATE_FORMAT(u.create_day, '%Y-%m') createDay, count(u.id) userSum from tb_user u
- <if test="businessId != null">
- join tb_user_business_role ub on u.id = ub.user_id
- </if>
- <where>
- <if test="businessId != null">
- and ub.business_id = #{businessId}
- </if>
- <if test="start != null">
- and u.create_day >= #{start}
- </if>
- <if test="end != null">
- and u.create_day <= #{end}
- </if>
- </where>
- group by createDay
- </select>
- </mapper>
|