forked from Gitlink/microservices
Compare commits
6 Commits
master
...
dev_zone_r
| Author | SHA1 | Date |
|---|---|---|
|
|
c5505ae2c5 | |
|
|
e792599fc3 | |
|
|
2e9c3d0f9d | |
|
|
b7e68454ac | |
|
|
e3921d833b | |
|
|
723825064c |
|
|
@ -140,24 +140,55 @@
|
|||
</select>
|
||||
|
||||
<select id="selectActivityUserLibraryListAll" resultType="com.microservices.dms.behaviorImage.domain.ActivityUserLibrary" parameterType="com.microservices.dms.behaviorImage.domain.ActivityUserLibrary">
|
||||
select res.userId,res.loginName,res.userName,res.isExpert,res.isAuth,res.relatedCompetition,res.relatedTask,res.p1+res.p2+res.p3 as "relatedProject" from (
|
||||
select u.id as "userId",u.login as "loginName",u.nickname as "userName",u.is_expert as "isExpert",u.authentication as "isAuth",
|
||||
(select count(1) as "value" from tasks where is_delete='0' and status between 3 and 8 and user_id =u.id) as "relatedTask",
|
||||
(select count(1) from competition_infos ci inner join competition_users cu on ci.id = cu.competition_info_id where cu.user_id =u.id) as "relatedCompetition",
|
||||
(SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id =u.id) as p1,
|
||||
( SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `members` ON `members`.`project_id` = `projects`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` !=u.id AND `members`.`user_id` =u.id) as p2,
|
||||
(SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `team_projects` ON `team_projects`.`project_id` = `projects`.`id`
|
||||
INNER JOIN `teams` ON `teams`.`id` = `team_projects`.`team_id`
|
||||
INNER JOIN `team_users` ON `team_users`.`team_id` = `teams`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` =u.id) as p3
|
||||
from users u) res
|
||||
where (res.relatedCompetition >0 or res.relatedTask >0 or res.p1+res.p2+res.p3>0)
|
||||
<if test="userName != null and userName != ''"> and res.userName like concat('%', #{userName}, '%')</if>
|
||||
SELECT
|
||||
u.id AS userId,
|
||||
u.login AS loginName,
|
||||
u.nickname AS userName,
|
||||
u.is_expert AS isExpert,
|
||||
u.authentication AS isAuth,
|
||||
IFNULL(t.relatedTask, 0) AS relatedTask,
|
||||
IFNULL(c.relatedCompetition, 0) AS relatedCompetition,
|
||||
IFNULL(p1.p1,0) + IFNULL(p2.p2,0) + IFNULL(p3.p3,0) AS relatedProject
|
||||
FROM users u
|
||||
LEFT JOIN (
|
||||
SELECT user_id, COUNT(*) AS relatedTask
|
||||
FROM tasks
|
||||
WHERE is_delete = '0' AND status BETWEEN 3 AND 8
|
||||
GROUP BY user_id
|
||||
) t ON u.id = t.user_id
|
||||
LEFT JOIN (
|
||||
SELECT cu.user_id, COUNT(*) AS relatedCompetition
|
||||
FROM competition_users cu
|
||||
INNER JOIN competition_infos ci ON ci.id = cu.competition_info_id
|
||||
GROUP BY cu.user_id
|
||||
) c ON u.id = c.user_id
|
||||
LEFT JOIN (
|
||||
SELECT user_id, COUNT(*) AS p1
|
||||
FROM projects
|
||||
GROUP BY user_id
|
||||
) p1 ON u.id = p1.user_id
|
||||
LEFT JOIN (
|
||||
SELECT m.user_id, COUNT(*) AS p2
|
||||
FROM members m
|
||||
INNER JOIN projects p ON m.project_id = p.id AND p.user_id != m.user_id
|
||||
GROUP BY m.user_id
|
||||
) p2 ON u.id = p2.user_id
|
||||
LEFT JOIN (
|
||||
SELECT tu.user_id, COUNT(DISTINCT tp.project_id) AS p3
|
||||
FROM team_users tu
|
||||
INNER JOIN teams tm ON tu.team_id = tm.id
|
||||
INNER JOIN team_projects tp ON tm.id = tp.team_id
|
||||
INNER JOIN projects p ON tp.project_id = p.id
|
||||
GROUP BY tu.user_id
|
||||
) p3 ON u.id = p3.user_id
|
||||
WHERE (
|
||||
IFNULL(c.relatedCompetition, 0) > 0
|
||||
OR IFNULL(t.relatedTask, 0) > 0
|
||||
OR (IFNULL(p1.p1,0) + IFNULL(p2.p2,0) + IFNULL(p3.p3,0)) > 0
|
||||
)
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.nickname like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getrelatedProjectCount" resultType="long">
|
||||
|
|
@ -308,23 +339,47 @@
|
|||
</select>
|
||||
|
||||
<select id="getActivityStatistic" resultType="com.microservices.dms.behaviorImage.domain.ActivityUserTotal">
|
||||
select count(1) as "totalUser",sum(r.isExpert) as "totalExpert",sum(r.enterprise_certification+r.authentication) as "authTotal" from (
|
||||
select res.userId,res.loginName,res.userName,res.isExpert,res.authentication,res.enterprise_certification,res.relatedCompetition,res.relatedTask,res.p1+res.p2+res.p3 as "relatedProject" from (
|
||||
select u.id as "userId",u.login as "loginName",u.nickname as "userName",u.is_expert as "isExpert",u.authentication,u.enterprise_certification,
|
||||
(select count(1) as "value" from tasks where is_delete='0' and status between 3 and 8 and user_id =u.id) as "relatedTask",
|
||||
(select count(1) from competition_infos ci inner join competition_users cu on ci.id = cu.competition_info_id where cu.user_id =u.id) as "relatedCompetition",
|
||||
(SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id =u.id) as p1,
|
||||
( SELECT count(1) as "pCount"
|
||||
FROM `projects` INNER JOIN `members` ON `members`.`project_id` = `projects`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` !=u.id AND `members`.`user_id` =u.id) as p2,
|
||||
(SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `team_projects` ON `team_projects`.`project_id` = `projects`.`id`
|
||||
INNER JOIN `teams` ON `teams`.`id` = `team_projects`.`team_id`
|
||||
INNER JOIN `team_users` ON `team_users`.`team_id` = `teams`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` =u.id) as p3
|
||||
from users u) res
|
||||
where res.relatedCompetition >0 or res.relatedTask >0 or res.p1+res.p2+res.p3>0 )r
|
||||
SELECT
|
||||
COUNT(*) AS totalUser,
|
||||
SUM(u.is_expert) AS totalExpert,
|
||||
SUM(u.authentication + u.enterprise_certification) AS authTotal
|
||||
FROM users u
|
||||
LEFT JOIN (
|
||||
SELECT user_id, COUNT(*) AS relatedTask
|
||||
FROM tasks
|
||||
WHERE is_delete = '0' AND status BETWEEN 3 AND 8
|
||||
GROUP BY user_id
|
||||
) t ON u.id = t.user_id
|
||||
LEFT JOIN (
|
||||
SELECT cu.user_id, COUNT(*) AS relatedCompetition
|
||||
FROM competition_users cu
|
||||
INNER JOIN competition_infos ci ON ci.id = cu.competition_info_id
|
||||
GROUP BY cu.user_id
|
||||
) c ON u.id = c.user_id
|
||||
LEFT JOIN (
|
||||
SELECT user_id, COUNT(*) AS p1
|
||||
FROM projects
|
||||
GROUP BY user_id
|
||||
) p1 ON u.id = p1.user_id
|
||||
LEFT JOIN (
|
||||
SELECT m.user_id, COUNT(*) AS p2
|
||||
FROM members m
|
||||
INNER JOIN projects p ON m.project_id = p.id AND p.user_id != m.user_id
|
||||
GROUP BY m.user_id
|
||||
) p2 ON u.id = p2.user_id
|
||||
LEFT JOIN (
|
||||
SELECT tu.user_id, COUNT(DISTINCT tp.project_id) AS p3
|
||||
FROM team_users tu
|
||||
INNER JOIN teams tm ON tu.team_id = tm.id
|
||||
INNER JOIN team_projects tp ON tm.id = tp.team_id
|
||||
INNER JOIN projects p ON tp.project_id = p.id
|
||||
GROUP BY tu.user_id
|
||||
) p3 ON u.id = p3.user_id
|
||||
WHERE (
|
||||
IFNULL(c.relatedCompetition, 0) > 0
|
||||
OR IFNULL(t.relatedTask, 0) > 0
|
||||
OR (IFNULL(p1.p1, 0) + IFNULL(p2.p2, 0) + IFNULL(p3.p3, 0)) > 0
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getUserBehaviorSum" resultType="com.microservices.dms.behaviorImage.domain.UserTypeTotalVo">
|
||||
|
|
|
|||
Loading…
Reference in New Issue