|
@@ -2,8 +2,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)
|
|
|
- VALUES(#{IP},#{userId},#{pagePath},#{pageType},#{pageLabel},#{behaviorType},#{productId},#{accessTime},#{accessDuration},#{accessDate},#{referer},#{accessSource},#{accessClient},#{isReckon},#{region})
|
|
|
+ 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">
|
|
@@ -20,18 +20,221 @@
|
|
|
<update id="updateDuration">
|
|
|
UPDATE cm_behavior_record
|
|
|
SET accessDuration = #{accessDuration},
|
|
|
- isReckon = #{isReckon},
|
|
|
- region = #{region}
|
|
|
+ isReckon = #{isReckon}
|
|
|
WHERE recordID = #{recordID}
|
|
|
</update>
|
|
|
- <select id="findList" resultType="com.caimei365.tools.model.po.CmBehaviorRecordPo">
|
|
|
- SELECT * FROM cm_behavior_record where recordID between #{startId} and #{endId}
|
|
|
+ <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 isReckon = #{isReckon},
|
|
|
- region = #{region}
|
|
|
+ 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 = 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>
|
|
|
|