|
@@ -0,0 +1,473 @@
|
|
|
+<?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.manager.dao.user.CmClubRemarksDao">
|
|
|
+
|
|
|
+ <select id="getServiceList" resultType="com.caimei365.manager.entity.caimei.cmUser.ServiceProviderModel">
|
|
|
+ SELECT
|
|
|
+ ser.serviceProviderID AS serviceProviderId,
|
|
|
+ ser.linkMan,
|
|
|
+ ser.userID AS userId,
|
|
|
+ ser.mainServiceProviderID AS mainServiceProviderId,
|
|
|
+ svs.linkMan as mainName
|
|
|
+ FROM serviceprovider ser
|
|
|
+ LEFT JOIN cm_serviceteam_group csg ON csg.serviceId = ser.serviceProviderID
|
|
|
+ LEFT JOIN cm_serviceteam_role csr ON csr.id = csg.teamId
|
|
|
+ LEFT JOIN (SELECT serviceProviderID, linkMan FROM serviceprovider WHERE validFlag = 1 AND STATUS = 90) svs ON svs.serviceProviderID = csr.leaderId
|
|
|
+ WHERE ser.organizeId = 0 AND ser.validFlag = 1 AND ser.status = 90 and ser.serviceProviderID not in(1371, 1342) GROUP BY ser.serviceProviderID
|
|
|
+ order by csr.createdTime, ser.addTime asc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRegisteredNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ (SELECT COUNT(id) FROM cm_club_remarks WHERE createServiceProviderId = #{serviceProviderId} and addTime LIKE concat('%',#{addTime},'%') AND clubId IS NOT NULL)
|
|
|
+ + (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} AND addTime LIKE concat('%',#{addTime},'%') AND clubId IS NOT NULL)
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getUnregisteredNumber" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ (SELECT COUNT(id) FROM cm_visitor_remarks WHERE serviceProviderId = #{serviceProviderId} and addTime LIKE concat('%',#{addTime},'%') AND clubId IS NULL)
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getClassName" resultType="com.caimei365.manager.entity.caimei.cmUser.CmConsulttype">
|
|
|
+ select id, className
|
|
|
+ from cm_consulttype
|
|
|
+ where delFlag = 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findRegistList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmClubRemarks">
|
|
|
+ SELECT DISTINCT
|
|
|
+ ccr.id AS remarksId, ccr.remarks, s.linkman AS spName, ccr.addTime, ccr.questionMan,
|
|
|
+ csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
|
|
|
+ ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
|
|
|
+ ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender, ccr.groupAddition,
|
|
|
+ ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword, c.newDeal, c.contractMobile, '1' as type,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
+ (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
|
|
|
+ (SELECT NAME FROM product p WHERE p.productID= ccre.productID) AS proName,
|
|
|
+ ccre.reportText AS reportText, ccre.status AS reportStatus, ccre.auditName AS auditName, ccre.auditTime AS auditTime,
|
|
|
+ p.mainImage AS mainImage, ccr.productId as productId, p.name AS productName, sh.name AS shopName, ccr.reportID
|
|
|
+ FROM cm_club_remarks ccr
|
|
|
+ LEFT JOIN serviceprovider s ON ccr.createServiceProviderId = 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 ccre ON ccre.Id= ccr.reportID
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN shop sh ON sh.shopID = p.shopID
|
|
|
+ <where>
|
|
|
+ s.validFlag = 1 and s.serviceProviderID not in (1371, 1342)
|
|
|
+ <if test="remarks != null and remarks !=''">
|
|
|
+ AND ccr.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="clubName !=null and clubName !=''">
|
|
|
+ AND c.Name like concat('%',#{clubName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="leaderId != null">
|
|
|
+ and csr.leaderId = #{leaderId}
|
|
|
+ </if>
|
|
|
+ <if test="serviceProviderId != null">
|
|
|
+ and ccr.serviceProviderId = #{serviceProviderId}
|
|
|
+ </if>
|
|
|
+ <if test="consult != null">
|
|
|
+ and ccr.consultType like concat('%',#{consult},'%')
|
|
|
+ </if>
|
|
|
+ <if test="todayTime != null and todayTime != ''">
|
|
|
+ and ccr.addTime like concat('%', #{todayTime}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="startAddTime != '' and startAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != '' and endAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="newDeal !=null">
|
|
|
+ and c.newDeal=#{newDeal}
|
|
|
+ </if>
|
|
|
+ <if test="reportId !=null">
|
|
|
+ and ccr.reportID=#{reportId}
|
|
|
+ </if>
|
|
|
+ <if test="isRegister != null">
|
|
|
+ <if test="isRegister == 1">
|
|
|
+ and ccr.clubId is null
|
|
|
+ </if>
|
|
|
+ <if test="isRegister == 2">
|
|
|
+ and ccr.clubId is not null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ union
|
|
|
+
|
|
|
+ SELECT DISTINCT
|
|
|
+ ccr.id AS remarksId, ccr.remarks, s.name AS spName, ccr.addTime, ccr.questionMan,
|
|
|
+ csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
|
|
|
+ ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
|
|
|
+ ccr.communicationSituation AS communicationSituation, ccr.communicationMethods AS communicationMethods, ccr.customerSource AS customerSource,
|
|
|
+ ccr.customerGender AS customerGender, ccr.groupAddition AS groupAddition, ccr.customerAge AS customerAge,
|
|
|
+ ccr.trendsKeyword AS trendsKeyword, ccr.stateKeyword AS stateKeyword, c.newDeal, c.contractMobile, '2' as type,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
|
|
|
+ (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
|
|
|
+ (SELECT NAME FROM product p WHERE p.productID= ccre.productID) AS proName,
|
|
|
+ ccre.reportText AS reportText, ccre.status AS reportStatus, ccre.auditName AS auditName, ccre.auditTime AS auditTime,
|
|
|
+ p.mainImage AS mainImage, ccr.productId as productId, p.name AS productName, sh.name AS shopName, ccr.reportID
|
|
|
+ FROM cm_visitor_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.serviceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
+ LEFT JOIN cm_club_report ccre ON ccre.Id= ccr.reportID
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN shop sh ON sh.shopID = p.shopID
|
|
|
+ <where>
|
|
|
+ <if test="remarks != null and remarks !=''">
|
|
|
+ AND ccr.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="clubName !=null and clubName !=''">
|
|
|
+ AND ccr.clubId is not null
|
|
|
+ AND c.Name like concat('%',#{clubName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="leaderId != null">
|
|
|
+ and csr.leaderId = #{leaderId}
|
|
|
+ </if>
|
|
|
+ <if test="serviceProviderId != null">
|
|
|
+ and ccr.serviceProviderId = #{serviceProviderId}
|
|
|
+ </if>
|
|
|
+ <if test="consult != null">
|
|
|
+ and ccr.consultType like concat('%',#{consult},'%')
|
|
|
+ </if>
|
|
|
+ <if test="todayTime != null and todayTime != ''">
|
|
|
+ and ccr.addTime like concat('%', #{todayTime}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="startAddTime != '' and startAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != '' and endAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="newDeal !=null">
|
|
|
+ and c.newDeal=#{newDeal}
|
|
|
+ </if>
|
|
|
+ <if test="reportId !=null">
|
|
|
+ and ccr.reportID=#{reportId}
|
|
|
+ </if>
|
|
|
+ <if test="isRegister != null">
|
|
|
+ <if test="isRegister == 1">
|
|
|
+ and ccr.clubId is null
|
|
|
+ </if>
|
|
|
+ <if test="isRegister == 2">
|
|
|
+ and ccr.clubId is not null
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ and ccr.remarks IS NOT NULL
|
|
|
+ </where>
|
|
|
+ ORDER BY ADDTIME DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateClubRemarks">
|
|
|
+ UPDATE cm_club_remarks
|
|
|
+ SET reportID=null
|
|
|
+ WHERE id = #{remarksId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateVisitorRemarks">
|
|
|
+ UPDATE cm_visitor_remarks
|
|
|
+ SET reportID=null
|
|
|
+ WHERE id = #{remarksId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getProduct" resultType="com.caimei365.manager.entity.caimei.product.Product">
|
|
|
+ select p.*, s.name as shopName from product p
|
|
|
+ left join shop s on s.shopId = p.shopId
|
|
|
+ where p.productId = #{productId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getReportById" resultType="com.caimei365.manager.entity.caimei.cmUser.CmReport">
|
|
|
+ SELECT ccr.Id as reportId, p.mainImage AS mainImage,p.`name` AS productName,c.`name` AS clubName,
|
|
|
+ ccr.reportName AS reportName, ccr.reportText AS reportText, ccr.addTime AS ADDTIME,
|
|
|
+ ccr.status AS STATUS, ccr.auditName AS auditName, ccr.auditTime AS auditTime, c.newDeal, ccr.auditText
|
|
|
+ FROM cm_club_report ccr
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN club c ON c.clubID = ccr.clubID
|
|
|
+ where ccr.id = #{reportId}
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findClassName" resultType="java.lang.String">
|
|
|
+ select className
|
|
|
+ from cm_consulttype
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRemarksImageList" resultType="java.lang.String">
|
|
|
+ select imageUrl
|
|
|
+ from cm_club_remarks_file
|
|
|
+ where remarksId = #{remarksId}
|
|
|
+ and fileType = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRemarksFileList" resultType="com.caimei365.manager.entity.caimei.cmUser.RemarksFileVo">
|
|
|
+ select fileName, ossName
|
|
|
+ from cm_club_remarks_file
|
|
|
+ where remarksId = #{remarksId}
|
|
|
+ and fileType = 2
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getReportList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmReport">
|
|
|
+ SELECT ccr.Id as reportId, p.mainImage AS mainImage,p.`name` AS productName,c.`name` AS clubName,
|
|
|
+ ccr.reportName AS reportName, ccr.reportText AS reportText, ccr.addTime AS ADDTIME,
|
|
|
+ ccr.status AS STATUS, ccr.auditName AS auditName, ccr.auditTime AS auditTime, c.newDeal, ccr.auditText
|
|
|
+ FROM cm_club_report ccr
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN club c ON c.clubID = ccr.clubID
|
|
|
+ <where>
|
|
|
+ <if test="reportId!=null and reportId!=''">
|
|
|
+ AND ccr.id=#{reportId}
|
|
|
+ </if>
|
|
|
+ <if test="productName!=null and productName!=''">
|
|
|
+ AND p.name LIKE concat('%',#{productName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="clubId != null">
|
|
|
+ c.clubID = #{clubId}
|
|
|
+ </if>
|
|
|
+ <if test="clubName!=null and clubName!=''">
|
|
|
+ AND c.name LIKE concat('%',#{clubName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="reportName!=null and reportName!=''">
|
|
|
+ AND ccr.reportName LIKE concat('%',#{reportName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ AND ccr.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="newDeal != null">
|
|
|
+ AND c.newDeal =#{newDeal}
|
|
|
+ </if>
|
|
|
+ <if test="startAddTime != null and startAddTime != ''">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != null and endAddTime != ''">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY ccr.`addTime` DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="clubRemarksConut" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM cm_club_remarks
|
|
|
+ WHERE reportID = #{reportId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="visitorRemarksConut" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM cm_visitor_remarks
|
|
|
+ WHERE reportID = #{reportId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteClubRemarks">
|
|
|
+ DELETE
|
|
|
+ FROM cm_club_report
|
|
|
+ WHERE id = #{reportId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="updateAuditRemarks">
|
|
|
+ UPDATE cm_club_report
|
|
|
+ SET status = #{status},
|
|
|
+ auditName = #{auditName},
|
|
|
+ auditText = #{auditText},
|
|
|
+ auditTime = now()
|
|
|
+ WHERE id = #{reportId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getConsultList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmConsulttype">
|
|
|
+ SELECT
|
|
|
+ a.id AS "id",
|
|
|
+ a.className AS "className",
|
|
|
+ a.status AS "status",
|
|
|
+ a.sortNumber AS "sortNumber",
|
|
|
+ a.createdTime AS "createdTime",
|
|
|
+ a.delflag AS "delflag"
|
|
|
+ FROM cm_consulttype a
|
|
|
+ <where>
|
|
|
+ delFlag = 0
|
|
|
+ <if test="status != null">
|
|
|
+ and a.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="className != null and className != ''">
|
|
|
+ AND a.className LIKE concat('%',#{className},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by sortnumber ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertConsult" parameterType="com.caimei365.manager.entity.caimei.cmUser.CmConsulttype" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ INSERT INTO cm_consulttype(
|
|
|
+ className,
|
|
|
+ status,
|
|
|
+ sortNumber,
|
|
|
+ createdTime,
|
|
|
+ delflag
|
|
|
+ ) VALUES (
|
|
|
+ #{className},
|
|
|
+ 1,
|
|
|
+ #{sortNumber},
|
|
|
+ now(),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateConsult">
|
|
|
+ UPDATE cm_consulttype SET
|
|
|
+ <if test="className != null and className != '' ">
|
|
|
+ className = #{className},
|
|
|
+ </if>
|
|
|
+ <if test="status != null and status != ''">
|
|
|
+ status = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="sortNumber != null">
|
|
|
+ sortNumber = #{sortNumber},
|
|
|
+ </if>
|
|
|
+ <if test="createdTime != null">
|
|
|
+ createdTime = #{createdTime},
|
|
|
+ </if>
|
|
|
+ delflag = 0
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteConsult">
|
|
|
+ update cm_consulttype
|
|
|
+ set delflag = 1
|
|
|
+ WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getVisitRemarkList" resultType="com.caimei365.manager.entity.caimei.cmUser.VisitRemarkVo">
|
|
|
+ SELECT cvr.id as remarksId,cvr.questionManId,cvr.serviceProviderId,cvr.remarks,cvr.addTime,
|
|
|
+ cvr.questionMan,cvr.clubId,cvr.concactTime,c.name as clubName,s.linkMan as serviceName
|
|
|
+ FROM cm_visitor_remarks cvr
|
|
|
+ LEFT JOIN serviceprovider s ON s.serviceProviderID = cvr.serviceProviderId
|
|
|
+ LEFT JOIN club c ON c.clubId= cvr.clubId
|
|
|
+ <where>
|
|
|
+ <if test="serviceProviderId != null and serviceProviderId != ''">
|
|
|
+ AND cvr.serviceProviderId = #{serviceProviderId}
|
|
|
+ </if>
|
|
|
+ <if test="concat == 1">
|
|
|
+ and cvr.clubId is not null
|
|
|
+ </if>
|
|
|
+ <if test="concat == 2">
|
|
|
+ and cvr.clubId is null
|
|
|
+ </if>
|
|
|
+ <if test="questionMan != null and questionMan != ''">
|
|
|
+ and cvr.questionMan LIKE concat('%',#{questionMan},'%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY cvr.questionManId
|
|
|
+ ORDER BY cvr.addTime DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getClubRemarksList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmClubRemarks">
|
|
|
+ SELECT DISTINCT
|
|
|
+ ccr.id AS remarksId, ccr.remarks, s.linkman AS spName, ccr.addTime, ccr.questionMan,
|
|
|
+ csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
|
|
|
+ ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
|
|
|
+ ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender, ccr.groupAddition,
|
|
|
+ ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword, c.newDeal, c.contractMobile, '1' as type,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
+ (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
|
|
|
+ (SELECT NAME FROM product p WHERE p.productID= ccre.productID) AS proName,
|
|
|
+ ccre.reportText AS reportText, ccre.status AS reportStatus, ccre.auditName AS auditName, ccre.auditTime AS auditTime,
|
|
|
+ p.mainImage AS mainImage, ccr.productId as productId, p.name AS productName, sh.name AS shopName, ccr.reportID
|
|
|
+ FROM cm_club_remarks ccr
|
|
|
+ LEFT JOIN serviceprovider s ON ccr.createServiceProviderId = 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 ccre ON ccre.Id= ccr.reportID
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN shop sh ON sh.shopID = p.shopID
|
|
|
+ <where>
|
|
|
+ s.validFlag = 1 and s.serviceProviderID not in (1371, 1359, 1342)
|
|
|
+ <if test="questionManId != null and questionManId != ''">
|
|
|
+ AND ccr.clubId is null
|
|
|
+ </if>
|
|
|
+ <if test="questionManId == null or questionManId == ''">
|
|
|
+ <if test="clubId != null">
|
|
|
+ and ccr.clubId = #{clubId}
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks !=''">
|
|
|
+ AND ccr.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="consult != null">
|
|
|
+ and ccr.consultType like concat('%',#{consult},'%')
|
|
|
+ </if>
|
|
|
+ <if test="startAddTime != '' and startAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != '' and endAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ union
|
|
|
+
|
|
|
+ SELECT DISTINCT
|
|
|
+ ccr.id AS remarksId, ccr.remarks, s.name AS spName, ccr.addTime, ccr.questionMan,
|
|
|
+ csr.leaderId AS leaderId, IFNULL(ccr.consultType,'') AS consult, c.Name AS clubName,
|
|
|
+ ccr.clubType, ccr.pinceSensitve, ccr.satisfied, ccr.followup, ccr.extra,
|
|
|
+ ccr.communicationSituation AS communicationSituation, ccr.communicationMethods AS communicationMethods, ccr.customerSource AS customerSource,
|
|
|
+ ccr.customerGender AS customerGender, ccr.groupAddition AS groupAddition, ccr.customerAge AS customerAge,
|
|
|
+ ccr.trendsKeyword AS trendsKeyword, ccr.stateKeyword AS stateKeyword, c.newDeal, c.contractMobile, '2' as type,
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS serviceName,
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
|
|
|
+ (SELECT mainImage FROM product p WHERE p.productID= ccre.productID) AS productMainImage,
|
|
|
+ (SELECT NAME FROM product p WHERE p.productID= ccre.productID) AS proName,
|
|
|
+ ccre.reportText AS reportText, ccre.status AS reportStatus, ccre.auditName AS auditName, ccre.auditTime AS auditTime,
|
|
|
+ p.mainImage AS mainImage, ccr.productId as productId, p.name AS productName, sh.name AS shopName, ccr.reportID
|
|
|
+ FROM cm_visitor_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.serviceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
+ LEFT JOIN cm_club_report ccre ON ccre.Id= ccr.reportID
|
|
|
+ LEFT JOIN product p ON p.productID = ccr.productID
|
|
|
+ LEFT JOIN shop sh ON sh.shopID = p.shopID
|
|
|
+ <where>
|
|
|
+ <if test="questionManId != null and questionManId != ''">
|
|
|
+ AND ccr.questionManId LIKE concat('%',#{questionManId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="clubId != null">
|
|
|
+ and ccr.clubId = #{clubId}
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks !=''">
|
|
|
+ AND ccr.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="consult != null">
|
|
|
+ and ccr.consultType like concat('%',#{consult},'%')
|
|
|
+ </if>
|
|
|
+ <if test="startAddTime != '' and startAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != '' and endAddTime != null">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY ADDTIME DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getVisitorImageList" resultType="java.lang.String">
|
|
|
+ select imageUrl
|
|
|
+ from cm_visitor_remarks_file
|
|
|
+ where remarksId = #{remarksId}
|
|
|
+ and fileType = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getVisitorFileList" resultType="com.caimei365.manager.entity.caimei.cmUser.RemarksFileVo">
|
|
|
+ select fileName, ossName
|
|
|
+ from cm_visitor_remarks_file
|
|
|
+ where remarksId = #{remarksId}
|
|
|
+ and fileType = 2
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|