|
@@ -888,34 +888,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="getUserNumber" resultType="com.fs.store.vo.h5.UserListCountVO">
|
|
<select id="getUserNumber" resultType="com.fs.store.vo.h5.UserListCountVO">
|
|
|
SELECT
|
|
SELECT
|
|
|
t.status,
|
|
t.status,
|
|
|
- COUNT(*) AS num
|
|
|
|
|
|
|
+ COUNT(DISTINCT CONCAT(t.user_id, '_', t.project_id)) AS num
|
|
|
FROM (
|
|
FROM (
|
|
|
SELECT
|
|
SELECT
|
|
|
|
|
+ fcu.user_id,
|
|
|
|
|
+ fcu.project_id,
|
|
|
fcu.status
|
|
fcu.status
|
|
|
- FROM fs_user fu
|
|
|
|
|
- INNER JOIN fs_user_company_user fcu ON fcu.user_id = fu.user_id
|
|
|
|
|
- WHERE fu.is_del = 0
|
|
|
|
|
|
|
+ FROM fs_user_company_user fcu
|
|
|
|
|
+ INNER JOIN fs_user fu ON fu.user_id = fcu.user_id AND fu.is_del = 0
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="companyId != null">
|
|
|
|
|
+ AND fcu.company_id = #{companyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="userId != null and userId != 0">
|
|
|
|
|
+ AND fcu.company_user_id = #{userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
<if test="userId != null and userId != 0">
|
|
<if test="userId != null and userId != 0">
|
|
|
- AND fcu.company_user_id = #{userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="companyId != null ">
|
|
|
|
|
- and fcu.company_id = #{companyId}
|
|
|
|
|
- </if>
|
|
|
|
|
- GROUP BY fu.user_id, fcu.project_id, fcu.create_time
|
|
|
|
|
-
|
|
|
|
|
- <if test="userId != null and userId != 0 ">
|
|
|
|
|
UNION ALL
|
|
UNION ALL
|
|
|
SELECT
|
|
SELECT
|
|
|
|
|
+ fcu.user_id,
|
|
|
|
|
+ fcu.project_id,
|
|
|
fcu.status
|
|
fcu.status
|
|
|
- FROM fs_user fu
|
|
|
|
|
- INNER JOIN fs_user_company_user fcu ON fcu.user_id = fu.user_id
|
|
|
|
|
- INNER JOIN company_user cu ON cu.user_id = fcu.company_user_id
|
|
|
|
|
- WHERE fu.is_del = 0
|
|
|
|
|
- AND cu.parent_id = #{userId}
|
|
|
|
|
- <if test="companyId != null ">
|
|
|
|
|
- and fcu.company_id = #{companyId}
|
|
|
|
|
|
|
+ FROM company_user cu
|
|
|
|
|
+ INNER JOIN fs_user_company_user fcu ON fcu.company_user_id = cu.user_id
|
|
|
|
|
+ INNER JOIN fs_user fu ON fu.user_id = fcu.user_id AND fu.is_del = 0
|
|
|
|
|
+ WHERE cu.parent_id = #{userId}
|
|
|
|
|
+ <if test="companyId != null">
|
|
|
|
|
+ AND fcu.company_id = #{companyId}
|
|
|
</if>
|
|
</if>
|
|
|
- GROUP BY fu.user_id, fcu.project_id, fcu.create_time
|
|
|
|
|
</if>
|
|
</if>
|
|
|
) t
|
|
) t
|
|
|
GROUP BY t.status
|
|
GROUP BY t.status
|