|
@@ -1,20 +1,38 @@
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
<!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">
|
|
|
+ <insert id="insertClick">
|
|
|
+ insert into provider_task_click(serviceProviderId, taskId, clickTime, userId, ip)
|
|
|
+ value (#{serviceProviderId}, #{taskId}, now(), #{userId}, #{ip})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertTaskAudit" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into provider_task_audit(taskId, serviceProviderId, taskDesc)
|
|
|
+ values (#{taskId}, #{serviceProviderId}, #{taskDesc})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertTaskImages">
|
|
|
+ insert into provider_task_audit_image
|
|
|
+ values
|
|
|
+ <foreach collection="images" item="item" index="index" separator=",">
|
|
|
+ (#{id},#{item})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
<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
|
|
@@ -32,7 +50,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>
|
|
@@ -97,12 +115,33 @@
|
|
|
WHERE `id` = #{id}
|
|
|
</update>
|
|
|
|
|
|
+ <update id="receiveTask">
|
|
|
+ update provider_task_role
|
|
|
+ set receiveFlag = 1,
|
|
|
+ receiveTime = now()
|
|
|
+ where serviceProviderId = #{serviceProviderId}
|
|
|
+ and taskId = #{taskId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateTaskAudit">
|
|
|
+ update provider_task_role
|
|
|
+ set auditStatus = 1
|
|
|
+ where taskId = #{taskId}
|
|
|
+ and serviceProviderId = #{serviceProviderId}
|
|
|
+ </update>
|
|
|
+
|
|
|
<delete id="deleteTemporaryClub">
|
|
|
DELETE
|
|
|
FROM `club_temporary`
|
|
|
WHERE `id` = #{id}
|
|
|
</delete>
|
|
|
|
|
|
+ <delete id="deleteTaskImages">
|
|
|
+ DELETE
|
|
|
+ FROM provider_task_audit_image
|
|
|
+ WHERE auditId IN (SELECT id FROM provider_task_audit WHERE taskId = #{taskId} AND serviceProviderId = #{serviceProviderId})
|
|
|
+ </delete>
|
|
|
+
|
|
|
<select id="findOrderNum" resultType="integer">
|
|
|
SELECT
|
|
|
COUNT(*)
|
|
@@ -117,7 +156,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,
|
|
@@ -132,11 +171,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}
|
|
@@ -164,18 +206,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}, '%')
|
|
@@ -217,29 +260,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">
|
|
@@ -255,130 +301,128 @@
|
|
|
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,
|
|
@@ -401,26 +445,20 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
|
|
|
- select s.serviceProviderID AS serviceProviderId,
|
|
|
+ select s.serviceProviderID AS serviceProviderId,
|
|
|
s.status,
|
|
|
- s.userID AS userId,
|
|
|
+ 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
|
|
|
+ u.image
|
|
|
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">
|
|
@@ -438,7 +476,7 @@
|
|
|
WHERE s.userID = #{userId}
|
|
|
</select>
|
|
|
<select id="findLeaderId" resultType="java.lang.Integer">
|
|
|
- SELECT leaderId
|
|
|
+ SELECT csr.leaderId
|
|
|
FROM cm_serviceteam_role csr
|
|
|
LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
|
|
|
WHERE s.userId = #{userId}
|
|
@@ -466,7 +504,7 @@
|
|
|
WHERE csg.serviceId != #{serviceProviderId}
|
|
|
</select>
|
|
|
<select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
|
|
|
- SELECT csg.serviceId as serviceProviderId,s.linkMan as name
|
|
|
+ SELECT csg.serviceId as serviceProviderId,s.name as name
|
|
|
FROM cm_serviceteam_group csg
|
|
|
LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
|
|
|
left join serviceprovider s on csg.serviceId=s.serviceProviderID
|
|
@@ -476,7 +514,7 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
|
|
|
- SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
|
|
|
+ SELECT csg.serviceId AS serviceProviderId,s.name AS NAME
|
|
|
FROM cm_serviceteam_group csg
|
|
|
LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
|
|
|
<where>
|
|
@@ -497,7 +535,7 @@
|
|
|
AND c.clubId =#{clubId}
|
|
|
</if>
|
|
|
and b.pageType in(6,8,11)
|
|
|
- and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
+ and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
GROUP BY b.pageLabel LIMIT 10) as a
|
|
|
</select>
|
|
|
<select id="getBehaviorRecordMinutePageLabel" resultType="string">
|
|
@@ -506,66 +544,69 @@
|
|
|
FROM cm_behavior_record b
|
|
|
LEFT JOIN club c ON b.userID = c.userID
|
|
|
LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
|
|
|
- WHERE sp.status=90 and sp.serviceProviderID=#{spId}
|
|
|
+ WHERE sp.status=90 and sp.serviceProviderID=#{spId}
|
|
|
and b.pageType in (69,70,71)
|
|
|
- and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
+ and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
<if test="clubId != null">
|
|
|
AND c.clubId =#{clubId}
|
|
|
</if>
|
|
|
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(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
+ 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(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
</select>
|
|
|
<select id="getBehaviorRecordMinuteClubFrom" 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,
|
|
|
- (select cpaf.fileName from cm_product_archive_content cpac
|
|
|
- left join cm_product_archive_file cpaf on cpaf.archiveContentId=cpac.id
|
|
|
- where cpac.id=b.productArchiveId limit 1)as title,
|
|
|
- ifnull(c.name,b.IP),
|
|
|
- c.linkMan,c.contractMobile,c.clubId,u.image
|
|
|
+ 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,
|
|
|
+ (select cpaf.fileName from cm_product_archive_content cpac
|
|
|
+ left join cm_product_archive_file cpaf on cpaf.archiveContentId=cpac.id
|
|
|
+ where cpac.id=b.productArchiveId limit 1)as title,
|
|
|
+ ifnull(c.name,b.IP),
|
|
|
+ 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
|
|
|
LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
|
|
|
- WHERE sp.status=90 and sp.serviceProviderID=#{spId}
|
|
|
- and b.pageType in (69,70,71)
|
|
|
- and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
+ WHERE sp.status=90 and sp.serviceProviderID=#{spId}
|
|
|
+ and b.pageType in (69,70,71)
|
|
|
+ and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
<if test="clubId != null">
|
|
|
AND c.clubId =#{clubId}
|
|
|
</if>
|
|
@@ -584,14 +625,18 @@
|
|
|
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(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
+ WHERE b.userId != 0
|
|
|
+ and c.spId = #{spId}
|
|
|
+ and b.pageType in (6, 8, 11)
|
|
|
+ and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
|
|
|
GROUP BY c.clubId
|
|
|
</select>
|
|
|
<select id="getBehaviorRecordMinuteClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
|
|
@@ -608,23 +653,30 @@
|
|
|
b.accessClient,
|
|
|
b.isReckon,
|
|
|
b.region,
|
|
|
- ifnull(c.name,b.region)
|
|
|
- ,c.linkMan,c.contractMobile,c.clubId,u.image
|
|
|
+ ifnull(c.name, b.region)
|
|
|
+ ,
|
|
|
+ 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
|
|
|
LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
|
|
|
- WHERE sp.status=90 and sp.serviceProviderID=#{spId}
|
|
|
- and b.pageType in (69,70,71)
|
|
|
- and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
+ WHERE sp.status = 90
|
|
|
+ and sp.serviceProviderID = #{spId}
|
|
|
+ and b.pageType in (69, 70, 71)
|
|
|
+ and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
|
|
|
GROUP BY b.region
|
|
|
</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
|
|
@@ -641,63 +693,138 @@
|
|
|
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="getTaskList" resultType="com.caimei365.user.model.vo.ProviderTaskVo">
|
|
|
+ SELECT ptr.taskId,
|
|
|
+ ptr.receiveFlag,
|
|
|
+ ptr.auditStatus,
|
|
|
+ ptr.receiveTime,
|
|
|
+ cpt.shopId,
|
|
|
+ cpt.title,
|
|
|
+ cpt.content,
|
|
|
+ cpt.reward,
|
|
|
+ cpt.productId,
|
|
|
+ cpt.addTime,
|
|
|
+ cpt.startTime,
|
|
|
+ cpt.endTime,
|
|
|
+ cpt.topPic
|
|
|
+ FROM provider_task_role ptr
|
|
|
+ LEFT JOIN cm_provider_task cpt ON ptr.taskId = cpt.id
|
|
|
+ WHERE cpt.delflag = 0
|
|
|
+ AND ptr.serviceProviderId = #{serviceProviderId}
|
|
|
+ AND ptr.receiveFlag = #{taskType}
|
|
|
+ order by cpt.addTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTaskDetail" resultType="com.caimei365.user.model.vo.ProviderTaskVo">
|
|
|
+ select cpt.id as taskId,
|
|
|
+ cpt.shopId,
|
|
|
+ cpt.productId,
|
|
|
+ cpt.title,
|
|
|
+ cpt.topPic,
|
|
|
+ cpt.content,
|
|
|
+ cpt.reward,
|
|
|
+ cpt.addTime,
|
|
|
+ cpt.startTime,
|
|
|
+ cpt.endTime,
|
|
|
+ p.name as productName,
|
|
|
+ p.mainImage
|
|
|
+ from cm_provider_task cpt
|
|
|
+ left join product p on cpt.productId = p.productId
|
|
|
+ where id = #{taskId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getShopTaskList" resultType="com.caimei365.user.model.vo.ShopTaskVo">
|
|
|
+ select cpt.productId, p.name as productName, p.mainImage, COUNT(ptc.taskId) AS countNum
|
|
|
+ from cm_provider_task cpt
|
|
|
+ LEFT JOIN provider_task_click ptc ON cpt.id = ptc.taskId
|
|
|
+ left join product p on cpt.productId = p.productId
|
|
|
+ where cpt.shopId = #{shopId}
|
|
|
+ GROUP BY cpt.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="providerTasks" type="com.caimei365.user.model.vo.ProviderTaskVo">
|
|
|
+ <result property="receiveFlag" column="receiveFlag"/>
|
|
|
+ <result property="auditStatus" column="auditStatus"/>
|
|
|
+ <result property="taskDesc" column="taskDesc"/>
|
|
|
+ <collection property="images" ofType="java.lang.String">
|
|
|
+ <result column="image"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getProviderTaskDetail" resultMap="providerTasks">
|
|
|
+ select ptr.receiveFlag, ptr.auditStatus, pta.taskDesc, ptai.image
|
|
|
+ from provider_task_role ptr
|
|
|
+ left join provider_task_audit pta on ptr.taskId = pta.taskId
|
|
|
+ left join provider_task_audit_image ptai on pta.id = ptai.auditId
|
|
|
+ where ptr.taskId = #{taskId}
|
|
|
+ and ptr.serviceProviderId = #{serviceProviderId}
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|