|
@@ -1396,132 +1396,8 @@
|
|
|
a.clubID
|
|
|
FROM club a
|
|
|
<include refid="newCmClubJoins"/>
|
|
|
- LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1)
|
|
|
- covs ON a.userID = covs.userID
|
|
|
<where>
|
|
|
- (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 AND u.userIdentity != 8
|
|
|
- <if test="clubID != null and clubID != ''">
|
|
|
- AND a.clubID = #{clubID}
|
|
|
- </if>
|
|
|
- <if test="clubID == 0">
|
|
|
- AND a.clubID = #{clubID}
|
|
|
- </if>
|
|
|
- <if test="userID != null and userID != ''">
|
|
|
- AND a.userID = #{userID}
|
|
|
- </if>
|
|
|
- <if test="account != null and account != ''">
|
|
|
- AND u.account = #{account}
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- AND u.name LIKE concat('%',#{name},'%')
|
|
|
- </if>
|
|
|
- <if test="userName != null and userName != ''">
|
|
|
- AND u.userName LIKE concat('%',#{userName},'%')
|
|
|
- </if>
|
|
|
- <if test="townID != null and townID != ''">
|
|
|
- AND d.provinceID = #{provinceID}
|
|
|
- </if>
|
|
|
- <if test="cityID != null and cityID != ''">
|
|
|
- AND c.cityID = #{cityID}
|
|
|
- </if>
|
|
|
- <if test="townID != null and townID != ''">
|
|
|
- AND b.townID = #{townID}
|
|
|
- </if>
|
|
|
- <if test="status != null and status != ''">
|
|
|
- AND a.status = #{status}
|
|
|
- </if>
|
|
|
- <if test="bindMobile != null and bindMobile != ''">
|
|
|
- AND u.bindMobile LIKE concat('%',#{bindMobile},'%')
|
|
|
- </if>
|
|
|
- <if test="email != null and email != ''">
|
|
|
- AND u.email LIKE concat('%',#{email},'%')
|
|
|
- </if>
|
|
|
- <if test="linkMan != null and linkMan != ''">
|
|
|
- AND a.linkMan LIKE concat('%',#{linkMan},'%')
|
|
|
- </if>
|
|
|
- <if test="startTime != null and startTime != ''">
|
|
|
- AND (u.registerTime > #{startTime} OR u.registerTime = #{startTime})
|
|
|
- </if>
|
|
|
- <if test="endTime != null and endTime != ''">
|
|
|
- AND (u.registerTime < #{endTime} OR u.registerTime = #{endTime})
|
|
|
- </if>
|
|
|
- <if test="startLoginTime != null and startLoginTime != ''">
|
|
|
- AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR a.clubId in (select a.clubId
|
|
|
- FROM ((
|
|
|
- select
|
|
|
- c.clubId,ccr.addTime AS time,c.spID
|
|
|
- FROM club c
|
|
|
- LEFT JOIN user u ON u.userID = c.userID
|
|
|
- LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
|
|
|
- LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
|
- where c.status=90 and sp.status=90
|
|
|
- and ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
- GROUP BY c.clubId
|
|
|
- )UNION(
|
|
|
- select c.clubId,cr.orderTime AS time,c.spID
|
|
|
- FROM club c
|
|
|
- LEFT JOIN user u ON u.userID = c.userID
|
|
|
- LEFT JOIN cm_order cr ON cr.clubId = c.clubId
|
|
|
- LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
|
- where c.status=90 and sp.status=90
|
|
|
- and cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
- GROUP BY c.clubId
|
|
|
- )) a where a.time is not null
|
|
|
- and a.spID=#{spID}
|
|
|
- GROUP BY a.clubId ))
|
|
|
- </if>
|
|
|
- <if test="endLoginTime != null and endLoginTime != ''">
|
|
|
- AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) or u.loginTime is null) and a.clubId not in (select a.clubId
|
|
|
- FROM ((
|
|
|
- select
|
|
|
- c.clubId,ccr.addTime AS time,c.spID
|
|
|
- FROM club c
|
|
|
- LEFT JOIN user u ON u.userID = c.userID
|
|
|
- LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
|
|
|
- LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
|
- where c.status=90 and sp.status=90
|
|
|
- and ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
- GROUP BY c.clubId
|
|
|
- )UNION(
|
|
|
- select c.clubId,cr.orderTime AS time,c.spID
|
|
|
- FROM club c
|
|
|
- LEFT JOIN user u ON u.userID = c.userID
|
|
|
- LEFT JOIN cm_order cr ON cr.clubId = c.clubId
|
|
|
- LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
|
- where c.status=90 and sp.status=90
|
|
|
- and cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
- GROUP BY c.clubId
|
|
|
- )) a where a.time is not null
|
|
|
- and a.spID=#{spID}
|
|
|
- GROUP BY a.clubId )
|
|
|
- </if>
|
|
|
- <if test="userIdentity != null and userIdentity != '' and userIdentity != '8'.toString()">
|
|
|
- AND u.userIdentity = #{userIdentity}
|
|
|
- </if>
|
|
|
- <if test="userIdentity != null and userIdentity != '' and userIdentity == '8'.toString()">
|
|
|
- AND csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
|
|
|
- </if>
|
|
|
- <if test="newDeal != null">
|
|
|
- AND a.newDeal =#{newDeal}
|
|
|
- </if>
|
|
|
- <if test="activeState != null and activeState != ''">
|
|
|
- AND covs.activeState = #{activeState}
|
|
|
- </if>
|
|
|
- <if test="customerValue != null and customerValue != ''">
|
|
|
- AND covs.customerValue = #{customerValue}
|
|
|
- </if>
|
|
|
- <if test="spID != null and spID != ''">
|
|
|
- AND sp.serviceProviderID = #{spID}
|
|
|
- </if>
|
|
|
-
|
|
|
+ AND a.status =90 and u.userOrganizeID IN(0,1) AND u.userIdentity != 8
|
|
|
</where>
|
|
|
- <choose>
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- ORDER BY case when a.status = 91 then 0 else 1 end desc, a.addTime DESC
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
</select>
|
|
|
</mapper>
|