|
@@ -89,17 +89,20 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="textUserValue" resultType="NewCmClub">
|
|
|
- SELECT userID as valueID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1
|
|
|
+ SELECT userID as valueID, activeState, customerValue
|
|
|
+ FROM cm_organ_value_system
|
|
|
+ WHERE stage = 0
|
|
|
+ AND delType = 1
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<select id="findList" resultType="NewCmClub">
|
|
|
SELECT
|
|
|
<include refid="newCmClubColumns"/>
|
|
|
<include refid="otherColumns"/>,u.userPermission,u.source, covs.activeState,covs.customerValue
|
|
|
FROM club a
|
|
|
<include refid="newCmClubJoins"/>
|
|
|
- LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON a.userID = covs.userID
|
|
|
+ LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1)
|
|
|
+ covs ON a.userID = covs.userID
|
|
|
<where>
|
|
|
(u.userOrganizeID IN(0,1) or u.clubStatus != 92)
|
|
|
<if test="clubID != null and clubID != ''">
|
|
@@ -176,9 +179,15 @@
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="spNameList" resultType="com.caimei.modules.project.model.ServiceProviderModel">
|
|
|
- SELECT serviceProviderID,name FROM serviceprovider WHERE NAME NOT LIKE concat('%','测试','%') AND validFlag = 1 AND STATUS = 90
|
|
|
+ SELECT serviceProviderID, name
|
|
|
+ FROM serviceprovider
|
|
|
+ WHERE NAME NOT LIKE concat('%', '测试', '%')
|
|
|
+ AND validFlag = 1
|
|
|
+ AND STATUS = 90
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findAllList" resultType="NewCmClub">
|
|
|
SELECT
|
|
|
<include refid="newCmClubColumns"/>
|
|
@@ -421,6 +430,7 @@
|
|
|
where serviceProviderID = #{spID}
|
|
|
and status = 90
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findRemarksList" resultType="com.caimei.modules.user.entity.CmClubRemarks">
|
|
|
select DISTINCT ccr.id as remarksId,
|
|
|
ccr.remarks,
|
|
@@ -441,12 +451,14 @@
|
|
|
where clubId = #{clubId}
|
|
|
order by addTime desc
|
|
|
</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.caimei.modules.user.entity.RemarksFileVo">
|
|
|
select fileName, ossName
|
|
|
from cm_club_remarks_file
|
|
@@ -475,6 +487,7 @@
|
|
|
and type = 2
|
|
|
and num = 500
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findRegistList" resultType="com.caimei.modules.user.entity.CmClubRemarks">
|
|
|
SELECT DISTINCT
|
|
|
ccr.id AS remarksId, ccr.remarks,s.linkman AS spName, ccr.addTime,ccr.questionMan,
|
|
@@ -493,7 +506,7 @@
|
|
|
# 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 ccre ON ccre.Id= ccr.reportID
|
|
|
+ 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>
|
|
@@ -532,17 +545,20 @@
|
|
|
</when>
|
|
|
</choose>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findConsults" resultType="com.caimei.modules.consult.entity.type.CmConsulttype">
|
|
|
select id, className, createdTime
|
|
|
from cm_consulttype
|
|
|
where delflag = 0
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findTeams" resultType="com.caimei.modules.user.entity.CmSaleMan">
|
|
|
select csr.leaderId, s.name as leaderName
|
|
|
from cm_serviceteam_role csr
|
|
|
left join serviceprovider s on s.serviceProviderID = csr.leaderId
|
|
|
where csr.delflag = 0
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findGroup" resultType="com.caimei.modules.project.model.ServiceProviderModel">
|
|
|
SELECT serviceId as serviceProviderID, s.name
|
|
|
FROM cm_serviceteam_group csg
|
|
@@ -550,6 +566,7 @@
|
|
|
LEFT JOIN serviceprovider s ON s.serviceProviderID = csg.serviceId
|
|
|
WHERE csr.leaderId = #{leaderId}
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findClassName" resultType="java.lang.String">
|
|
|
select className
|
|
|
from cm_consulttype
|
|
@@ -584,13 +601,8 @@
|
|
|
WHERE clubId = #{clubID}
|
|
|
</select>
|
|
|
|
|
|
- <!-- <insert id="oldname">-->
|
|
|
- <!-- INSERT INTO `cm_old_remarks`(serviceProviderId, `serviceProviderName`)-->
|
|
|
- <!-- VALUES (#{serviceProviderId}, #{serviceProviderName})-->
|
|
|
- <!-- </insert>-->
|
|
|
-
|
|
|
<update id="oldname">
|
|
|
- UPDATE `cm_club_remarks`
|
|
|
+ UPDATE cm_club_remarks
|
|
|
SET oldserviceProviderId = #{oldserviceProviderId},
|
|
|
serviceProviderId=#{newSpID}
|
|
|
WHERE clubId = #{clubID}
|
|
@@ -598,22 +610,24 @@
|
|
|
</update>
|
|
|
|
|
|
<update id="oldnames">
|
|
|
- UPDATE `cm_club_remarks`
|
|
|
+ UPDATE cm_club_remarks
|
|
|
SET serviceProviderId=#{newSpID}
|
|
|
WHERE clubId = #{clubID}
|
|
|
AND serviceProviderId = #{oldSpID}
|
|
|
</update>
|
|
|
|
|
|
<select id="ReportList" resultType="com.caimei.modules.user.entity.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
|
|
|
+ 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="reportId!=null and reportId!=''">
|
|
|
+ AND ccr.id=#{reportId}
|
|
|
+ </if>
|
|
|
<if test="productName!=null and productName!=''">
|
|
|
AND p.name LIKE concat('%',#{productName},'%')
|
|
|
</if>
|
|
@@ -645,12 +659,13 @@
|
|
|
(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,ccre.auditTime AS auditTime,p.mainImage AS mainImage,p.name AS productName,sh.name AS shopName
|
|
|
+ ccre.reportText AS reportText,ccre.status AS reportStatus,ccre.auditName,ccre.auditTime AS auditTime,p.mainImage
|
|
|
+ AS mainImage,p.name AS productName,sh.name AS shopName
|
|
|
FROM cm_visitor_remarks ccr
|
|
|
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 ccre ON ccre.Id= ccr.reportID
|
|
|
+ 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
|
|
|
LEFT JOIN club c ON c.clubID = ccr.clubID
|
|
@@ -682,46 +697,68 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="visitorRemarksConut" resultType="integer">
|
|
|
- SELECT COUNT(*) FROM cm_visitor_remarks WHERE reportID=#{reportID}
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM cm_visitor_remarks
|
|
|
+ WHERE reportID = #{reportID}
|
|
|
</select>
|
|
|
|
|
|
<select id="clubRemarksConut" resultType="integer">
|
|
|
- SELECT COUNT(*) FROM cm_club_remarks WHERE reportID=#{reportID}
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM cm_club_remarks
|
|
|
+ WHERE reportID = #{reportID}
|
|
|
</select>
|
|
|
|
|
|
-<update id="updateAuditRemarks">
|
|
|
- UPDATE cm_club_report SET status=#{status},auditName=#{auditName},auditText=#{auditText},auditTime=now() WHERE id=#{reportID}
|
|
|
-</update>
|
|
|
+ <update id="updateAuditRemarks">
|
|
|
+ UPDATE cm_club_report
|
|
|
+ SET status=#{status},
|
|
|
+ auditName=#{auditName},
|
|
|
+ auditText=#{auditText},
|
|
|
+ auditTime=now()
|
|
|
+ WHERE id = #{reportID}
|
|
|
+ </update>
|
|
|
|
|
|
<update id="updateClubRemarks">
|
|
|
- UPDATE cm_club_remarks SET reportID=null WHERE id=#{remarksId}
|
|
|
+ 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 cm_visitor_remarks
|
|
|
+ SET reportID=null
|
|
|
+ WHERE id = #{remarksId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteClubRemarks">
|
|
|
- DELETE FROM cm_club_report WHERE id=#{reportID}
|
|
|
+ DELETE
|
|
|
+ FROM cm_club_report
|
|
|
+ WHERE id = #{reportID}
|
|
|
</delete>
|
|
|
|
|
|
<insert id="addRecordLinkage">
|
|
|
- INSERT INTO `record_link`(`describe`,`link`,clubId)
|
|
|
- VALUES (#{describe},#{link},#{clubId})
|
|
|
+ INSERT INTO `record_link`(`describe`, `link`, clubId)
|
|
|
+ VALUES (#{describe}, #{link}, #{clubId})
|
|
|
</insert>
|
|
|
|
|
|
-<select id="recordLinkage" resultType="string">
|
|
|
- SELECT link from record_link where clubId=#{clubId}
|
|
|
- ORDER BY id DESC
|
|
|
- LIMIT 1
|
|
|
-</select>
|
|
|
+ <select id="recordLinkage" resultType="string">
|
|
|
+ SELECT link
|
|
|
+ from record_link
|
|
|
+ where clubId = #{clubId}
|
|
|
+ ORDER BY id DESC
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
<select id="recordDescribe" resultType="string">
|
|
|
- SELECT `describe` from record_link where clubId=#{clubId}
|
|
|
+ SELECT `describe`
|
|
|
+ from record_link
|
|
|
+ where clubId = #{clubId}
|
|
|
ORDER BY id DESC
|
|
|
LIMIT 1
|
|
|
</select>
|
|
|
<select id="selRegisterIP" resultType="com.caimei.modules.user.entity.CmBehaviorRecord">
|
|
|
- SELECT u.registerIP,u.ipAddress AS region, u.registerTime FROM USER u LEFT JOIN club c ON u.userID = c.userID WHERE c.clubID = #{clubId}
|
|
|
+ SELECT u.registerIP, u.ipAddress AS region, u.registerTime
|
|
|
+ FROM USER u
|
|
|
+ LEFT JOIN club c ON u.userID = c.userID
|
|
|
+ WHERE c.clubID = #{clubId}
|
|
|
</select>
|
|
|
|
|
|
<select id="selStatisticsList" resultType="com.caimei.modules.user.entity.ClubStatistics">
|
|
@@ -777,7 +814,7 @@
|
|
|
IFNULL(orderTotal.payTotal,0) AS payTotal,
|
|
|
ordr.lastOrderTime AS lastOrderTime
|
|
|
FROM club c
|
|
|
-# LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
+ # LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
LEFT JOIN USER u ON u.userId=c.userId
|
|
|
LEFT JOIN cm_svip_user csu ON csu.userId = u.userID
|
|
|
LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
@@ -798,7 +835,7 @@
|
|
|
COUNT(co.orderid) AS orderCountYesr
|
|
|
FROM cm_order co
|
|
|
<where>
|
|
|
- co.status NOT IN (0,6,7)
|
|
|
+ co.status NOT IN (0,6,7)
|
|
|
<if test="yearStartTime != null and yearStartTime != '' and yearEndTime != null and yearEndTime != ''">
|
|
|
AND co.orderTime BETWEEN #{yearStartTime} AND #{yearEndTime}
|
|
|
</if>
|
|
@@ -826,15 +863,15 @@
|
|
|
<if test="registerStartTime != null and registerStartTime != ''">
|
|
|
AND (c.addTime > #{registerStartTime} or c.addTime = #{registerStartTime} )
|
|
|
</if>
|
|
|
- <if test="registerEndTime != null and registerEndTime != ''">
|
|
|
- AND c.addTime <![CDATA[ <= ]]> #{registerEndTime}
|
|
|
- </if>
|
|
|
+ <if test="registerEndTime != null and registerEndTime != ''">
|
|
|
+ AND c.addTime <![CDATA[ <= ]]> #{registerEndTime}
|
|
|
+ </if>
|
|
|
<if test="searchStartTime != null and searchStartTime != ''">
|
|
|
AND (ordr.lastOrderTime > #{searchStartTime} or ordr.lastOrderTime = #{searchStartTime} )
|
|
|
</if>
|
|
|
- <if test=" searchEndTime != null and searchEndTime != ''">
|
|
|
- AND ordr.lastOrderTime <![CDATA[ <= ]]> #{searchEndTime}
|
|
|
- </if>
|
|
|
+ <if test=" searchEndTime != null and searchEndTime != ''">
|
|
|
+ AND ordr.lastOrderTime <![CDATA[ <= ]]> #{searchEndTime}
|
|
|
+ </if>
|
|
|
<if test="customerValue != null and customerValue != ''">
|
|
|
AND c.firstClubType = #{customerValue}
|
|
|
</if>
|
|
@@ -939,13 +976,16 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="selPageLable" resultType="com.caimei.modules.user.entity.CmBehaviorRecord">
|
|
|
- SELECT c.userID, COUNT(pageType) AS number, cbr.pageLabel
|
|
|
+ SELECT c.userID, COUNT(pageType) AS number, cbr.pageLabel
|
|
|
FROM club c
|
|
|
- LEFT JOIN cm_behavior_record cbr ON cbr.userID = c.userID
|
|
|
- WHERE cbr.userID = c.userID AND cbr.pageType in (8,9)
|
|
|
- GROUP BY c.userID, cbr.pageLabel
|
|
|
+ LEFT JOIN cm_behavior_record cbr ON cbr.userID = c.userID
|
|
|
+ WHERE cbr.userID = c.userID
|
|
|
+ AND cbr.pageType in (8, 9)
|
|
|
+ GROUP BY c.userID, cbr.pageLabel
|
|
|
</select>
|
|
|
+
|
|
|
<select id="findExcelList" resultType="com.caimei.modules.user.entity.easyExcel">
|
|
|
SELECT
|
|
|
u.userId,
|
|
@@ -1000,7 +1040,7 @@
|
|
|
pb.pageLabel,
|
|
|
ordr.lastOrderTime AS lastOrderTime
|
|
|
FROM club c
|
|
|
-# LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
+ # LEFT JOIN cm_order cor ON c.userID = cor.userID
|
|
|
LEFT JOIN USER u ON u.userId=c.userId
|
|
|
LEFT JOIN cm_svip_user csu ON csu.userId = u.userID
|
|
|
LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
|
|
@@ -1048,11 +1088,11 @@
|
|
|
SELECT c.userID, COUNT(cbr.pageLabel), cbr.pageLabel
|
|
|
FROM cm_behavior_record cbr
|
|
|
LEFT JOIN club c ON cbr.userID = c.userID
|
|
|
- <where> cbr.userID = c.userID</where>
|
|
|
+ <where>cbr.userID = c.userID</where>
|
|
|
GROUP BY cbr.pageLabel) AS pb ON c.userID = pb.userID
|
|
|
|
|
|
LEFT JOIN (
|
|
|
- SELECT userID, MAX(orderTime) AS lastOrderTime FROM cm_order GROUP BY userID
|
|
|
+ SELECT userID, MAX(orderTime) AS lastOrderTime FROM cm_order GROUP BY userID
|
|
|
) AS ordr ON c.userID = ordr.userID
|
|
|
<where>
|
|
|
<if test="registerStartTime != null and registerStartTime != ''">
|