|
@@ -129,6 +129,14 @@
|
|
|
limit 1
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getKeywordByName" resultType="java.lang.Integer">
|
|
|
+ select id
|
|
|
+ from cm_keyword_info
|
|
|
+ where keyword = #{keyword}
|
|
|
+ and delFlag = 1
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getServiceList" resultType="com.caimei365.manager.entity.caimei.cmUser.ServiceProviderModel">
|
|
|
SELECT
|
|
|
ser.serviceProviderID AS serviceProviderId,
|
|
@@ -139,70 +147,160 @@
|
|
|
order by ser.addTime asc
|
|
|
</select>
|
|
|
|
|
|
- <select id="getStateKeyWordList" resultType="com.caimei365.manager.entity.caimei.KeyWord">
|
|
|
- SELECT cusf.id AS id, cusf.frequency, cusf.keyword as keyword, cusf.addTime,
|
|
|
- cusf.searchTime as searchTime,cusf.trueStatus as labelStatus,cusf.fromSearch as fromSearch,
|
|
|
- cusf.serviceProviderId, cusf.dynamicStatus, s.linkMan as name
|
|
|
- FROM cm_user_search_frequency cusf
|
|
|
- left join serviceprovider s on cusf.serviceProviderId = s.serviceProviderID
|
|
|
- WHERE cusf.delStatus = 1 AND cusf.dynamicStatus = 1
|
|
|
- <if test="beginTime !=null and beginTime !=''">
|
|
|
- AND (cusf.searchTime BETWEEN #{beginTime} AND #{endTime} or cusf.searchTime IS NULL)
|
|
|
- </if>
|
|
|
- <if test="keyword !=null and keyword !=''">
|
|
|
- AND cusf.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
- </if>
|
|
|
- <if test="fromSearch != null">
|
|
|
- AND cusf.fromSearch = #{fromSearch}
|
|
|
- </if>
|
|
|
- <if test="serviceProviderId != null">
|
|
|
- AND cusf.serviceProviderID = #{serviceProviderId}
|
|
|
- </if>
|
|
|
- ORDER BY cusf.addTime DESC
|
|
|
+ <select id="getStateKeyWordList" resultType="com.caimei365.manager.entity.caimei.CmKeywordInfo">
|
|
|
+ SELECT cki.id AS id,
|
|
|
+ cki.keyword AS keyword,
|
|
|
+ cki.fromSearch AS fromSearch,
|
|
|
+ cki.serviceProviderId,
|
|
|
+ cki.dynamicStatus,
|
|
|
+ cki.parentLabel,
|
|
|
+ cki.addTime,
|
|
|
+ s.linkMan AS NAME
|
|
|
+ FROM cm_keyword_info cki
|
|
|
+ LEFT JOIN serviceprovider s ON cki.serviceProviderId = s.serviceProviderID
|
|
|
+ <where>
|
|
|
+ cki.delFlag = 1
|
|
|
+ <if test="dynamicStatus != null">
|
|
|
+ AND cki.dynamicStatus = #{dynamicStatus}
|
|
|
+ </if>
|
|
|
+ <if test="parentLabel != null">
|
|
|
+ AND cki.parentLabel = #{parentLabel}
|
|
|
+ </if>
|
|
|
+ <if test="beginTime !=null and beginTime !=''">
|
|
|
+ AND (cki.addTime BETWEEN #{beginTime} AND #{endTime} or cki.addTime IS NULL)
|
|
|
+ </if>
|
|
|
+ <if test="keyword !=null and keyword !=''">
|
|
|
+ AND cki.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
+ </if>
|
|
|
+ <if test="fromSearch != null">
|
|
|
+ AND cki.fromSearch = #{fromSearch}
|
|
|
+ </if>
|
|
|
+ <if test="serviceProviderId != null">
|
|
|
+ AND cki.serviceProviderId = #{serviceProviderId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY cki.addTime DESC
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertLabelByState">
|
|
|
- insert into cm_user_search_frequency(fromSearch, keyword, frequency, trueStatus, dynamicStatus, addTime)
|
|
|
- values (1, #{keyword}, 0, 0, 1, now())
|
|
|
+ <select id="getkeywordById" resultType="com.caimei365.manager.entity.caimei.CmKeywordInfo">
|
|
|
+ SELECT
|
|
|
+ id AS id,
|
|
|
+ keyword AS keyword,
|
|
|
+ ifnull(parentLabel, 0) as parentLabel,
|
|
|
+ fromSearch AS fromSearch,
|
|
|
+ serviceProviderId,
|
|
|
+ dynamicStatus,
|
|
|
+ addTime
|
|
|
+ FROM cm_keyword_info
|
|
|
+ where delFlag = 1 and id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getkeywordSubtag" resultType="com.caimei365.manager.entity.caimei.CmKeywordSubtag">
|
|
|
+ SELECT
|
|
|
+ cks.id AS id,
|
|
|
+ cki.keyword AS subtag,
|
|
|
+ cks.addTime
|
|
|
+ FROM cm_keyword_subtag cks
|
|
|
+ left join cm_keyword_info cki on cks.subtagId = cki.id
|
|
|
+ where cki.delFlag = 1 and cks.delFlag = 0 and cks.keywordId = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getKeyword" resultType="com.caimei365.manager.entity.caimei.CmKeywordInfo">
|
|
|
+ SELECT
|
|
|
+ id AS id,
|
|
|
+ keyword AS keyword,
|
|
|
+ parentLabel,
|
|
|
+ fromSearch AS fromSearch,
|
|
|
+ serviceProviderId,
|
|
|
+ dynamicStatus,
|
|
|
+ addTime
|
|
|
+ FROM cm_keyword_info
|
|
|
+ <where>
|
|
|
+ delFlag = 1 and parentLabel = 0
|
|
|
+ <if test="keyword != null and keyword != ''">
|
|
|
+ and keyword like concat ('%', #{keyword} , '%')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by addTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertKeywordInfo" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
|
|
+ insert into cm_keyword_info(fromSearch, keyword, dynamicStatus, parentLabel, addTime, linkageStatus, delFlag)
|
|
|
+ values (1, #{keyword}, #{dynamicStatus}, #{parentLabel}, now(), 0, 1)
|
|
|
</insert>
|
|
|
|
|
|
+ <update id="updateKeyword">
|
|
|
+ update cm_keyword_info
|
|
|
+ set keyword = #{keyword},
|
|
|
+ parentLabel = #{parentLabel}
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <insert id="insertKeywordSubtag" keyProperty="subtagId" keyColumn="id" useGeneratedKeys="true">
|
|
|
+ insert into cm_keyword_subtag(keywordId, subtagId, addTime, delFlag)
|
|
|
+ values (#{keywordId}, #{subtagId}, now(), 0)
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateKeywordSubtag">
|
|
|
+ update cm_keyword_subtag
|
|
|
+ set delFlag = 1
|
|
|
+ where keywordId = #{keywordId}
|
|
|
+ <if test="ids.size()>0">
|
|
|
+ and id not in
|
|
|
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateKeywordInfo">
|
|
|
+ update cm_keyword_info
|
|
|
+ set delFlag = 0
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
<select id="getPriorKeywordList" resultType="com.caimei365.manager.entity.caimei.CmPriorKeyword">
|
|
|
select
|
|
|
- cpk.id, cpk.searchId AS searchId ,cusf.fromSearch as fromSearch, cusf.keyword as keyword, cusf.dynamicStatus,
|
|
|
- cusf.serviceProviderId, cpk.addTime, s.linkMan as name
|
|
|
+ cpk.id, cpk.searchId AS searchId ,cki.fromSearch as fromSearch, cki.keyword as keyword, cki.dynamicStatus,
|
|
|
+ cki.serviceProviderId, cpk.addTime, s.linkMan as name
|
|
|
from cm_prior_keyword cpk
|
|
|
- left join cm_user_search_frequency cusf on cpk.searchId = cusf.id
|
|
|
- left join serviceprovider s on cusf.serviceProviderId = s.serviceProviderID
|
|
|
- WHERE cpk.delFlag = 0 AND cusf.delStatus = 1
|
|
|
+ left join cm_keyword_info cki on cpk.searchId = cki.id
|
|
|
+ left join serviceprovider s on cki.serviceProviderId = s.serviceProviderID
|
|
|
+ WHERE cpk.delFlag = 0 AND cki.delFlag = 1
|
|
|
<if test="keyword !=null and keyword !=''">
|
|
|
- AND cusf.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
+ AND cki.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
</if>
|
|
|
<if test="fromSearch != null">
|
|
|
- AND cusf.fromSearch = #{fromSearch}
|
|
|
+ AND cki.fromSearch = #{fromSearch}
|
|
|
</if>
|
|
|
<if test="dynamicStatus != null">
|
|
|
- AND cusf.dynamicStatus = #{dynamicStatus}
|
|
|
+ AND cki.dynamicStatus = #{dynamicStatus}
|
|
|
</if>
|
|
|
order by cpk.addTime desc
|
|
|
</select>
|
|
|
|
|
|
<select id="getPickKeyword" resultType="com.caimei365.manager.entity.caimei.KeyWord">
|
|
|
- SELECT cusf.id AS id, cusf.frequency, cusf.keyword as keyword, cusf.addTime,
|
|
|
- cusf.searchTime as searchTime,cusf.trueStatus as labelStatus,cusf.fromSearch as fromSearch,
|
|
|
- cusf.serviceProviderId, cusf.dynamicStatus, s.linkMan as name
|
|
|
- FROM cm_user_search_frequency cusf
|
|
|
- left join serviceprovider s on cusf.serviceProviderId = s.serviceProviderID
|
|
|
- WHERE cusf.delStatus = 1
|
|
|
+ SELECT
|
|
|
+ cki.id AS id,
|
|
|
+ cki.keyword as keyword,
|
|
|
+ cki.addTime,
|
|
|
+ cki.fromSearch as fromSearch,
|
|
|
+ cki.serviceProviderId,
|
|
|
+ cki.dynamicStatus,
|
|
|
+ s.linkMan as name
|
|
|
+ FROM cm_keyword_info cki
|
|
|
+ left join serviceprovider s on cki.serviceProviderId = s.serviceProviderID
|
|
|
+ WHERE cki.delFlag = 1
|
|
|
<if test="keyword !=null and keyword !=''">
|
|
|
- AND cusf.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
+ AND cki.keyword LIKE CONCAT('%',#{keyword},'%')
|
|
|
</if>
|
|
|
<if test="fromSearch != null">
|
|
|
- AND cusf.fromSearch = #{fromSearch}
|
|
|
+ AND cki.fromSearch = #{fromSearch}
|
|
|
</if>
|
|
|
<if test="dynamicStatus != null">
|
|
|
- AND cusf.dynamicStatus = #{dynamicStatus}
|
|
|
+ AND cki.dynamicStatus = #{dynamicStatus}
|
|
|
</if>
|
|
|
- ORDER BY cusf.addTime DESC
|
|
|
+ ORDER BY cki.addTime DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="getPriorCount" resultType="java.lang.Integer">
|