<?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.admin.mapper.UserMapper">
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.admin.entity.User">
|
<id column="id" property="id"/>
|
<result column="user_no" property="userNo"/>
|
<result column="nickname" property="nickname"/>
|
<result column="phone" property="phone"/>
|
<result column="profile_picture" property="profilePicture"/>
|
<result column="state" property="state"/>
|
<result column="createBy" property="createBy"/>
|
<result column="updateBy" property="updateBy"/>
|
<result column="createTime" property="createTime"/>
|
<result column="updateTime" property="updateTime"/>
|
<result column="is_delete" property="isDelete"/>
|
</resultMap>
|
|
<select id="userTrends" resultType="com.ruoyi.admin.vo.UserTrendsVO">
|
SELECT DATE_FORMAT(createTime, '%Y-%m') AS date, COUNT(*) AS number
|
FROM t_user
|
<where>
|
<if test="city != null and city.size() != 0">
|
city_code in
|
<foreach collection="city" item="city" open="(" separator="," close=")">
|
#{city}
|
</foreach>
|
</if>
|
and is_delete = 0
|
and state = 1 and phone IS NOT NULL
|
</where>
|
GROUP BY DATE_FORMAT(createTime, '%Y-%m')
|
ORDER BY date;
|
</select>
|
|
|
<select id="userTrends1" resultType="com.ruoyi.admin.vo.UserTrendsVO">
|
SELECT DATE_FORMAT(createTime, '%Y-%m') AS date, COUNT(*) AS number
|
FROM t_user
|
<where>
|
and is_delete = 0
|
<if test="userIds != null and userIds.size() != 0">
|
and id in
|
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
#{userId}
|
</foreach>
|
</if>
|
and state = 1 and phone IS NOT NULL
|
</where>
|
GROUP BY DATE_FORMAT(createTime, '%Y-%m')
|
ORDER BY date;
|
</select>
|
|
<select id="increaseNumberByYear" resultType="java.lang.Long">
|
SELECT COUNT(*) AS number
|
FROM t_user
|
WHERE YEAR(createTime) = YEAR(NOW())
|
and is_delete = 0 and phone IS NOT NULL
|
<if test="cityList != null and cityList.size() != 0">
|
and city_code in
|
<foreach collection="cityList" item="city" open="(" separator="," close=")">
|
#{city}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="increaseNumberByYear1" resultType="java.lang.Long">
|
SELECT COUNT(*) AS number
|
FROM t_user
|
WHERE YEAR(createTime) = YEAR(NOW())
|
and is_delete = 0 and phone IS NOT NULL
|
<if test="userIds != null and userIds.size() != 0">
|
and id in
|
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
#{userId}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="increaseNumberByMonth" resultType="java.lang.Long">
|
SELECT COUNT(*) AS number
|
FROM t_user
|
WHERE MONTH(createTime) = MONTH(NOW())
|
AND YEAR(createTime) = YEAR(NOW()) and phone IS NOT NULL
|
<if test="cityList != null and cityList.size() != 0">
|
and city_code in
|
<foreach collection="cityList" item="city" open="(" separator="," close=")">
|
#{city}
|
</foreach>
|
</if>
|
</select>
|
|
<select id="increaseNumberByMonth1" resultType="java.lang.Long">
|
SELECT COUNT(*) AS number
|
FROM t_user
|
WHERE MONTH(createTime) = MONTH(NOW())
|
AND YEAR(createTime) = YEAR(NOW()) and phone IS NOT NULL
|
<if test="userIds != null and userIds.size() != 0">
|
and id in
|
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
#{userId}
|
</foreach>
|
</if>
|
|
</select>
|
|
</mapper>
|