|
|
|
@ -14,6 +14,9 @@ |
|
|
|
<if test="userName != null and userName != ''"> |
|
|
|
AND um.userName = #{userName} |
|
|
|
</if> |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
<if test="managercompany != null and managercompany != ''"> |
|
|
|
AND um.managercompany = #{managercompany} |
|
|
|
</if> |
|
|
|
@ -45,6 +48,9 @@ |
|
|
|
<if test="userName != null and userName != ''"> |
|
|
|
AND um.userName = #{userName} |
|
|
|
</if> |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
<if test="managercompany != null and managercompany != ''"> |
|
|
|
AND um.managercompany = #{managercompany} |
|
|
|
</if> |
|
|
|
@ -74,12 +80,15 @@ |
|
|
|
AND role = #{role} |
|
|
|
) |
|
|
|
AND u.type != 'Colleague' |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND EXISTS (SELECT 1 FROM usermanagements um WHERE um.userId = u.userId AND um.userName = #{managerName}) |
|
|
|
</if> |
|
|
|
ORDER BY u.created_at DESC |
|
|
|
LIMIT #{offset}, #{limit} |
|
|
|
</select> |
|
|
|
<select id="countByUserIds" resultType="java.lang.Integer"> |
|
|
|
SELECT COUNT(*) FROM users |
|
|
|
WHERE userId IN |
|
|
|
SELECT COUNT(*) FROM users u |
|
|
|
WHERE u.userId IN |
|
|
|
( |
|
|
|
SELECT userId FROM usermanagements |
|
|
|
WHERE userName = #{userName} |
|
|
|
@ -88,7 +97,10 @@ |
|
|
|
AND organization = #{organization} |
|
|
|
AND role = #{role} |
|
|
|
) |
|
|
|
AND type != 'Colleague' |
|
|
|
AND u.type != 'Colleague' |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND EXISTS (SELECT 1 FROM usermanagements um WHERE um.userId = u.userId AND um.userName = #{managerName}) |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="findPublicWithPagination" resultType="com.example.web.entity.Users"> |
|
|
|
@ -123,6 +135,9 @@ |
|
|
|
OR (um.organization IS NOT NULL AND um.organization != '') |
|
|
|
OR (um.role IS NOT NULL AND um.role != '') |
|
|
|
OR (um.userName IS NOT NULL AND um.userName != '')) |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
ORDER BY u.created_at DESC |
|
|
|
LIMIT #{offset}, #{limit} |
|
|
|
</select> |
|
|
|
@ -136,21 +151,32 @@ |
|
|
|
OR (um.organization IS NOT NULL AND um.organization != '') |
|
|
|
OR (um.role IS NOT NULL AND um.role != '') |
|
|
|
OR (um.userName IS NOT NULL AND um.userName != '')) |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="findPersonalWithPagination" resultType="com.example.web.entity.Users"> |
|
|
|
SELECT * FROM users |
|
|
|
SELECT u.*, um.userName as managerName FROM users u |
|
|
|
JOIN usermanagements um ON u.userId = um.userId |
|
|
|
WHERE followup IS NOT NULL AND followup != '' |
|
|
|
AND (sync_statuss IS NULL OR sync_statuss NOT IN (0, 1)) |
|
|
|
AND type != 'Colleague' |
|
|
|
AND type != 'Colleague' |
|
|
|
AND (u.sync_statuss IS NULL OR u.sync_statuss NOT IN (0, 1)) |
|
|
|
AND u.type != 'Colleague' |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
ORDER BY u.created_at DESC |
|
|
|
LIMIT #{offset}, #{limit} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="countPersonal" resultType="java.lang.Integer"> |
|
|
|
SELECT COUNT(*) FROM users |
|
|
|
WHERE followup IS NOT NULL AND followup != '' |
|
|
|
AND (sync_statuss IS NULL OR sync_statuss NOT IN (0, 1)) |
|
|
|
SELECT COUNT(*) FROM users u |
|
|
|
JOIN usermanagements um ON u.userId = um.userId |
|
|
|
WHERE u.followup IS NOT NULL AND u.followup != '' |
|
|
|
AND (u.sync_statuss IS NULL OR u.sync_statuss NOT IN (0, 1)) |
|
|
|
<if test="managerName != null and managerName != ''"> |
|
|
|
AND um.userName = #{managerName} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="findPublicAllWithPagination" resultType="com.example.web.entity.Users"> |
|
|
|
@ -180,7 +206,13 @@ |
|
|
|
<update id="updateFollowup" parameterType="java.util.Map"> |
|
|
|
UPDATE users |
|
|
|
SET followup = #{followup}, |
|
|
|
followup_at = NOW() |
|
|
|
followup_at = NOW(), |
|
|
|
type = #{type}, |
|
|
|
level = #{level}, |
|
|
|
detailedaddress = #{detailedaddress}, |
|
|
|
company = #{company}, |
|
|
|
demand = #{demand}, |
|
|
|
region = #{region} |
|
|
|
WHERE userId = #{userId} |
|
|
|
</update> |
|
|
|
|
|
|
|
|