123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- <?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.tools.mapper.CmBehaviorRecordMapper">
- <select id="getShopName" resultType="java.lang.String">
- select name from shop where shopId = #{shopId}
- </select>
- <select id="getPageLabel" resultType="java.lang.String">
- select pageType from cm_page_type where id = #{type}
- </select>
- <select id="getProductPageLabel" resultType="java.lang.String">
- SELECT relatedLabels FROM product WHERE productId = #{productId}
- </select>
- <select id="getInfoPageLabel" resultType="java.lang.String">
- SELECT relatedLabels FROM info WHERE id = #{Id}
- </select>
- <select id="getBaiKePageLabel" resultType="java.lang.String">
- SELECT relatedLabels FROM cm_baike_product WHERE id = #{Id}
- </select>
- <insert id="insertRecord" parameterType="com.caimei365.tools.model.po.CmBehaviorRecordPo" useGeneratedKeys="true" keyProperty="recordID">
- INSERT INTO cm_behavior_record (IP, userID, touristId, pagePath, pageType, pageLabel, behaviorType, productID, accessTime,
- accessDuration, accessDate, referer, accessSource, accessClient, isReckon, region, userAgent, openId, delFlag)
- VALUES(#{IP}, #{userId}, #{touristId}, #{pagePath}, #{pageType}, #{pageLabel}, #{behaviorType}, #{productId}, #{accessTime},
- #{accessDuration}, #{accessDate}, #{referer}, #{accessSource}, #{accessClient}, #{isReckon}, #{region}, #{userAgent}, #{openId}, #{delFlag})
- </insert>
- <select id="toDateRecode" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT IP, userID FROM cm_behavior_record WHERE accessDate = #{accessDate} GROUP BY IP, userID
- </select>
- <select id="toDateIPTimeRecode" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT recordID, IP, userID, accessTime FROM cm_behavior_record WHERE IP = #{IP} AND userID = #{userId} AND isReckon = 0
- AND accessTime BETWEEN #{startTime} and #{endTime}
- union
- SELECT recordID, IP, userID, accessTime FROM cm_behavior_record WHERE IP = #{IP} AND isReckon = 0 AND accessDate = #{accessDate} AND userID = #{userId}
- ORDER BY accessTime ASC
- </select>
- <update id="updateDuration">
- UPDATE cm_behavior_record
- SET accessDuration = #{accessDuration},
- isReckon = #{isReckon}
- WHERE recordID = #{recordID}
- </update>
- <select id="findList" resultType="com.caimei365.tools.model.po.CmUserPo">
- SELECT userID, registerIP FROM USER where userID between #{startId} and #{endId}
- </select>
- <select id="skuList" resultType="com.caimei365.tools.model.po.CmSkuPo">
- select
- skuId,
- productId,
- organizeId,
- normalPrice,
- price,
- ladderPriceFlag,
- costCheckFlag,
- ifnull(costPrice,0) as costPrice,
- shopPercent,
- organizePercent,
- cmPercent,
- stock,
- unit,
- minBuyNumber
- from cm_sku
- WHERE costCheckFlag = 1
- </select>
- <update id="updateSku">
- update cm_sku
- set shopPercent = #{shopPercent},
- organizePercent = #{organizePercent},
- cmPercent = #{cmPercent},
- costCheckFlag = #{costCheckFlag}
- where skuId = #{skuId}
- </update>
- <update id="updateOldData">
- UPDATE USER
- SET ipAddress = #{ipAddress}
- WHERE userID = #{userID}
- </update>
- <select id="selSvipCoupon" resultType="com.caimei365.tools.model.po.CmVipCouponPo">
- SELECT id,
- useTime,
- updateTime,
- status,
- delFlag
- FROM cm_svip_coupon_month WHERE delFlag != 0 AND useTime BETWEEN #{startTime} AND #{endTime}
- </select>
- <update id="updateSvipCoupon">
- UPDATE cm_svip_coupon_month
- SET delFlag = 0
- WHERE id = #{id}
- </update>
- <insert id="insertVipCouponMonth" parameterType="com.caimei365.tools.model.po.CmVipCouponPo" keyProperty="id" useGeneratedKeys="true" >
- INSERT INTO cm_svip_coupon_month (useTime, updateTime, status,delFlag)
- VALUES (#{useTime}, #{updateTime}, #{status}, #{delFlag})
- </insert>
- <select id="selCoupon" resultType="com.caimei365.tools.model.po.CmCouponPo">
- SELECT
- id,
- name,
- couponAmount,
- touchPrice,
- startDate,
- endDate,
- receivePeriod,
- useTimeFlag,
- receiveFlag,
- usePeriod,
- status,
- couponType,
- vipFlag,
- userId,
- shopId,
- productType,
- pcBanner,
- appletsBanner,
- categoryType,
- couponsMode,
- moneyCouponPrice,
- moneyCouponFlag,
- couponPayWay,
- moneyCouponType,
- createDate,
- delFlag
- FROM cm_coupon WHERE delFlag = 0 AND configure = 1
- </select>
- <update id="updateCoupon">
- UPDATE cm_coupon
- SET configure = #{configure}
- WHERE id = #{id}
- </update>
- <insert id="insertCoupon" parameterType="com.caimei365.tools.model.po.CmCouponPo" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_coupon(
- name,
- couponPayWay,
- couponAmount,
- touchPrice,
- startDate,
- endDate,
- receivePeriod,
- receiveFlag,
- useTimeFlag,
- usePeriod,
- status,
- couponType,
- vipFlag,
- userId,
- shopId,
- productType,
- pcBanner,
- appletsBanner,
- categoryType,
- couponsMode,
- createDate,
- moneyCouponPrice,
- moneyCouponFlag,
- moneyCouponType,
- delFlag,
- configure
- ) VALUES (
- #{name},
- #{couponPayWay},
- #{couponAmount},
- #{touchPrice},
- #{startDate},
- #{endDate},
- #{receivePeriod},
- #{receiveFlag},
- #{useTimeFlag},
- #{usePeriod},
- #{status},
- #{couponType},
- #{vipFlag},
- #{userId},
- #{shopId},
- #{productType},
- #{pcBanner},
- #{appletsBanner},
- #{categoryType},
- #{couponsMode},
- #{createDate},
- #{moneyCouponPrice},
- #{moneyCouponFlag},
- #{moneyCouponType},
- #{delFlag},
- #{configure}
- )
- </insert>
- <select id="selCouponPro" resultType="com.caimei365.tools.model.po.CmCouponAssociatePo">
- select * from cm_coupon_product where delFlag = 0 and couponId = #{couponId}
- </select>
- <insert id="insertCouponAssociate">
- INSERT INTO `cm_coupon_product` (
- `couponId`, `productId`, `pcStatus`,
- `appletsStatus`,
- `sort`, `addTime`, `delFlag`
- )
- VALUES
- (
- #{couponId}, #{productId}, #{pcStatus},
- #{appletsStatus},
- #{sort}, #{addTime}, #{delFlag}
- )
- </insert>
- <select id="selSvipCouponById" resultType="integer">
- SELECT max(id) as id FROM cm_svip_coupon_month
- </select>
- <insert id="insertRelation">
- INSERT INTO cm_svip_coupon(couponId, montId, updateTime,delFlag)
- VALUES(#{couponId}, #{montId}, #{updateTime},#{delFlag})
- </insert>
- <select id="getRecodeOpenId" resultType="java.lang.String">
- SELECT openId as count FROM cm_behavior_record where accessDate = #{accessDate} and accessClient = 1 GROUP BY openId
- </select>
- <select id="getCuxOpen" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT openId, COUNT(DISTINCT userId) as count FROM cm_behavior_record WHERE accessDate = #{accessDate} AND accessClient = 1 AND (openId IS NOT NULL AND openId != '') GROUP BY openId
- </select>
- <select id="getRecordOpenIdInfo" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT ip as IP, userID as userId, openId FROM cm_behavior_record
- <where>
- userId is not null and userId != '' and userId = 0 and accessDate = #{accessDate}
- <if test="openIdList.size()>0">
- and openId in
- <foreach collection="openIdList" item="openId" open="(" separator="," close=")">
- #{openId}
- </foreach>
- </if>
- </where>
- group by userId
- </select>
- <select id="getRecodeTouristId" resultType="java.lang.String">
- SELECT touristId FROM cm_behavior_record WHERE accessDate = #{accessDate} and accessClient = 0 GROUP BY touristId
- </select>
- <select id="getCuxTourist" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT touristId, COUNT(DISTINCT userId) as count FROM cm_behavior_record WHERE accessDate = #{accessDate} AND accessClient = 0 GROUP BY touristId
- </select>
- <select id="getTouristInfo" resultType="com.caimei365.tools.model.po.CmBehaviorTouristInfoPo">
- select userId, touristId, addTime from cm_behavior_tourist_info
- <where>
- userId is not null and userId != '' and addTime like concat('%',#{accessDate},'%')
- <if test="touristIds.size() > 0">
- and touristId in
- <foreach collection="touristIds" item="touristId" open="(" separator="," close=")">
- #{touristId}
- </foreach>
- </if>
- </where>
- group by userId
- </select>
- <select id="getTouristIdByIp" resultType="java.lang.String">
- SELECT ip FROM cm_behavior_record WHERE accessDate = #{accessDate} and touristId = #{touristId}
- </select>
- <select id="getUserIdAttribute" resultType="java.lang.Integer">
- SELECT userId FROM cm_behavior_record
- <where>
- accessDate = #{accessDate}
- <if test="openId != null and openId != ''">
- AND openId = #{openId}
- </if>
- <if test="touristId != null and touristId != ''">
- AND touristId = #{touristId}
- </if>
- </where>
- GROUP BY userId
- </select>
- <update id="updateBehavior">
- UPDATE cm_behavior_record
- SET IP = #{IP},
- userID = #{userId}
- WHERE openId = #{openId} and accessDate = #{accessDate}
- </update>
- <update id="updateBehaviorByTouristId">
- update cm_behavior_record
- SET userID = #{userId},
- IP = #{IP}
- WHERE touristId = #{touristId} and accessDate = #{accessDate}
- </update>
- <select id="getUserAndBehavior" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT u.userId,
- u.registerTime,
- cbr.recordID as recordID,
- cbr.ip,
- cbr.userId,
- cbr.accessDate
- FROM USER u
- LEFT JOIN cm_behavior_record cbr ON u.registerIP = cbr.IP
- WHERE cbr.accessdate = #{accessDate}
- AND u.registerTime LIKE concat('%',#{accessDate},'%')
- AND cbr.userId = 0
- </select>
- <update id="updateBehaviorTourist">
- update cm_behavior_record
- set userId = #{userId}
- where recordID = #{recordId}
- </update>
- <select id="selYesterdayList" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT
- b.IP,
- b.userID,
- c.clubID,
- MAX(b.accessTime) AS lastAccessTime,
- (
- CASE WHEN u.userIdentity = 2 THEN 2
- WHEN u.userIdentity = 4 THEN 2
- WHEN u.userIdentity = 3 THEN 3
- WHEN b.userID = 0 THEN 1
- END)AS companyType,
- (
- CASE WHEN b.userID = 0 THEN ''
- WHEN u.userIdentity = 2 THEN c.name
- when u.userIdentity = 3 then s.name
- WHEN u.userIdentity = 4 THEN IF(c.name != u.userName,c.name,'')
- END)AS corporateName,
- (
- CASE WHEN b.userID = 0 THEN ''
- WHEN u.userIdentity = 2 THEN c.linkMan
- WHEN u.userIdentity = 3 THEN s.linkMan
- WHEN u.userIdentity = 4 THEN c.linkMan
- END)AS contacts,
- (CASE WHEN u.userIdentity = 2 THEN c.contractMobile
- WHEN u.userIdentity = 4 THEN c.contractMobile
- WHEN u.userIdentity = 3 THEN s.contractMobile
- END)AS phoneNumber,
- (SELECT CASE STATUS WHEN 91 THEN '采美默认协销经理(官方账号)' ELSE linkMan END FROM serviceprovider WHERE serviceProviderID = c.spID) AS spName,
- COUNT(b.IP) AS number,
- (SELECT consultName
- FROM cm_roos_information
- WHERE IP = b.IP AND createTime LIKE CONCAT('%',b.accessDate,'%') AND (consultName IS NOT NULL OR consultName = '') LIMIT 1) AS consultName,
- (SELECT consultMobile
- FROM cm_roos_information
- WHERE IP = b.IP AND createTime LIKE CONCAT('%',b.accessDate,'%') AND (consultName IS NOT NULL OR consultName = '') LIMIT 1) AS consultMobile,
- b.behaviorType,
- b.productID,
- b.accessTime,
- SUM(b.accessDuration) AS accessDuration,
- b.accessDate,
- b.accessClient,
- b.region AS region,
- u.registerTime AS addTime,
- (SELECT touristId FROM cm_behavior_record WHERE accessDate = #{accessDate} and IP = b.IP ORDER BY accessTime DESC LIMIT 1) AS touristId,
- b.delFlag
- FROM cm_behavior_record b
- LEFT JOIN USER u ON b.userID = u.userID
- LEFT JOIN club c ON b.userID = c.userID
- LEFT JOIN shop s ON b.userID = s.userID
- WHERE b.IP != '106.55.202.118' AND b.delFlag = 0 AND b.accessDate = #{accessDate}
- AND b.region NOT LIKE '%美国Microsoft公司%' AND b.region NOT LIKE '%亚马逊(Amazon)公司%'
- GROUP BY b.IP, b.accessDate,b.userID ORDER BY b.accessTime DESC
- </select>
- <select id="insertYesterdayList">
- INSERT INTO cm_behavior_record_index (
- IP,
- userID,
- clubID,
- lastAccessTime,
- companyType,
- corporateName,
- contacts,
- phoneNumber,
- spName,
- number,
- consultName,
- consultMobile,
- accessTime,
- accessDuration,
- accessDate,
- accessClient,
- region,
- relevanceShop,
- label,
- pageLabels,
- pageTypes,
- addTime,
- touristId,
- delFlag
- ) values (
- #{IP},
- #{userId},
- #{clubId},
- #{lastAccessTime},
- #{companyType},
- #{corporateName},
- #{contacts},
- #{phoneNumber},
- #{spName},
- #{number},
- #{consultName},
- #{consultMobile},
- #{accessTime},
- #{accessDuration},
- #{accessDate},
- #{accessClient},
- #{region},
- #{relevanceShop},
- #{label},
- #{pageLabels},
- #{pageTypes},
- #{addTime},
- #{touristId},
- '0'
- )
- </select>
- <select id="selTodayData" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT
- b.IP,
- b.userID,
- c.clubID,
- MAX(b.accessTime) AS lastAccessTime,
- (
- CASE WHEN u.userIdentity = 2 THEN 2
- WHEN u.userIdentity = 4 THEN 2
- WHEN u.userIdentity = 3 THEN 3
- WHEN b.userID = 0 THEN 1
- END)AS companyType,
- (
- CASE WHEN b.userID = 0 THEN ''
- WHEN u.userIdentity = 2 THEN c.name
- WHEN u.userIdentity = 3 THEN s.name
- WHEN u.userIdentity = 4 THEN c.name -- IF(c.name != u.userName,c.name,'')
- END)AS corporateName,
- (
- CASE WHEN b.userID = 0 THEN ''
- WHEN u.userIdentity = 2 THEN c.linkMan
- WHEN u.userIdentity = 3 THEN s.linkMan
- WHEN u.userIdentity = 4 THEN c.linkMan
- END)AS contacts,
- (
- CASE WHEN u.userIdentity = 2 THEN c.contractMobile
- WHEN u.userIdentity = 4 THEN c.contractMobile
- WHEN u.userIdentity = 3 THEN s.contractMobile
- END)AS phoneNumber,
- (SELECT CASE STATUS WHEN 91 THEN '采美默认协销经理(官方账号)' ELSE linkMan END FROM serviceprovider WHERE serviceProviderID = c.spID) AS spName,
- COUNT(b.IP) AS number,
- (SELECT consultName
- FROM cm_roos_information
- WHERE IP = b.IP AND createTime LIKE CONCAT('%',b.accessDate,'%') AND (consultName IS NOT NULL OR consultName = '') LIMIT 1) AS consultName,
- (SELECT consultMobile
- FROM cm_roos_information
- WHERE IP = b.IP AND createTime LIKE CONCAT('%',b.accessDate,'%') AND (consultName IS NOT NULL OR consultName = '') LIMIT 1) AS consultMobile,
- b.accessTime,
- SUM(b.accessDuration) AS accessDuration,
- b.accessDate,
- b.accessClient,
- b.region AS region,
- u.registerTime AS addTime
- FROM cm_behavior_record b
- LEFT JOIN USER u ON b.userID = u.userID
- LEFT JOIN club c ON b.userID = c.userID
- LEFT JOIN shop s ON b.userID = s.userID
- WHERE b.IP != '106.55.202.118' AND b.delFlag = 0 AND b.accessDate = #{accessDate}
- AND b.region NOT LIKE '%美国Microsoft公司%' AND b.region NOT LIKE '%亚马逊(Amazon)公司%'
- GROUP BY b.IP, b.accessDate,b.userID ORDER BY b.accessTime DESC
- </select>
- <select id="selDataList" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT s.name AS relevanceShop, cbs.userID, cbs.IP, cbs.pageLabel
- FROM cm_behavior_record cbs
- LEFT JOIN cm_behavior_shopid cbr ON cbs.recordID = cbr.recordID
- LEFT JOIN shop s ON s.shopID = cbr.shopID
- where cbs.accessDate = #{accessDate}
- order by cbs.accessTime
- </select>
- <select id="getBehaviorPageLabel" resultType="java.lang.String">
- select pageLabel
- from cm_behavior_record
- where ip = #{ip} and accessDate = #{accessDate} and userId = #{userId}
- </select>
- <select id="getBehaviorPageType" resultType="java.lang.Integer">
- select pageType
- from cm_behavior_record
- where ip = #{ip} and accessDate = #{accessDate} and userId = #{userId}
- </select>
- <insert id="inBehaviorToday">
- INSERT INTO cm_behavior_record_today (
- id,
- IP,
- userId,
- clubId,
- lastAccessTime,
- companyType,
- corporateName,
- contacts,
- phoneNumber,
- spName,
- number,
- consultName,
- consultMobile,
- accessTime,
- accessDuration,
- accessDate,
- accessClient,
- region,
- relevanceShop,
- label,
- pageLabels,
- pageTypes,
- addTime
- ) values (
- #{recordID},
- #{IP},
- #{userId},
- #{clubId},
- #{lastAccessTime},
- #{companyType},
- #{corporateName},
- #{contacts},
- #{phoneNumber},
- #{spName},
- #{number},
- #{consultName},
- #{consultMobile},
- #{accessTime},
- #{accessDuration},
- #{accessDate},
- #{accessClient},
- #{region},
- #{relevanceShop},
- #{label},
- #{pageLabels},
- #{pageTypes},
- #{addTime}
- )
- </insert>
- <delete id="delTodayData">
- TRUNCATE TABLE cm_behavior_record_today
- </delete>
- <select id="shopKeyword" resultType="java.lang.String">
- SELECT cusf.keyword FROM cm_shop_relevance csr
- LEFT JOIN cm_shop_label csl ON csr.id = csl.relevanceId
- LEFT JOIN cm_user_search_frequency cusf ON csl.keywordId = cusf.id
- WHERE csr.delFlag = 0 AND
- csl.delFlag = 0
- </select>
- <select id="shopIds" resultType="java.lang.Integer">
- SELECT DISTINCT csr.shopID FROM cm_shop_relevance csr
- LEFT JOIN cm_shop_label csl ON csr.id = csl.relevanceId
- LEFT JOIN cm_user_search_frequency cusf ON csl.keywordId = cusf.id
- <where>
- csr.delFlag = 0 and
- csl.delFlag = 0 and
- <if test="strList != null and strList.size > 0">
- <foreach collection="strList" item="keyword" open="(" close=")" separator="or">
- cusf.keyword = #{keyword}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selShopId" resultType="java.lang.Integer">
- select id from cm_shop_relevance where delFlag = 0 and shopID = #{shopId}
- </select>
- <insert id="insertShopId">
- insert into cm_behavior_shopId (recordID, shopID) values (#{recordId}, #{shopId})
- </insert>
- <select id="selRegisterIP" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT u.userID as userId, u.registerIP as registerIp, c.clubID as clubId, c.provinceID as provinceId , c.cityID as cityId
- FROM USER u
- LEFT JOIN club c ON c.userID = u.userID
- WHERE u.userIdentity = 4 and c.clubID between #{startId} and #{endId}
- </select>
- <select id="selProvince" resultType="java.lang.Integer">
- SELECT provinceID as provinceId FROM province WHERE NAME LIKE concat('%', #{regionPro} ,'%') limit 1
- </select>
- <select id="selCity" resultType="com.caimei365.tools.model.po.AddressPo">
- SELECT cityID as cityId, provinceID as provinceId FROM city WHERE NAME LIKE concat('%', #{regionCity} ,'%') AND validFlag = 1 limit 1
- </select>
- <update id="upClubAddress">
- update club
- <set>
- <if test="provinceId != null and provinceId != ''">
- provinceID = #{provinceId},
- </if>
- <if test="cityId != null and cityId != ''">
- cityID = #{cityId}
- </if>
- </set>
- where clubID = #{clubId}
- </update>
- <select id="getShopId" resultType="java.lang.Integer">
- select shopId from cm_shop_statistics where delFlag= 0 and status = 0
- </select>
- <select id="getProductId" resultType="java.lang.Integer">
- SELECT productId FROM product WHERE shopId = #{shopId}
- </select>
- <select id="getShopInfoId" resultType="java.lang.Integer">
- select infoId from cm_shop_info where shopId = #{shopId} and delFlag = 0 and status = 0
- </select>
- <select id="getShopKeywordId" resultType="com.caimei365.tools.model.po.SearchFrequencyVo">
- SELECT ifnull(cusf.keyword, '') as keyword, ifnull(csk.searchId, 0) as id
- FROM cm_shop_keyword csk
- LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
- WHERE csk.shopId = #{shopId} AND csk.delFlag = 0 AND csk.status = 0
- </select>
- <select id="getBehaviorList" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT ifnull((select pagePath from cm_behavior_record where pagePath like concat('%',#{pagePath},'%') order by accessDate desc LIMIT 1), '') as pagePath,
- count(recordID) as number,
- ifnull(sum(accessDuration), 0) as accessDuration
- from cm_behavior_record
- <where>
- delFlag = 0 and accessDate = #{accessDate}
- <if test="pageType != null">
- and pageType = #{pageType}
- </if>
- <if test="pageType != 8">
- <if test="pagePath != null and pagePath != ''">
- and pagePath like concat('%',#{pagePath},'%')
- </if>
- </if>
- <if test="pageType == 8">
- and pageLabel like concat('%',#{pagePath},'%')
- </if>
- </where>
- </select>
- <insert id="insertPageShop">
- INSERT INTO cm_page_shop (shopId, shopLink, accessNumber, accessDuration, accessDate)
- VALUES (#{shopId}, #{shopLink}, #{accessNumber}, #{accessDuration}, #{accessDate})
- </insert>
- <insert id="insertPageProduct">
- insert into cm_page_shop_product (shopId, productId, link, accessNumber, accessDuration, accessDate)
- values (#{shopId}, #{productId}, #{link}, #{accessNumber}, #{accessDuration}, #{accessDate})
- </insert>
- <insert id="insertPageInfo">
- insert into cm_page_shop_info (shopId, infoId, link, accessNumber, accessDuration, accessDate)
- values (#{shopId}, #{infoId}, #{link}, #{accessNumber}, #{accessDuration}, #{accessDate})
- </insert>
- <insert id="insertPageKeyword">
- insert into cm_page_shop_keyword (shopId, searchId, link, accessNumber, accessDuration, accessDate)
- values (#{shopId}, #{searchId}, #{link}, #{accessNumber}, #{accessDuration}, #{accessDate})
- </insert>
- <select id="getClubId" resultType="java.lang.Integer">
- select clubId from club
- </select>
- <select id="getClubLabel" resultType="com.caimei365.tools.model.po.CmClubLabelPo">
- SELECT trendsKeyword, stateKeyword FROM cm_club_remarks
- where clubId = #{clubId} AND trendsKeyword IS NOT NULL AND stateKeyword IS NOT NULL
- <if test="startTime != null and startTime != ''">
- and addTime > #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and addTime <![CDATA[ <= ]]> #{endTime}
- </if>
- UNION
- SELECT trendsKeyword, stateKeyword FROM cm_visitor_remarks
- where clubId = #{clubId} AND trendsKeyword IS NOT NULL AND stateKeyword IS NOT NULL
- <if test="startTime != null and startTime != ''">
- and addTime > #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and addTime <![CDATA[ <= ]]> #{endTime}
- </if>
- </select>
- <select id="getClubBehavior" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT cbr.pageLabel, cbr.pageType , COUNT(cbr.pageLabel) number
- FROM cm_behavior_record cbr
- LEFT JOIN club c ON c.userID = cbr.userId
- where cbr.pageType IN (6, 8, 9, 11, 14)
- AND c.clubId = #{clubId}
- <if test="startTime != null and startTime != ''">
- and cbr.accessDate > #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- and cbr.accessDate <![CDATA[ <= ]]> #{endTime}
- </if>
- GROUP BY cbr.pageLabel ORDER BY COUNT(cbr.pageLabel) DESC
- </select>
- <select id="getTrendsKeyword" resultType="java.lang.String">
- SELECT keyword FROM cm_keyword_info WHERE dynamicStatus = 0
- </select>
- <select id="getStateKeyword" resultType="java.lang.String">
- SELECT keyword FROM cm_keyword_info WHERE dynamicStatus = 1
- </select>
- <select id="getClubTrendsKeyword" resultType="com.caimei365.tools.model.po.CmClubLabelPo">
- SELECT id, clubId, label, appearNumber FROM cm_club_label WHERE dynamicStatus = 0
- </select>
- <select id="getClubStateKeyword" resultType="com.caimei365.tools.model.po.CmClubLabelPo">
- SELECT id, clubId, label, appearNumber FROM cm_club_label WHERE dynamicStatus = 1
- </select>
- <insert id="insertClubLabel" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
- INSERT INTO cm_club_label (clubId, label, pageType, dynamicStatus, appearNumber, addTime, delFlag)
- values(#{clubId}, #{label}, #{pageType}, #{dynamicStatus}, #{appearNumber}, now(), 0)
- </insert>
- <update id="updateClubLabel">
- update cm_club_label
- set appearNumber = #{appearNumber}
- where id = #{id}
- </update>
- </mapper>
|