|
@@ -322,7 +322,7 @@
|
|
|
<select id="getUserCouponCount" resultType="java.lang.Integer">
|
|
|
SELECT COUNT(a.id)
|
|
|
FROM cm_coupon_club a
|
|
|
- LEFT JOIN cm_coupon cc ON a.couponId = cc.id
|
|
|
+ LEFT JOIN cm_coupon cc ON a.couponId = cc.id
|
|
|
WHERE cc.delFlag = 0
|
|
|
AND a.delFlag = 0
|
|
|
AND a.status = 1
|
|
@@ -420,7 +420,8 @@
|
|
|
AND questionMan IS NOT NULL
|
|
|
</select>
|
|
|
<select id="getRemarksListByKey" resultType="com.caimei365.user.model.vo.RemarksVo">
|
|
|
- select ccr.id as remarksId, ccr.remarks, ccr.addTime, ccr.questionMan, ccr.clubId,c.Name as clubName,ccr.serviceProviderId,
|
|
|
+ select DISTINCT
|
|
|
+ ccr.id as remarksId, ccr.remarks, ccr.addTime, ccr.questionMan, ccr.clubId,c.Name as clubName,ccr.serviceProviderId,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,ifnull(ccr.consultType,'') as consult
|
|
|
from cm_club_remarks ccr
|
|
|
LEFT JOIN club c ON c.clubID = ccr.clubId
|
|
@@ -430,21 +431,41 @@
|
|
|
OR c.name LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
OR ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
</if>
|
|
|
+ <if test="startAddTime !=''">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != ''">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="con != null and con.size > 0">
|
|
|
+ and
|
|
|
+ <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
|
|
|
+ ccr.consultType LIKE CONCAT('%',#{item},'%')
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
order by addTime desc
|
|
|
</select>
|
|
|
<select id="getVisitorListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
|
|
|
- SELECT questionManId, serviceProviderId, addTime as addDate, questionMan,ifnull(consultType,'') as consult
|
|
|
- FROM cm_visitor_remarks
|
|
|
+ SELECT DISTINCT
|
|
|
+ questionManId, serviceProviderId, addTime as addDate, questionMan,ifnull(consultType,'') as consult
|
|
|
+ FROM cm_visitor_remarks ccr
|
|
|
WHERE serviceProviderId = #{serviceProviderId}
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
and questionMan LIKE CONCAT('%', #{keyWord}, '%')
|
|
|
</if>
|
|
|
+ <if test="startAddTime !=''">
|
|
|
+ and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
+ </if>
|
|
|
+ <if test="endAddTime != ''">
|
|
|
+ and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
+ </if>
|
|
|
and clubId is null
|
|
|
GROUP BY questionManId
|
|
|
ORDER BY addTime DESC
|
|
|
</select>
|
|
|
<select id="getVisitRecordListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
|
|
|
- select ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate, ccr.questionMan,IFNULL(ccr.consultType,'') as consult,ccr.serviceProviderId,
|
|
|
+ select DISTINCT
|
|
|
+ ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate, ccr.questionMan,IFNULL(ccr.consultType,'') as consult,ccr.serviceProviderId,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
|
|
|
(select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName
|
|
|
from cm_visitor_remarks ccr
|
|
@@ -487,15 +508,16 @@
|
|
|
and id = #{string}
|
|
|
</select>
|
|
|
<select id="findAllRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
|
|
|
- SELECT ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
|
|
|
+ SELECT DISTINCT
|
|
|
+ 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,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName
|
|
|
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_role csr ON csr.leaderId = ccr.serviceProviderId
|
|
|
- LEFT JOIN cm_serviceTeam_group csg ON csr.id=csg.teamId
|
|
|
+ LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
<where>
|
|
|
<if test="keyWord != null and keyWord !=''">
|
|
|
AND ccr.remarks LIKE concat('%',#{keyWord},'%')
|
|
@@ -505,25 +527,32 @@
|
|
|
and csr.leaderId = #{leaderId}
|
|
|
</if>
|
|
|
<if test="groupId != null and groupId>0">
|
|
|
- and csg.serviceId = #{groupId}
|
|
|
+ and ccr.serviceProviderId = #{groupId}
|
|
|
</if>
|
|
|
- <if test="startAddTime != null and startAddTime !=''">
|
|
|
+ <if test="startAddTime !=''">
|
|
|
and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
</if>
|
|
|
- <if test="endAddTime != null and endAddTime != ''">
|
|
|
+ <if test="endAddTime != ''">
|
|
|
and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
</if>
|
|
|
+ <if test="con != null and con.size > 0">
|
|
|
+ and
|
|
|
+ <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
|
|
|
+ ccr.consultType LIKE CONCAT('%',#{item},'%')
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
</where>
|
|
|
ORDER BY ccr.ADDTIME DESC
|
|
|
</select>
|
|
|
<select id="getAllVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
|
|
|
- SELECT ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,IFNULL(ccr.consultType,'') as consult,ccr.serviceProviderId,
|
|
|
+ SELECT DISTINCT
|
|
|
+ ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,IFNULL(ccr.consultType,'') as consult,ccr.serviceProviderId,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
|
|
|
(SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName
|
|
|
FROM cm_visitor_remarks ccr
|
|
|
LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
|
|
|
- LEFT JOIN cm_serviceTeam_role csr ON csr.leaderId = ccr.serviceProviderId
|
|
|
- LEFT JOIN cm_serviceTeam_group csg ON csr.id=csg.teamId
|
|
|
+ LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
|
|
|
+ LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
|
|
|
<where>
|
|
|
and ccr.remarks IS NOT NULL
|
|
|
and ccr.clubId is null
|
|
@@ -535,15 +564,20 @@
|
|
|
and csr.leaderId = #{leaderId}
|
|
|
</if>
|
|
|
<if test="groupId != null and groupId>0">
|
|
|
- and csg.serviceId = #{groupId}
|
|
|
+ and ccr.serviceProviderId = #{groupId}
|
|
|
</if>
|
|
|
- <if test="startAddTime != null and startAddTime !=''">
|
|
|
+ <if test="startAddTime !=''">
|
|
|
and ccr.addTime <![CDATA[ > ]]> #{startAddTime}
|
|
|
</if>
|
|
|
- <if test="endAddTime != null and endAddTime != ''">
|
|
|
+ <if test="endAddTime != ''">
|
|
|
and ccr.addTime <![CDATA[ < ]]> #{endAddTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
ORDER BY ccr.ADDTIME DESC
|
|
|
</select>
|
|
|
+ <select id="findLeaderId" resultType="java.lang.Integer">
|
|
|
+ SELECT leaderId FROM cm_serviceteam_role csr
|
|
|
+ LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
|
|
|
+ WHERE s.serviceProviderID = #{serviceProviderId}
|
|
|
+ </select>
|
|
|
</mapper>
|