|
|
@@ -174,7 +174,7 @@
|
|
|
from esm_user_referrer r1
|
|
|
INNER JOIN t1 on t1.id = r1.referrer_id
|
|
|
WHERE r1.level < #{level})
|
|
|
- select u.id as id , u.name as name , u.mobile as mobile, u.status as status
|
|
|
+ select u.id as id , u.name as name , u.mobile as mobile, u.status as status, t1.level as level, u.update_time as updateTime
|
|
|
from t1
|
|
|
LEFT JOIN sys_user u on t1.id = u.id
|
|
|
where 1=1
|
|
|
@@ -191,6 +191,7 @@
|
|
|
AND u.status = #{managementQueryVo.authenticationStatus}
|
|
|
</when>
|
|
|
</choose>
|
|
|
+ order by u.update_time desc
|
|
|
</select>
|
|
|
|
|
|
<select id="employeeIncreaseReportYear" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
|
|
|
@@ -424,4 +425,250 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <select id="authSevenStatics" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamStaticDto">
|
|
|
+ SELECT
|
|
|
+ a.timeDay,
|
|
|
+ IFNULL(b.allCount,0) AS allCount,
|
|
|
+ IFNULL(b.noCount,0) AS noCount,
|
|
|
+ IFNULL(b.yesCount,0) AS yesCount,
|
|
|
+ IFNULL(b.oneCount,0) AS oneCount,
|
|
|
+ IFNULL(b.twoCount,0) AS twoCount,
|
|
|
+ IFNULL(b.threeCount,0) AS threeCount,
|
|
|
+ IFNULL(b.tempCount,0) AS tempCount
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ curdate() AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 1 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 2 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 3 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 4 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 5 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 6 DAY ) AS timeDay
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ select
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) AS time,
|
|
|
+ count(*) as allCount,
|
|
|
+ SUM(CASE WHEN t2.status <![CDATA[ <> ]]> 1 THEN 1 ELSE 0 END) AS noCount,
|
|
|
+ SUM(CASE WHEN t2.status = 1 THEN 1 ELSE 0 END) AS yesCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 3 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS oneCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 2 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS twoCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 1 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS threeCount,
|
|
|
+ SUM(CASE WHEN t2.status <> 1 THEN 1 ELSE 0 END) AS tempCount
|
|
|
+ FROM (
|
|
|
+ with recursive t1 as (select *
|
|
|
+ from esm_user_referrer
|
|
|
+ WHERE referrer_id = #{userId}
|
|
|
+ and id !=#{userId}
|
|
|
+ union all
|
|
|
+ select r1.*
|
|
|
+ from esm_user_referrer r1
|
|
|
+ INNER JOIN t1 on t1.id = r1.referrer_id
|
|
|
+ WHERE r1.level < #{level})
|
|
|
+ select u.id as id , u.name as name , u.mobile as mobile, u.status as status, t1.level as level,u.update_time as
|
|
|
+ updateTime
|
|
|
+ from t1
|
|
|
+ LEFT JOIN sys_user u on t1.id = u.id
|
|
|
+ where 1=1
|
|
|
+ ) AS t2
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
|
|
|
+ and DATE_FORMAT( t2.updateTime, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and
|
|
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' )
|
|
|
+ ORDER BY DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) desc
|
|
|
+ ) b ON a.timeDay = b.time
|
|
|
+ </select>
|
|
|
+ <select id="authNowStatics" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamStaticDto">
|
|
|
+ SELECT
|
|
|
+ a.timeDay,
|
|
|
+ IFNULL(b.allCount,0) AS allCount,
|
|
|
+ IFNULL(b.noCount,0) AS noCount,
|
|
|
+ IFNULL(b.yesCount,0) AS yesCount,
|
|
|
+ IFNULL(b.oneCount,0) AS oneCount,
|
|
|
+ IFNULL(b.twoCount,0) AS twoCount,
|
|
|
+ IFNULL(b.threeCount,0) AS threeCount,
|
|
|
+ IFNULL(b.tempCount,0) AS tempCount
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ curdate() AS timeDay
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ select
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) AS time,
|
|
|
+ count(*) as allCount,
|
|
|
+ SUM(CASE WHEN t2.status <![CDATA[ <> ]]> 1 THEN 1 ELSE 0 END) AS noCount,
|
|
|
+ SUM(CASE WHEN t2.status = 1 THEN 1 ELSE 0 END) AS yesCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 3 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS oneCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 2 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS twoCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 1 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS threeCount,
|
|
|
+ SUM(CASE WHEN t2.status <> 1 THEN 1 ELSE 0 END) AS tempCount
|
|
|
+ FROM (
|
|
|
+ with recursive t1 as (select *
|
|
|
+ from esm_user_referrer
|
|
|
+ WHERE referrer_id = #{userId}
|
|
|
+ and id !=#{userId}
|
|
|
+ union all
|
|
|
+ select r1.*
|
|
|
+ from esm_user_referrer r1
|
|
|
+ INNER JOIN t1 on t1.id = r1.referrer_id
|
|
|
+ WHERE r1.level < #{level})
|
|
|
+ select u.id as id , u.name as name , u.mobile as mobile, u.status as status, t1.level as level,u.update_time as
|
|
|
+ updateTime
|
|
|
+ from t1
|
|
|
+ LEFT JOIN sys_user u on t1.id = u.id
|
|
|
+ where 1=1
|
|
|
+ ) AS t2
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
|
|
|
+ and DATE_FORMAT( t2.updateTime, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and
|
|
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' )
|
|
|
+ ORDER BY DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) desc
|
|
|
+ ) b ON a.timeDay = b.time
|
|
|
+ </select>
|
|
|
+ <select id="authThreeStatics" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamStaticDto">
|
|
|
+ SELECT
|
|
|
+ a.timeDay,
|
|
|
+ IFNULL(b.allCount,0) AS allCount,
|
|
|
+ IFNULL(b.noCount,0) AS noCount,
|
|
|
+ IFNULL(b.yesCount,0) AS yesCount,
|
|
|
+ IFNULL(b.oneCount,0) AS oneCount,
|
|
|
+ IFNULL(b.twoCount,0) AS twoCount,
|
|
|
+ IFNULL(b.threeCount,0) AS threeCount,
|
|
|
+ IFNULL(b.tempCount,0) AS tempCount
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ curdate() AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 1 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 2 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 3 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 4 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 5 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 6 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 7 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 8 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 9 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 10 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 11 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 12 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 13 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 14 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 15 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 16 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 17 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 18 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 19 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 20 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 21 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 22 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 23 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 24 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 25 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 26 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 27 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 28 DAY ) AS timeDay UNION ALL
|
|
|
+ SELECT
|
|
|
+ date_sub( curdate(), INTERVAL 29 DAY ) AS timeDay
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ select
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) AS time,
|
|
|
+ count(*) as allCount,
|
|
|
+ SUM(CASE WHEN t2.status <![CDATA[ <> ]]> 1 THEN 1 ELSE 0 END) AS noCount,
|
|
|
+ SUM(CASE WHEN t2.status = 1 THEN 1 ELSE 0 END) AS yesCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 3 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS oneCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 2 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS twoCount,
|
|
|
+ SUM(CASE WHEN t2.level = #{level} - 1 and t2.STATUS = 1 THEN 1 ELSE 0 END) AS threeCount,
|
|
|
+ SUM(CASE WHEN t2.status <> 1 THEN 1 ELSE 0 END) AS tempCount
|
|
|
+ FROM (
|
|
|
+ with recursive t1 as (select *
|
|
|
+ from esm_user_referrer
|
|
|
+ WHERE referrer_id = #{userId}
|
|
|
+ and id !=#{userId}
|
|
|
+ union all
|
|
|
+ select r1.*
|
|
|
+ from esm_user_referrer r1
|
|
|
+ INNER JOIN t1 on t1.id = r1.referrer_id
|
|
|
+ WHERE r1.level < #{level})
|
|
|
+ select u.id as id , u.name as name , u.mobile as mobile, u.status as status, t1.level as level,u.update_time as
|
|
|
+ updateTime
|
|
|
+ from t1
|
|
|
+ LEFT JOIN sys_user u on t1.id = u.id
|
|
|
+ where 1=1
|
|
|
+ ) AS t2
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
|
|
|
+ and DATE_FORMAT( t2.updateTime, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and
|
|
|
+ DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( t2.updateTime, '%Y-%m-%d' )
|
|
|
+ ORDER BY DATE_FORMAT( t2.updateTime, '%Y-%m-%d' ) desc
|
|
|
+ ) b ON a.timeDay = b.time
|
|
|
+ </select>
|
|
|
+ <select id="authStatics" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamStaticDto">
|
|
|
+ select
|
|
|
+ IFNULL(count(*),0) as allCount,
|
|
|
+ IFNULL(SUM(CASE WHEN t2.status <![CDATA[ <> ]]> 1 THEN 1 ELSE 0 END),0) AS noCount,
|
|
|
+ IFNULL(SUM(CASE WHEN t2.status = 1 THEN 1 ELSE 0 END),0) AS yesCount
|
|
|
+ FROM (
|
|
|
+ with recursive t1 as (select *
|
|
|
+ from esm_user_referrer
|
|
|
+ WHERE referrer_id = #{userId}
|
|
|
+ and id !=#{userId}
|
|
|
+ union all
|
|
|
+ select r1.*
|
|
|
+ from esm_user_referrer r1
|
|
|
+ INNER JOIN t1 on t1.id = r1.referrer_id
|
|
|
+ WHERE r1.level < #{level})
|
|
|
+ select u.id as id , u.name as name , u.mobile as mobile, u.status as status, t1.level as level,u.update_time as
|
|
|
+ updateTime
|
|
|
+ from t1
|
|
|
+ LEFT JOIN sys_user u on t1.id = u.id
|
|
|
+ where 1=1
|
|
|
+ ) AS t2
|
|
|
+ WHERE 1=1
|
|
|
+ </select>
|
|
|
</mapper>
|