|
@@ -28,6 +28,20 @@
|
|
|
unionId = #{unionId}
|
|
|
where userID = #{userId}
|
|
|
</update>
|
|
|
+ <update id="setSellerHome" parameterType="com.caimei365.user.model.po.ServiceProviderPo">
|
|
|
+ update serviceprovider
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="qrCode != null and qrCode != ''">qrCode = #{qrCode},</if>
|
|
|
+ </trim>
|
|
|
+ where userID = #{userId}
|
|
|
+ </update>
|
|
|
+ <update id="setSellerUserHome" >
|
|
|
+ update user
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="image != null and image != ''">image = #{image},</if>
|
|
|
+ </trim>
|
|
|
+ where userId = #{userId}
|
|
|
+ </update>
|
|
|
|
|
|
<select id="findClubTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
|
|
|
SELECT
|
|
@@ -106,7 +120,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
|
|
|
- select DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
|
|
|
+ select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
|
|
|
c.contractEmail as contractEmail,
|
|
|
c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
|
|
|
c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
|
|
@@ -116,12 +130,14 @@
|
|
|
u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
|
|
|
sp.name AS serviceName,
|
|
|
covs.activeState AS activeState,
|
|
|
- covs.customerValue AS customerValue
|
|
|
+ covs.customerValue AS customerValue,
|
|
|
+ cpr.createTime AS providerTime
|
|
|
from club c
|
|
|
left join user u on c.userID = u.userID
|
|
|
LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
|
|
|
LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
|
|
|
LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
|
|
|
+ LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
|
|
|
where
|
|
|
<if test="1 == type">
|
|
|
c.spID = #{serviceProviderId}
|
|
@@ -136,6 +152,64 @@
|
|
|
r.clubId IS NOT NULL
|
|
|
AND c.spId=1342
|
|
|
</if>
|
|
|
+ <if test="4 == type">
|
|
|
+ c.spID = #{serviceProviderId}
|
|
|
+ AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
|
|
|
+ AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR c.clubId= (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=#{serviceProviderId}
|
|
|
+ GROUP BY a.clubId))
|
|
|
+ </if>
|
|
|
+ <if test="5 == type">
|
|
|
+ c.spID = #{serviceProviderId}
|
|
|
+ AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
|
|
|
+ AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) or u.loginTime is null)and c.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=#{serviceProviderId}
|
|
|
+ GROUP BY a.clubId )
|
|
|
+ </if>
|
|
|
+ <if test="6 == type">
|
|
|
+ c.spID = #{serviceProviderId}
|
|
|
+ AND c.newDeal =1
|
|
|
+ </if>
|
|
|
<if test="status != null and status != 66">
|
|
|
AND c.status = #{status}
|
|
|
</if>
|
|
@@ -149,7 +223,54 @@
|
|
|
AND u.userIdentity = #{userIdentity}
|
|
|
</if>
|
|
|
AND covs.stage = 0 AND covs.delType = 1
|
|
|
- order by c.clubID desc
|
|
|
+ group by c.clubID
|
|
|
+ order by cpr.createTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
|
|
|
+ select
|
|
|
+ COUNT( CASE WHEN a.time=1 THEN 1 END) AS loginSum,
|
|
|
+ ((SELECT count(1) from club
|
|
|
+ WHERE status=90
|
|
|
+ <if test="spID != null">
|
|
|
+ and spID=#{spID}
|
|
|
+ </if>
|
|
|
+ )-COUNT( CASE WHEN a.time=1 THEN 1 END)) AS not_loginSum
|
|
|
+ FROM (select a.*
|
|
|
+ FROM ((
|
|
|
+ select
|
|
|
+ c.clubId,1 AS time,c.spID
|
|
|
+ FROM club c
|
|
|
+ LEFT JOIN user u ON u.userID = c.userID
|
|
|
+ LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
|
+ where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
|
|
|
+ and u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
+ GROUP BY c.clubId
|
|
|
+ )UNION(
|
|
|
+ select
|
|
|
+ c.clubId,1 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 (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
|
|
|
+ and ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
+ GROUP BY c.clubId
|
|
|
+ )UNION(
|
|
|
+ select c.clubId,1 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 (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
|
|
|
+ and cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
|
|
|
+ GROUP BY c.clubId
|
|
|
+ )
|
|
|
+ ) a where 1=1
|
|
|
+ <if test="spID != null">
|
|
|
+ and a.spID=#{spID}
|
|
|
+ </if>
|
|
|
+ GROUP BY a.clubId ) a
|
|
|
</select>
|
|
|
<select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
|
|
|
SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
|
|
@@ -172,24 +293,27 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
|
|
|
- select serviceProviderID AS serviceProviderId,
|
|
|
- status,
|
|
|
- userID AS userId,
|
|
|
- openid,
|
|
|
- unionId,
|
|
|
- name,
|
|
|
- contractMobile,
|
|
|
- linkMan,
|
|
|
- duty,
|
|
|
- contractEmail,
|
|
|
- auditStatus,
|
|
|
- auditTime,
|
|
|
- auditNote,
|
|
|
- validFlag,
|
|
|
- addTime,
|
|
|
- mainServiceProviderID AS mainServiceProviderId
|
|
|
- from serviceprovider
|
|
|
- where userID = #{userId}
|
|
|
+ select s.serviceProviderID AS serviceProviderId,
|
|
|
+ s.status,
|
|
|
+ s.userID AS userId,
|
|
|
+ s.openid,
|
|
|
+ s.unionId,
|
|
|
+ s.name,
|
|
|
+ s.contractMobile,
|
|
|
+ s.linkMan,
|
|
|
+ s.duty,
|
|
|
+ s.contractEmail,
|
|
|
+ s.auditStatus,
|
|
|
+ s.auditTime,
|
|
|
+ s.auditNote,
|
|
|
+ s.validFlag,
|
|
|
+ s.addTime,
|
|
|
+ s.qrCode,
|
|
|
+ u.image,
|
|
|
+ s.mainServiceProviderID AS mainServiceProviderId
|
|
|
+ from serviceprovider s
|
|
|
+ LEFT JOIN USER u ON s.userId = u.userId
|
|
|
+ where s.userID = #{userId}
|
|
|
</select>
|
|
|
<select id="findManager" resultType="java.lang.Integer">
|
|
|
SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
|
|
@@ -254,5 +378,67 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+ <select id="getBehaviorRecordYesterdayPageLabel" resultType="string">
|
|
|
+ SELECT GROUP_CONCAT(a.pageLabel)
|
|
|
+ FROM (SELECT b.pageLabel
|
|
|
+ FROM cm_behavior_record b
|
|
|
+ LEFT JOIN club c ON b.userID = c.userID
|
|
|
+ WHERE b.userId !=0
|
|
|
+ and c.spId=#{spId}
|
|
|
+ <if test="clubId != null">
|
|
|
+ AND c.clubId =#{clubId}
|
|
|
+ </if>
|
|
|
+ and b.pageType in(6,8,11)
|
|
|
+ and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
+ GROUP BY b.pageLabel LIMIT 10) as a
|
|
|
+ </select>
|
|
|
+ <select id="getBehaviorRecordYesterdayClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
|
|
|
+ SELECT
|
|
|
+ b.recordID,
|
|
|
+ b.userID,
|
|
|
+ b.pagePath,
|
|
|
+ b.pageType,
|
|
|
+ b.pageLabel,
|
|
|
+ b.productID,
|
|
|
+ b.accessTime,
|
|
|
+ b.accessDuration,
|
|
|
+ b.accessDate,
|
|
|
+ b.referer,
|
|
|
+ b.accessClient,
|
|
|
+ b.isReckon,
|
|
|
+ b.region,
|
|
|
+ c.name,c.linkMan,c.contractMobile,c.clubId,u.image
|
|
|
+ FROM cm_behavior_record b
|
|
|
+ LEFT JOIN club c ON b.userID = c.userID
|
|
|
+ LEFT JOIN user u ON u.userID = c.userID
|
|
|
+ WHERE b.userId !=0
|
|
|
+ and c.spId=#{spId}
|
|
|
+ and c.clubId=#{clubId}
|
|
|
+ and b.pageType in(6,8,11)
|
|
|
+ and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
+ </select>
|
|
|
+ <select id="getBehaviorRecordYesterdayClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
|
|
|
+ SELECT b.recordID,
|
|
|
+ b.userID,
|
|
|
+ b.pagePath,
|
|
|
+ b.pageType,
|
|
|
+ b.pageLabel,
|
|
|
+ b.productID,
|
|
|
+ b.accessTime,
|
|
|
+ b.accessDuration,
|
|
|
+ b.accessDate,
|
|
|
+ b.referer,
|
|
|
+ b.accessClient,
|
|
|
+ b.isReckon,
|
|
|
+ b.region,
|
|
|
+ c.name,c.linkMan,c.contractMobile,c.clubId,u.image
|
|
|
+ FROM cm_behavior_record b
|
|
|
+ LEFT JOIN club c ON b.userID = c.userID
|
|
|
+ LEFT JOIN user u ON u.userID = c.userID
|
|
|
+ WHERE b.userId !=0
|
|
|
+ and c.spId=#{spId}
|
|
|
+ and b.pageType in(6,8,11)
|
|
|
+ and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
+ GROUP BY c.clubId
|
|
|
+ </select>
|
|
|
</mapper>
|