|
@@ -3,14 +3,26 @@
|
|
<mapper namespace="com.caimei365.user.mapper.ClubReportMapper">
|
|
<mapper namespace="com.caimei365.user.mapper.ClubReportMapper">
|
|
|
|
|
|
<insert id="addClubReport">
|
|
<insert id="addClubReport">
|
|
- INSERT INTO cm_club_report (clubID,productID,reportName,reportText,addTime,status) VALUES(#{clubID},#{productID},#{reportName},#{reportText},now(),2)
|
|
|
|
|
|
+ INSERT INTO cm_club_report (clubID,productID,reportName,reportText,addTime,status) VALUES(#{clubId},#{productId},#{reportName},#{reportText},now(),2)
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <insert id="addVisitorReport">
|
|
|
|
+ INSERT INTO cm_club_report (productID,reportName,reportText,addTime,status) VALUES(#{productId},#{reportName},#{reportText},now(),2)
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="productList" resultType="com.caimei365.user.model.vo.ProductItemVo">
|
|
<select id="productList" resultType="com.caimei365.user.model.vo.ProductItemVo">
|
|
SELECT p.productID,p.mainImage as image,p.name,p.price,s.name as shopName FROM `product` p
|
|
SELECT p.productID,p.mainImage as image,p.name,p.price,s.name as shopName FROM `product` p
|
|
LEFT JOIN shop s ON s.shopID = p.shopID
|
|
LEFT JOIN shop s ON s.shopID = p.shopID
|
|
- WHERE p.validFlag=2 OR p.validFlag=9
|
|
|
|
|
|
+ LEFT JOIN cm_club_report cmc ON p.productID = cmc.productID
|
|
|
|
+ <where>
|
|
|
|
+ (p.validFlag=9 or p.validFlag=2)
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ and p.name LIKE concat('%',#{keyWord},'%')
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="reportList" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
<select id="reportList" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
@@ -19,8 +31,14 @@
|
|
LEFT JOIN cm_club_remarks ccr ON ccr.reportID = cmc.id
|
|
LEFT JOIN cm_club_remarks ccr ON ccr.reportID = cmc.id
|
|
LEFT JOIN club c ON c.clubID = cmc.clubID
|
|
LEFT JOIN club c ON c.clubID = cmc.clubID
|
|
LEFT JOIN product p ON p.productID = cmc.productID
|
|
LEFT JOIN product p ON p.productID = cmc.productID
|
|
- WHERE ccr.`serviceProviderId`=#{serviceProviderId}
|
|
|
|
- AND cmc.`clubID`=#{clubID}
|
|
|
|
|
|
+ <where>
|
|
|
|
+ (ccr.`serviceProviderId`=#{serviceProviderId} OR cmc.`clubID`=#{clubId})
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ AND (p.name LIKE concat('%',#{keyWord},'%')
|
|
|
|
+ or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="reportDetailsList" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
<select id="reportDetailsList" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
@@ -33,22 +51,55 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="reportRemarks" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
<select id="reportRemarks" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
- SELECT DISTINCT
|
|
|
|
- cmc.id AS reportId , c.name AS clubName,c.`newDeal` AS newDeal,cmc.reportName AS reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS productName,cmc.`reportText`
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ ccr.serviceProviderID, cmc.id AS reportId , c.name AS clubName,c.`newDeal` AS newDeal,cmc.reportName AS reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS productName,cmc.`reportText`
|
|
FROM cm_club_report cmc
|
|
FROM cm_club_report cmc
|
|
- LEFT JOIN club c ON c.clubId=cmc.clubId
|
|
|
|
- LEFT JOIN cm_club_remarks ccr ON cmc.ID = ccr.reportID
|
|
|
|
- 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 product p ON p.productID = cmc.productID
|
|
|
|
|
|
+ LEFT JOIN club c ON c.clubId=cmc.clubId
|
|
|
|
+ LEFT JOIN cm_club_remarks ccr ON cmc.ID = ccr.reportID
|
|
|
|
+ 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 product p ON p.productID = cmc.productID
|
|
<where>
|
|
<where>
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ AND (p.name LIKE concat('%',#{keyWord},'%')
|
|
|
|
+ or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
|
|
|
|
+ </if>
|
|
<if test="teamId!=null">
|
|
<if test="teamId!=null">
|
|
and csg.teamId = #{teamId}
|
|
and csg.teamId = #{teamId}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="teamId==null and serviceProviderId!=null">
|
|
|
|
+ and ccr.serviceProviderId=#{serviceProviderId}
|
|
|
|
+ </if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="visitorReportRemarks" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
|
|
+ SELECT
|
|
|
|
+ ccr.serviceProviderID, cmc.id AS reportId , c.name AS clubName,c.`newDeal` AS newDeal,cmc.reportName AS reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS productName,cmc.`reportText`
|
|
|
|
+ FROM cm_club_report cmc
|
|
|
|
+ LEFT JOIN club c ON c.clubId=cmc.clubId
|
|
|
|
+ LEFT JOIN cm_visitor_remarks ccr ON cmc.ID = ccr.reportID
|
|
|
|
+ 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 product p ON p.productID = cmc.productID
|
|
|
|
+ <where>
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ AND (p.name LIKE concat('%',#{keyWord},'%')
|
|
|
|
+ or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+ <if test="teamId!=null">
|
|
|
|
+ and csg.teamId = #{teamId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="teamId==null and serviceProviderId!=null">
|
|
|
|
+ and ccr.serviceProviderId=#{serviceProviderId}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
<select id="reportLeaderId" resultType="java.lang.Integer">
|
|
<select id="reportLeaderId" resultType="java.lang.Integer">
|
|
SELECT id FROM cm_serviceteam_role csr
|
|
SELECT id FROM cm_serviceteam_role csr
|
|
LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
|
|
LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
|
|
@@ -56,4 +107,87 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ <select id="roeprtNa" resultType="java.lang.String">
|
|
|
|
+ SELECT NAME FROM serviceprovider WHERE serviceProviderID=#{serviceProviderId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="visitorMan" resultType="java.lang.String">
|
|
|
|
+ SELECT questionMan FROM cm_visitor_remarks WHERE questionManId=#{questionManId}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="associated" resultType="com.caimei365.user.model.vo.RemarksVo">
|
|
|
|
+ SELECT
|
|
|
|
+ ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId AS serviceProviderId,
|
|
|
|
+ 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,
|
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS recordName,c.newDeal AS newDeal,cmc.status AS STATUS
|
|
|
|
+# (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
|
|
|
|
+ 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.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>
|
|
|
|
+ and cmc.id=#{reportId}
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ and cmc.reportText LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="visitorAssociated" resultType="com.caimei365.user.model.vo.RemarksVo">
|
|
|
|
+ SELECT
|
|
|
|
+ ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId AS serviceProviderId,
|
|
|
|
+ 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,
|
|
|
|
+ (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
|
+ (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS recordName,c.newDeal AS newDeal,cmc.status AS STATUS
|
|
|
|
+# (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
|
|
|
|
+ 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 cmc ON cmc.ID = ccr.reportID
|
|
|
|
+ <where>
|
|
|
|
+ and cmc.id=#{reportId}
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ and cmc.reportText LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <update id="disassociation">
|
|
|
|
+ UPDATE cm_club_remarks SET reportId=NULL WHERE Id=#{remarksId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="visitorDisassociation">
|
|
|
|
+ UPDATE cm_visitor_remarks SET reportId=NULL WHERE Id=#{remarksId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="visitorReportList" resultType="com.caimei365.user.model.vo.ReportVo">
|
|
|
|
+ SELECT ccr.questionMan as questionMan,c.`name` as clubName,cmc.`addTime`,p.`name` as productName,p.`mainImage` as mainImage,cmc.`reportText`
|
|
|
|
+ FROM cm_club_report cmc
|
|
|
|
+ LEFT JOIN cm_club_remarks ccr ON ccr.reportID = cmc.id
|
|
|
|
+ LEFT JOIN club c ON c.clubID = cmc.clubID
|
|
|
|
+ LEFT JOIN product p ON p.productID = cmc.productID
|
|
|
|
+ <where>
|
|
|
|
+ and ccr.`questionManId`=#{questionManId}
|
|
|
|
+ <if test="keyWord != null and keyWord !=''">
|
|
|
|
+ AND (p.name LIKE concat('%',#{keyWord},'%')
|
|
|
|
+ or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|