123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <?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">
- <insert id="insertRecord">
- INSERT INTO cm_behavior_record (IP, userID, pagePath, pageType, pageLabel, behaviorType, productID, accessTime, accessDuration, accessDate,referer,accessSource,accessClient,isReckon,region,userAgent,delFlag)
- VALUES(#{IP},#{userId},#{pagePath},#{pageType},#{pageLabel},#{behaviorType},#{productId},#{accessTime},#{accessDuration},#{accessDate},#{referer},#{accessSource},#{accessClient},#{isReckon},#{region},#{userAgent},#{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>
- <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">
- 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 configure = 1
- </select>
- <update id="updateCoupon">
- UPDATE cm_coupon
- SET configure = #{configure}
- WHERE id = #{id}
- </update>
- <insert id="insertCoupon">
- 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="selById" resultType="integer">
- select max(id) as id from cm_coupon
- </select>
- <select id="selCouponPro" resultType="com.caimei365.tools.model.po.CmCouponAssociatePo">
- select * from cm_coupon_product where 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="countNum" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT IP as IP, COUNT(DISTINCT userID) as count FROM cm_behavior_record
- where accessDate = #{accessDate}
- GROUP BY IP, accessDate ORDER BY accessDate DESC
- </select>
- <select id="userIdAcc" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT IP as IP, userID as userId FROM cm_behavior_record WHERE IP = #{IP} AND accessDate = #{accessDate} GROUP BY IP ,userID ORDER BY userID DESC LIMIT 1
- </select>
- <select id="selBehaviorList" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
- SELECT recordID as recordID, IP as IP, userID as userId FROM cm_behavior_record WHERE IP = #{IP} AND userID = 0 AND accessDate = #{accessDate}
- </select>
- <update id="updateBehavior">
- UPDATE cm_behavior_record
- SET IP = #{IP},
- userID = #{userId}
- WHERE recordID = #{recordID}
- </update>
- <select id="selYesterdayList">
- INSERT INTO cm_behavior_record_index (IP, userID, clubID, lastAccessTime, companyType, corporateName,
- contacts, phoneNumber, spName, number, consultName, consultMobile, behaviorType, productID, accessTime, accessDuration, accessDate, accessClient, region, delFlag)
- 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 b.userID != 0 THEN u.userName
- 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 numbers,
- (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,
- 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}
- GROUP BY b.IP, b.accessDate,b.userID, b.behaviorType ORDER BY b.accessTime DESC
- </select>
- </mapper>
|