123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698 |
- <?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">
- <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,
- u.serviceProviderStatus as serviceStatus,
- u.password as password
- from user u
- where u.mobile = #{mobile}
- and u.userIdentity = 1
- </select>
- <update id="updateServiceProviderByUserId">
- update serviceprovider
- set openid = #{openId},
- 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
- `id`,
- `userId`,
- `name`,
- `shortName`,
- `bindMobile`,
- `contractEmail`,
- `linkMan`,
- `provinceId`,
- `cityId`,
- `townId`,
- `address`,
- `shopPhoto`,
- `businessLicense`,
- `socialCreditCode`,
- `firstClubType`,
- `secondClubType`,
- `department`,
- `medicalPracticeLicense`,
- `mainProduct`,
- `isAgreed`
- FROM
- club_temporary
- WHERE
- userId = #{userId}
- <if test="searchName != null and searchName != ''">
- AND (name LIKE CONCAT('%',#{searchName},'%') OR linkMan LIKE CONCAT('%',#{searchName},'%'))
- </if>
- ORDER BY
- id DESC
- </select>
- <update id="updateClubTemporary">
- UPDATE
- `club_temporary`
- SET `name` = #{name},
- `shortName` = #{shortName},
- `bindMobile` = #{bindMobile},
- `contractEmail` = #{contractEmail},
- `linkMan` = #{linkMan},
- `provinceId` = #{provinceId},
- `cityId` = #{cityId},
- `townId` = #{townId},
- `address` = #{address},
- `shopPhoto` = #{shopPhoto},
- `businessLicense` = #{businessLicense},
- `socialCreditCode` = #{socialCreditCode},
- `firstClubType` = #{firstClubType},
- `secondClubType` = #{secondClubType},
- `department` = #{department},
- `medicalPracticeLicense` = #{medicalPracticeLicense},
- `mainProduct` = #{mainProduct},
- `isAgreed` = #{isAgreed}
- WHERE `id` = #{id}
- </update>
- <delete id="deleteTemporaryClub">
- DELETE
- FROM `club_temporary`
- WHERE `id` = #{id}
- </delete>
- <select id="findOrderNum" resultType="integer">
- SELECT
- COUNT(*)
- FROM
- cm_order
- WHERE
- userID = #{userId}
- AND orderSubmitType IN (0, 1, 2)
- <if test="lastCheckOrderDate != null">
- AND orderTime > #{lastCheckOrderDate}
- </if>
- </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,
- 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,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,
- 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 (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
- where
- <if test="1 == type">
- c.spID = #{serviceProviderId}
- </if>
- <if test="2 == type">
- c.spID in
- <foreach collection="serviceIds" item="id" index="index" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="3 == type">
- r.clubId IS NOT NULL
- AND c.spId=1342
- </if>
- <if test="4 == type">
- c.spID = #{serviceProviderId}
- and coas.activeStatus = 0
- </if>
- <if test="5 == type">
- c.spID = #{serviceProviderId}
- and coas.activeStatus = 1
- </if>
- <if test="6 == type">
- c.spID = #{serviceProviderId}
- 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},'%'))
- </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})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (ccs.checkTime <![CDATA[ <= ]]> #{endTime}
- OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
- </if>
- <if test="activeState != null and activeState != ''">
- AND coas.activeState like concat('%', #{userIdentity}, '%')
- </if>
- <if test="customerValue != null and customerValue != ''">
- AND covs.customerValue like concat('%', #{customerValue}, '%')
- </if>
- <if test="status != null">
- <if test="90 == status and 4 == type and 5 == type">
- and c.status = 90 and u.userIdentity = 4
- </if>
- <if test="1 == status and 4 == type and 5 == type">
- and c.status = 1 and u.userIdentity = 4
- </if>
- <if test="92 == status and 4 == type and 5 == type">
- and c.status = 92 and u.userIdentity = 4
- </if>
- <if test="4 != type and 5 != type and 66 != status">
- AND c.status = #{status}
- </if>
- <if test="4 != type and 5 != type and 66 == status">
- AND c.status IN (1,90,92,93)
- </if>
- </if>
- group by c.clubID
- order by cpr.createTime desc
- </select>
- <select id="getIsRemarkClub" resultType="com.caimei365.user.model.vo.ClubVo">
- SELECT
- c.clubId,
- c.userId,
- c.name,
- c.sname AS shortName,
- c.contractMobile,
- u.userIdentity,
- sp.linkMan AS serviceName,
- coas.activeState AS activeState,
- 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
- ) 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
- where c.spId = #{spId}
- <if test="type != null">
- <if test="type == 1">
- and b.num > 0
- </if>
- <if test="type == 2">
- and b.num IS NULL OR b.num = 0
- </if>
- </if>
- </select>
- <select id="getClubAllRemark" resultType="com.caimei365.user.model.vo.RemarksVo">
- 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
- 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
- <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},'%')
- )
- </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
- 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
- <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},'%')
- )
- </if>
- </where>
- ) 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
- 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
- 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>
- <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,
- 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
- FROM club c
- LEFT JOIN user u ON c.userID=u.userID
- WHERE u.userOrganizeID = 0 AND c.status = '90'
- <if test="searchWord != null and searchWord != ''">
- and (
- c.name LIKE CONCAT('%',#{searchWord},'%') or
- c.linkMan LIKE CONCAT('%',#{searchWord},'%') or
- c.contractMobile LIKE CONCAT('%',#{searchWord},'%')
- )
- </if>
- </select>
- <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
- 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.addTime,
- s.qrCode,
- u.image
- 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
- FROM cm_serviceteam_manager csm
- LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
- LEFT JOIN USER u ON s.userId = u.userId
- WHERE u.bindmobile = #{mobile}
- OR u.mobile = #{mobile}
- </select>
- <select id="findManagerByUser" resultType="java.lang.Integer">
- SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
- FROM cm_serviceteam_manager csm
- LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
- WHERE s.userID = #{userId}
- </select>
- <select id="findLeaderId" resultType="java.lang.Integer">
- SELECT csr.leaderId
- FROM cm_serviceteam_role csr
- LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
- WHERE s.userId = #{userId}
- </select>
- <select id="findLeaderIdByServiceId" resultType="java.lang.Integer">
- select leaderId
- FROM cm_serviceteam_role
- WHERE leaderId = #{serviceProviderId}
- </select>
- <select id="findmanagerIdByServiceId" resultType="java.lang.Integer">
- SELECT serviceProviderId
- FROM cm_serviceteam_manager
- where serviceProviderId = #{serviceProviderId}
- </select>
- <select id="findServiceIds" resultType="java.lang.Integer">
- SELECT csg.serviceId
- FROM cm_serviceteam_group csg
- LEFT JOIN cm_serviceteam_role csr ON csr.id = csg.teamId
- WHERE csr.leaderId = #{serviceProviderId}
- AND csg.serviceId != #{serviceProviderId}
- </select>
- <select id="findAllServiceIds" resultType="java.lang.Integer">
- SELECT csg.serviceId
- FROM cm_serviceteam_group csg
- WHERE csg.serviceId != #{serviceProviderId}
- </select>
- <select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
- SELECT csg.serviceId as serviceProviderId,s.linkMan 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
- WHERE csr.leaderId = #{spId} and s.organizeID = 0
- <if test="status == 1">
- AND csg.serviceId != #{spId}
- </if>
- </select>
- <select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
- SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
- FROM cm_serviceteam_group csg
- LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
- <where>
- s.organizeID = 0
- <if test="status == 1">
- and csg.serviceId != #{spId}
- </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(DATE_SUB(#{accessTime}, INTERVAL 1 day))
- GROUP BY b.pageLabel LIMIT 10) as a
- </select>
- <select id="getBehaviorRecordMinutePageLabel" 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
- 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}
- <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
- 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))
- </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
- 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}
- <if test="clubId != null">
- AND c.clubId =#{clubId}
- </if>
- </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(DATE_SUB(#{accessTime}, INTERVAL 1 day))
- GROUP BY c.clubId
- </select>
- <select id="getBehaviorRecordMinuteClub" 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,
- 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}
- 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
- </select>
- <select id="getClubKeynoteRecord" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
- SELECT
- b.recordID,
- b.userID,
- b.pagePath,
- pt.pageType,
- b.pageLabel,
- b.productID,
- b.accessTime,
- b.accessDuration,
- b.accessDate,
- b.referer,
- b.accessClient,
- b.isReckon,
- b.region,
- 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>
- 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,
- 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,
- 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>
- </mapper>
|