|
@@ -2,19 +2,19 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei365.user.mapper.SellerMapper">
|
|
|
<select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
|
|
|
- select u.userID as userId,
|
|
|
- u.clubID as clubId,
|
|
|
- u.shopID as shopId,
|
|
|
- u.userName as userName,
|
|
|
- u.name as name,
|
|
|
- u.mobile as mobile,
|
|
|
- u.bindMobile as bindMobile,
|
|
|
- u.email as email,
|
|
|
- u.guideFlag as guideFlag,
|
|
|
- u.userIdentity as userIdentity,
|
|
|
- u.serviceProviderID as serviceProviderId,
|
|
|
+ select u.userID as userId,
|
|
|
+ u.clubID as clubId,
|
|
|
+ u.shopID as shopId,
|
|
|
+ u.userName as userName,
|
|
|
+ u.name as name,
|
|
|
+ u.mobile as mobile,
|
|
|
+ u.bindMobile as bindMobile,
|
|
|
+ u.email as email,
|
|
|
+ u.guideFlag as guideFlag,
|
|
|
+ u.userIdentity as userIdentity,
|
|
|
+ u.serviceProviderID as serviceProviderId,
|
|
|
u.serviceProviderStatus as serviceStatus,
|
|
|
- u.password as password
|
|
|
+ u.password as password
|
|
|
from user u
|
|
|
where u.mobile = #{mobile}
|
|
|
and u.userIdentity = 1
|
|
@@ -33,7 +33,7 @@
|
|
|
</trim>
|
|
|
where userID = #{userId}
|
|
|
</update>
|
|
|
- <update id="setSellerUserHome" >
|
|
|
+ <update id="setSellerUserHome">
|
|
|
update user
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="image != null and image != ''">image = #{image},</if>
|
|
@@ -118,7 +118,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
|
|
|
- select 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,
|
|
@@ -133,11 +133,14 @@
|
|
|
from club c
|
|
|
left join user u on c.userID = u.userID
|
|
|
LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
|
|
|
- LEFT JOIN (SELECT userId, activeStatus, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON coas.userId = c.userId
|
|
|
- LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON covs.userID = c.userID
|
|
|
+ LEFT JOIN (SELECT userId, activeStatus, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1)
|
|
|
+ coas ON coas.userId = c.userId
|
|
|
+ LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON
|
|
|
+ covs.userID = c.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
|
|
|
- LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
|
|
|
+ LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER
|
|
|
+ BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
|
|
|
where
|
|
|
<if test="1 == type">
|
|
|
c.spID = #{serviceProviderId}
|
|
@@ -165,18 +168,19 @@
|
|
|
AND c.newDeal =1
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%') OR c.contractMobile LIKE CONCAT('%',#{name},'%'))
|
|
|
+ AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%') OR c.contractMobile LIKE
|
|
|
+ CONCAT('%',#{name},'%'))
|
|
|
</if>
|
|
|
<if test="userIdentity != null">
|
|
|
AND u.userIdentity = #{userIdentity}
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND (ccs.checkTime <![CDATA[ >= ]]> #{startTime}
|
|
|
- OR cpr.createTime <![CDATA[ >= ]]> #{startTime})
|
|
|
+ OR cpr.createTime <![CDATA[ >= ]]> #{startTime})
|
|
|
</if>
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND (ccs.checkTime <![CDATA[ <= ]]> #{endTime}
|
|
|
- OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
|
|
|
+ OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
|
|
|
</if>
|
|
|
<if test="activeState != null and activeState != ''">
|
|
|
AND coas.activeState like concat('%', #{userIdentity}, '%')
|
|
@@ -218,29 +222,32 @@
|
|
|
covs.customerValue AS customerValue,
|
|
|
b.num,
|
|
|
(
|
|
|
- SELECT ADDTIME FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- ADDTIME
|
|
|
- FROM cm_club_remarks
|
|
|
- WHERE clubId = c.clubId
|
|
|
- UNION
|
|
|
- SELECT
|
|
|
- ADDTIME
|
|
|
- FROM cm_visitor_remarks
|
|
|
- WHERE
|
|
|
- clubId IS NOT NULL AND clubId != ''
|
|
|
- AND clubId = c.clubId
|
|
|
- ) b ORDER BY ADDTIME DESC LIMIT 1
|
|
|
+ SELECT ADDTIME FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ADDTIME
|
|
|
+ FROM cm_club_remarks
|
|
|
+ WHERE clubId = c.clubId
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ ADDTIME
|
|
|
+ FROM cm_visitor_remarks
|
|
|
+ WHERE
|
|
|
+ clubId IS NOT NULL AND clubId != ''
|
|
|
+ AND clubId = c.clubId
|
|
|
+ ) b ORDER BY ADDTIME DESC LIMIT 1
|
|
|
) AS ADDTIME
|
|
|
FROM club c
|
|
|
LEFT JOIN USER u ON c.userID = u.userID
|
|
|
LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
|
|
|
- LEFT JOIN (SELECT userId, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON coas.userId = c.userId
|
|
|
- LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON covs.userID = c.userID
|
|
|
- LEFT JOIN (SELECT clubId, COUNT(id) AS num FROM cm_club_remarks GROUP BY clubId
|
|
|
- UNION
|
|
|
- SELECT clubId, COUNT(id) AS num FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '' GROUP BY clubId ) AS b ON c.clubId = b.clubId
|
|
|
+ LEFT JOIN (SELECT userId, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON
|
|
|
+ coas.userId = c.userId
|
|
|
+ LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON
|
|
|
+ covs.userID = c.userID
|
|
|
+ LEFT JOIN (SELECT clubId, COUNT(id) AS num FROM cm_club_remarks GROUP BY clubId
|
|
|
+ UNION
|
|
|
+ SELECT clubId, COUNT(id) AS num FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '' GROUP BY
|
|
|
+ clubId ) AS b ON c.clubId = b.clubId
|
|
|
where c.spId = #{spId}
|
|
|
<if test="type != null">
|
|
|
<if test="type == 1">
|
|
@@ -256,130 +263,130 @@
|
|
|
select * from
|
|
|
(
|
|
|
SELECT DISTINCT ccr.id AS remarksId,
|
|
|
- ccr.remarks,
|
|
|
- ccr.addTime,
|
|
|
- ccr.questionMan,
|
|
|
- ccr.serviceProviderId AS serviceProviderId,
|
|
|
- ccr.createServiceProviderId AS createServiceProviderId,
|
|
|
- csr.leaderId AS leaderId,
|
|
|
- IFNULL(ccr.consultType,'') AS consult,
|
|
|
- c.Name AS clubName,
|
|
|
- ccr.clubType AS clubType,
|
|
|
- ccr.pinceSensitve AS pinceSensitve,
|
|
|
- ccr.satisfied AS satisfied,
|
|
|
- ccr.followup AS followup,
|
|
|
- ccr.extra AS extra,
|
|
|
- ccr.communicationSituation,
|
|
|
- ccr.communicationMethods,
|
|
|
- ccr.customerSource,
|
|
|
- ccr.customerGender,
|
|
|
- ccr.groupAddition,
|
|
|
- ccr.customerAge,
|
|
|
- ifnull(ccr.trendsKeyword, "") as trendsKeyword,
|
|
|
- ifnull(ccr.stateKeyword, "") as stateKeyword,
|
|
|
- (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
- (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,
|
|
|
- cmc.status AS STATUS
|
|
|
+ ccr.remarks,
|
|
|
+ ccr.addTime,
|
|
|
+ ccr.questionMan,
|
|
|
+ ccr.serviceProviderId AS serviceProviderId,
|
|
|
+ ccr.createServiceProviderId AS createServiceProviderId,
|
|
|
+ csr.leaderId AS leaderId,
|
|
|
+ IFNULL(ccr.consultType,'') AS consult,
|
|
|
+ c.Name AS clubName,
|
|
|
+ ccr.clubType AS clubType,
|
|
|
+ ccr.pinceSensitve AS pinceSensitve,
|
|
|
+ ccr.satisfied AS satisfied,
|
|
|
+ ccr.followup AS followup,
|
|
|
+ ccr.extra AS extra,
|
|
|
+ ccr.communicationSituation,
|
|
|
+ ccr.communicationMethods,
|
|
|
+ ccr.customerSource,
|
|
|
+ ccr.customerGender,
|
|
|
+ ccr.groupAddition,
|
|
|
+ ccr.customerAge,
|
|
|
+ ifnull(ccr.trendsKeyword, "") as trendsKeyword,
|
|
|
+ ifnull(ccr.stateKeyword, "") as stateKeyword,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,
|
|
|
+ cmc.status AS STATUS
|
|
|
FROM cm_club_remarks ccr
|
|
|
- LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
|
|
|
- LEFT JOIN club c ON c.clubId=ccr.clubId
|
|
|
- LEFT JOIN cm_serviceTeam_group csg ON ccr.createServiceProviderId = csg.serviceId
|
|
|
- LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
- LEFT JOIN cm_club_report cmc ON cmc.clubId = ccr.clubId
|
|
|
+ LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
|
|
|
+ LEFT JOIN club c ON c.clubId=ccr.clubId
|
|
|
+ LEFT JOIN cm_serviceTeam_group csg ON ccr.createServiceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
+ LEFT JOIN cm_club_report cmc ON cmc.clubId = ccr.clubId
|
|
|
<where>
|
|
|
ccr.clubId = #{clubId}
|
|
|
<if test="search != null and search != ''">
|
|
|
and (
|
|
|
- ccr.remarks like concat('%',#{search},'%')
|
|
|
- or ccr.questionMan like concat('%',#{search},'%')
|
|
|
- or c.name like concat('%',#{search},'%')
|
|
|
- or c.contractMobile like concat('%',#{search},'%')
|
|
|
+ ccr.remarks like concat('%',#{search},'%')
|
|
|
+ or ccr.questionMan like concat('%',#{search},'%')
|
|
|
+ or c.name like concat('%',#{search},'%')
|
|
|
+ or c.contractMobile like concat('%',#{search},'%')
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
UNION
|
|
|
SELECT DISTINCT ccr.id AS remarksId,
|
|
|
- ccr.remarks,
|
|
|
- ccr.addTime AS ADDDATE,
|
|
|
- ccr.questionMan,
|
|
|
- ccr.serviceProviderId,
|
|
|
- ccr.createServiceProviderId AS createServiceProviderId,
|
|
|
- csr.leaderId AS leaderId,
|
|
|
- IFNULL(ccr.consultType,'') AS consult,
|
|
|
- c.Name AS clubName,
|
|
|
- ccr.clubType AS clubType,
|
|
|
- ccr.pinceSensitve AS pinceSensitve,
|
|
|
- ccr.satisfied AS satisfied,
|
|
|
- ccr.followup AS followup,
|
|
|
- ccr.extra AS extra,
|
|
|
- ccr.communicationSituation,
|
|
|
- ccr.communicationMethods,
|
|
|
- ccr.customerSource,
|
|
|
- ccr.customerGender,
|
|
|
- ccr.groupAddition,
|
|
|
- ccr.customerAge,
|
|
|
- ifnull(ccr.trendsKeyword, "") as trendsKeyword,
|
|
|
- ifnull(ccr.stateKeyword, "") as stateKeyword,
|
|
|
- (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
|
|
|
- (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
|
|
|
- cmc.status AS STATUS
|
|
|
+ ccr.remarks,
|
|
|
+ ccr.addTime AS ADDDATE,
|
|
|
+ ccr.questionMan,
|
|
|
+ ccr.serviceProviderId,
|
|
|
+ ccr.createServiceProviderId AS createServiceProviderId,
|
|
|
+ csr.leaderId AS leaderId,
|
|
|
+ IFNULL(ccr.consultType,'') AS consult,
|
|
|
+ c.Name AS clubName,
|
|
|
+ ccr.clubType AS clubType,
|
|
|
+ ccr.pinceSensitve AS pinceSensitve,
|
|
|
+ ccr.satisfied AS satisfied,
|
|
|
+ ccr.followup AS followup,
|
|
|
+ ccr.extra AS extra,
|
|
|
+ ccr.communicationSituation,
|
|
|
+ ccr.communicationMethods,
|
|
|
+ ccr.customerSource,
|
|
|
+ ccr.customerGender,
|
|
|
+ ccr.groupAddition,
|
|
|
+ ccr.customerAge,
|
|
|
+ ifnull(ccr.trendsKeyword, "") as trendsKeyword,
|
|
|
+ ifnull(ccr.stateKeyword, "") as stateKeyword,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
|
|
|
+ cmc.status AS STATUS
|
|
|
FROM cm_visitor_remarks ccr
|
|
|
- LEFT JOIN club c ON c.clubId=ccr.clubId
|
|
|
- LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
|
|
|
- LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
|
|
|
- LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
- LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
|
|
|
+ LEFT JOIN club c ON c.clubId=ccr.clubId
|
|
|
+ LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
|
|
|
+ LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
+ LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
|
|
|
<where>
|
|
|
ccr.remarks IS NOT NULL
|
|
|
AND ccr.clubId is NOT null AND ccr.clubId != '' AND ccr.clubId = #{clubId}
|
|
|
<if test="search != null and search != ''">
|
|
|
and (
|
|
|
- ccr.remarks like concat('%',#{search},'%')
|
|
|
- or ccr.questionMan like concat('%',#{search},'%')
|
|
|
- or c.name like concat('%',#{search},'%')
|
|
|
- or c.contractMobile like concat('%',#{search},'%')
|
|
|
+ ccr.remarks like concat('%',#{search},'%')
|
|
|
+ or ccr.questionMan like concat('%',#{search},'%')
|
|
|
+ or c.name like concat('%',#{search},'%')
|
|
|
+ or c.contractMobile like concat('%',#{search},'%')
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
- ) b
|
|
|
+ ) b
|
|
|
ORDER BY b.addTime DESC
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="findSpUserLoginSum" resultType="java.util.HashMap">
|
|
|
- SELECT
|
|
|
- (CASE coas.activeStatus
|
|
|
- WHEN 0 THEN 'active'
|
|
|
- WHEN 1 THEN 'unActive'
|
|
|
- END) AS activeStatus,
|
|
|
- COUNT(coas.activeStatus) AS number
|
|
|
+ SELECT (CASE coas.activeStatus
|
|
|
+ WHEN 0 THEN 'active'
|
|
|
+ WHEN 1 THEN 'unActive'
|
|
|
+ END) AS activeStatus,
|
|
|
+ COUNT(coas.activeStatus) AS number
|
|
|
FROM cm_organ_active_system coas
|
|
|
LEFT JOIN club c ON coas.userId = c.userId
|
|
|
LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
|
|
|
- WHERE s.serviceProviderId = #{spId} AND coas.stage = 0 AND delType = 1
|
|
|
+ WHERE s.serviceProviderId = #{spId}
|
|
|
+ AND coas.stage = 0
|
|
|
+ AND delType = 1
|
|
|
GROUP BY coas.activeStatus
|
|
|
</select>
|
|
|
|
|
|
<select id="getRemarkClub" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- COUNT(clubId) AS isHaveClub,
|
|
|
- (SELECT COUNT(clubId) FROM club c LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId WHERE s.serviceProviderId = #{spId})AS allclub
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- clubid AS clubID
|
|
|
- FROM cm_club_remarks
|
|
|
- WHERE createServiceProviderId = #{spId}
|
|
|
- GROUP BY clubId
|
|
|
- UNION
|
|
|
- SELECT
|
|
|
- clubId AS clubID
|
|
|
- FROM cm_visitor_remarks
|
|
|
- WHERE
|
|
|
- clubId IS NOT NULL AND clubId != ''
|
|
|
- AND createServiceProviderId = #{spId}
|
|
|
- GROUP BY clubId
|
|
|
- ) b
|
|
|
+ SELECT COUNT(clubId) AS isHaveClub,
|
|
|
+ (SELECT COUNT(clubId)
|
|
|
+ FROM club c
|
|
|
+ LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
|
|
|
+ WHERE s.serviceProviderId = #{spId}) AS allclub
|
|
|
+ FROM (
|
|
|
+ SELECT clubid AS clubID
|
|
|
+ FROM cm_club_remarks
|
|
|
+ WHERE createServiceProviderId = #{spId}
|
|
|
+ GROUP BY clubId
|
|
|
+ UNION
|
|
|
+ SELECT clubId AS clubID
|
|
|
+ FROM cm_visitor_remarks
|
|
|
+ WHERE clubId IS NOT NULL
|
|
|
+ AND clubId != ''
|
|
|
+ AND createServiceProviderId = #{spId}
|
|
|
+ GROUP BY clubId
|
|
|
+ ) b
|
|
|
</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,
|
|
@@ -421,7 +428,7 @@
|
|
|
u.image,
|
|
|
s.mainServiceProviderID AS mainServiceProviderId
|
|
|
from serviceprovider s
|
|
|
- LEFT JOIN USER u ON s.userId = u.userId
|
|
|
+ LEFT JOIN USER u ON s.userId = u.userId
|
|
|
where s.userID = #{userId}
|
|
|
</select>
|
|
|
<select id="findManager" resultType="java.lang.Integer">
|
|
@@ -498,33 +505,36 @@
|
|
|
AND c.clubId =#{clubId}
|
|
|
</if>
|
|
|
and b.pageType in(6,8,11)
|
|
|
- and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
+ 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
|
|
|
+ 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,11)
|
|
|
- and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
+ 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, 11)
|
|
|
+ and DATE(b.accessTime) = DATE(#{accessTime})
|
|
|
</select>
|
|
|
<select id="getBehaviorRecordYesterdayClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
|
|
|
SELECT b.recordID,
|
|
@@ -540,22 +550,28 @@
|
|
|
b.accessClient,
|
|
|
b.isReckon,
|
|
|
b.region,
|
|
|
- c.name,c.linkMan,c.contractMobile,c.clubId,u.image
|
|
|
+ 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})
|
|
|
+ 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>
|
|
|
|
|
|
<select id="getClubAccessDate" resultType="com.caimei365.user.model.vo.RetuenDataVo">
|
|
|
select cbr.accessDate
|
|
|
from cm_behavior_record cbr
|
|
|
- LEFT JOIN club c ON cbr.userID = c.userID
|
|
|
- where c.clubID = #{clubId} group by cbr.accessDate order by cbr.accessDate desc
|
|
|
+ LEFT JOIN club c ON cbr.userID = c.userID
|
|
|
+ where c.clubID = #{clubId}
|
|
|
+ group by cbr.accessDate
|
|
|
+ order by cbr.accessDate desc
|
|
|
</select>
|
|
|
<select id="getClubKeynoteRecord" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
|
|
|
SELECT
|
|
@@ -572,63 +588,131 @@
|
|
|
b.accessClient,
|
|
|
b.isReckon,
|
|
|
b.region,
|
|
|
- p.name AS productName,
|
|
|
+ p.name AS productName,
|
|
|
p.mainImage AS productImage
|
|
|
FROM cm_behavior_record b
|
|
|
LEFT JOIN club c ON b.userID = c.userID
|
|
|
LEFT JOIN product p ON b.productID = p.productID
|
|
|
LEFT JOIN cm_page_type pt ON b.pageType = pt.id
|
|
|
WHERE c.clubID = #{clubId}
|
|
|
- and b.pageType IN (6,11)
|
|
|
- <if test="accessDateList.size()>0">
|
|
|
- and
|
|
|
- <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
|
|
|
- b.accessTime like concat('%', #{accessDate}, '%')
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+ and b.pageType IN (6,11)
|
|
|
+ <if test="accessDateList.size()>0">
|
|
|
+ and
|
|
|
+ <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
|
|
|
+ b.accessTime like concat('%', #{accessDate}, '%')
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
order by b.accessTime desc
|
|
|
</select>
|
|
|
|
|
|
<select id="getUnActiveClub" resultType="com.caimei365.user.model.vo.ClubVo">
|
|
|
- SELECT c.clubID as clubId,
|
|
|
- c.userID as userId,
|
|
|
+ SELECT c.clubID as clubId,
|
|
|
+ c.userID as userId,
|
|
|
c.name,
|
|
|
- c.sname as shortName,
|
|
|
+ c.sname as shortName,
|
|
|
c.contractMobile,
|
|
|
- c.contractEmail as contractEmail,
|
|
|
+ c.contractEmail as contractEmail,
|
|
|
c.contractPhone,
|
|
|
c.linkMan,
|
|
|
- c.provinceID as proviceId,
|
|
|
- c.cityID as cityId,
|
|
|
- c.townID as townId,
|
|
|
+ c.provinceID as proviceId,
|
|
|
+ c.cityID as cityId,
|
|
|
+ c.townID as townId,
|
|
|
c.address,
|
|
|
- c.headpic as shopPhoto,
|
|
|
- c.businessLicenseImage as businessLicense,
|
|
|
+ c.headpic as shopPhoto,
|
|
|
+ c.businessLicenseImage as businessLicense,
|
|
|
c.socialCreditCode,
|
|
|
c.firstClubType,
|
|
|
c.secondClubType,
|
|
|
c.department,
|
|
|
c.medicalPracticeLicenseImg as medicalPracticeLicense,
|
|
|
- c.mainpro as mainProduct,
|
|
|
+ c.mainpro as mainProduct,
|
|
|
c.fax,
|
|
|
- c.info as profile,
|
|
|
- c.spID as serviceProviderId,
|
|
|
- c.addTime, c.status,
|
|
|
+ c.info as profile,
|
|
|
+ c.spID as serviceProviderId,
|
|
|
+ c.addTime,
|
|
|
+ c.status,
|
|
|
c.lastCheckOrderDate,
|
|
|
u.userIdentity,
|
|
|
- c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
|
|
|
- sp.name AS serviceName,
|
|
|
- coas.activeState AS activeState,
|
|
|
- covs.customerValue AS customerValue
|
|
|
- from club c
|
|
|
- left join user u on c.userID = u.userID
|
|
|
- LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
|
|
|
- LEFT JOIN (SELECT userId, activeState, activeStatus FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) AS coas ON coas.userId = c.userId
|
|
|
- LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) AS covs ON covs.userId = c.userId
|
|
|
- LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
|
|
|
+ c.newDeal as newDeal,
|
|
|
+ IF(r.id IS NOT NULL, 1, 0) AS recordCount,
|
|
|
+ sp.name AS serviceName,
|
|
|
+ coas.activeState AS activeState,
|
|
|
+ covs.customerValue AS customerValue
|
|
|
+ from club c
|
|
|
+ left join user u on c.userID = u.userID
|
|
|
+ LEFT JOIN record_link r ON r.`clubId` = c.`clubID`
|
|
|
+ LEFT JOIN (SELECT userId, activeState, activeStatus
|
|
|
+ FROM cm_organ_active_system
|
|
|
+ WHERE stage = 0
|
|
|
+ AND delType = 1) AS coas ON coas.userId = c.userId
|
|
|
+ LEFT JOIN (SELECT userId, customerValue
|
|
|
+ FROM cm_organ_value_system
|
|
|
+ WHERE stage = 0
|
|
|
+ AND delType = 1) AS covs ON covs.userId = c.userId
|
|
|
+ LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
|
|
|
WHERE coas.activeStatus = 1
|
|
|
AND sp.serviceProviderID = #{serviceProviderId}
|
|
|
GROUP BY covs.userID
|
|
|
</select>
|
|
|
|
|
|
+
|
|
|
+ <select id="getActiveClub" resultType="com.caimei365.user.model.vo.ClubVo">
|
|
|
+ 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,
|
|
|
+ c.firstClubType,
|
|
|
+ c.secondClubType,
|
|
|
+ c.department,
|
|
|
+ c.medicalPracticeLicenseImg as medicalPracticeLicense,
|
|
|
+ c.mainpro as mainProduct,
|
|
|
+ c.fax,
|
|
|
+ c.info as profile,
|
|
|
+ c.spID as serviceProviderId,
|
|
|
+ c.addTime, c.status,
|
|
|
+ c.lastCheckOrderDate,
|
|
|
+ u.userIdentity,
|
|
|
+ sp.name AS serviceName,
|
|
|
+ coas.activeState AS activeState
|
|
|
+ FROM cm_behavior_record cbr
|
|
|
+ left join user u on u.userID = cbr..userID
|
|
|
+ LEFT JOIN cm_organ_active_system coas ON coas.userId = cbr.userId
|
|
|
+ LEFT JOIN club c ON c.userId = cbr.userId
|
|
|
+ LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
|
|
|
+ LEFT JOIN (SELECT
|
|
|
+ ccr.clubId,
|
|
|
+ c.userId
|
|
|
+ FROM cm_club_remarks ccr
|
|
|
+ LEFT JOIN club c ON c.clubId = ccr.clubId
|
|
|
+ WHERE ccr.addTime <![CDATA[ >= ]]> #{accessDate} AND ccr.addTime <![CDATA[ <= ]]> NOW()
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ cvr.clubId,
|
|
|
+ c.userId
|
|
|
+ FROM cm_visitor_remarks cvr
|
|
|
+ LEFT JOIN club c ON c.clubId = cvr.clubId
|
|
|
+ WHERE cvr.clubId != '' AND cvr.clubId IS NOT NULL
|
|
|
+ AND cvr.addTime <![CDATA[ >= ]]> #{accessDate} AND cvr.addTime <![CDATA[ <= ]]> NOW()
|
|
|
+ ) cc ON cc.clubId = cbr.userId
|
|
|
+ WHERE cbr.userId != 0
|
|
|
+ AND cbr.accessDate = #{accessDate}
|
|
|
+ AND coas.addTime LIKE concat('%', #{accessDate}, '%')
|
|
|
+ AND coas.activeStatus = 0
|
|
|
+ AND c.spId = #{spId}
|
|
|
+ AND cc.clubId IS NULL
|
|
|
+ GROUP BY cbr.userId
|
|
|
+ ORDER BY MIN(cbr.accessTime) ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|