123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <?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.BaseMapper">
- <select id="getAllUnsignedLogistics" resultType="com.caimei365.tools.model.po.LogisticsInfoPo">
- SELECT id,
- orderId,
- authId,
- nu,
- state,
- info,
- logisticsCompanyCode,
- mobile
- FROM logistics_information
- WHERE ((state != 3 AND state != 4 AND state != -1) OR state IS NULL)
- AND (updateDate > DATE_SUB(NOW(), interval 1 year))
- ORDER BY id DESC
- </select>
- <select id="getLogisticsPhoneByOrderId" resultType="java.lang.String">
- SELECT mobile
- FROM bp_order_userinfo
- WHERE orderId = #{orderId}
- LIMIT 1
- </select>
- <update id="updateLogistics" parameterType="com.caimei365.tools.model.po.LogisticsInfoPo">
- UPDATE logistics_information
- SET state=#{state},
- info=#{info},
- logisticsCompanyCode = #{logisticsCompanyCode},
- updateDate=#{updateDate}
- WHERE id = #{id}
- </update>
- <select id="findVip" resultType="com.caimei365.tools.model.po.SuperVipPo">
- select userId, endTime
- from cm_svip_user
- where delFlag = 0
- AND endTime between #{startTime} and #{endTime}
- </select>
- <select id="findMobile" resultType="java.lang.String">
- select bindMobile
- from user
- where userID = #{userid}
- </select>
- <select id="getMaturitySecondProductIds" resultType="java.lang.Integer">
- SELECT cshd.productID
- FROM cm_second_hand_detail cshd
- LEFT JOIN product p ON p.productID = cshd.productID
- WHERE p.validFlag = 2
- AND cshd.onLineDate <![CDATA[ < ]]> #{beforeDays}
- </select>
- <update id="updateProductValidFlag">
- UPDATE product
- SET validFlag = #{validFlag}
- where productID = #{productId}
- </update>
- <select id="getCouponUserIds" resultType="java.lang.Integer">
- SELECT userId
- FROM cm_coupon_club
- GROUP BY userId
- </select>
- <select id="getReceivedCoupons" resultType="com.caimei365.tools.model.bo.CouponDateBo">
- SELECT cc.id AS couponId,
- cc.startDate,
- cc.endDate
- FROM cm_coupon_club a
- LEFT JOIN cm_coupon cc ON a.couponId = cc.id
- WHERE cc.delFlag = 0
- AND a.delFlag = 0
- AND a.status = 1
- AND cc.status != 2
- AND a.userId = #{userId}
- AND NOW() BETWEEN cc.startDate AND cc.endDate
- ORDER BY a.createDate DESC
- </select>
- <select id="getUnclaimedCoupons" resultType="com.caimei365.tools.model.bo.CouponDateBo">
- SELECT
- id AS couponId,
- startDate,
- endDate
- FROM cm_coupon
- WHERE delFlag = 0 AND couponsMode = 0 AND status != 2
- AND NOW() BETWEEN startDate AND endDate
- <if test="userId == null or userId == 0">
- AND couponType != 2
- </if>
- <if test="userId > 0">
- AND id NOT IN(SELECT couponId FROM cm_coupon_club WHERE userId = #{userId})
- AND (couponType IN (0,1,3)
- OR couponType = 2 AND userId = #{userId}
- OR ((SELECT registerTime FROM USER WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate
- AND couponType = 4))
- </if>
- ORDER BY createDate DESC
- </select>
- <insert id="insertShortLink">
- INSERT INTO cm_short_link (markId, shortLink, jumpLink, createTime)
- VALUES (#{markId}, #{shortLink}, #{url}, NOW())
- </insert>
- <insert id="insertProductViews">
- INSERT INTO cm_product_views_record (productId, views, viewTime)
- VALUES (#{productId}, #{views}, #{viewTime})
- </insert>
- <update id="updateSmsSendCount">
- UPDATE cm_sms_statistics
- SET sendNum = (sendNum + #{count})
- WHERE markId = #{markId}
- </update>
- <select id="findIdByShortLink" resultType="java.lang.Integer">
- SELECT id
- FROM cm_short_link
- WHERE shortLink = #{shortLink}
- </select>
- <select id="getInfoBykeyword" resultType="com.caimei365.tools.model.po.SearchFrequencyVo">
- select id,
- fromSearch,
- keyword,
- frequency,
- searchTime,
- trueStatus,
- linkageFrequency
- from cm_user_search_frequency
- where keyword = #{keyword}
- and fromSearch = #{fromSearch}
- and trueStatus = #{trueStutas}
- </select>
- <select id="findKeywordId" resultType="java.lang.Integer">
- select id
- from cm_user_search_frequency
- where keyword = #{keyword}
- and delStatus = 1
- limit 1
- </select>
- <select id="findUserNameById" resultType="com.caimei365.tools.model.po.SysUser">
- select ssr.systemId as id,su.username as username
- from sys_system_role ssr
- left join system_user su on ssr.systemId=su.id
- where ssr.sysId=#{id}
- </select>
- <select id="getRoleNamesByUserId" resultType="java.lang.String">
- SELECT DISTINCT r.role_name FROM system_role r
- LEFT JOIN system_role_user ru ON r.id = ru.role_id
- WHERE ru.user_id = #{userId}
- </select>
- <update id="upFrequencyById">
- update cm_user_search_frequency
- set frequency=#{frequency},
- delStatus=1
- where id = #{id}
- </update>
- <update id="uplinkageFrequencyById">
- update cm_user_search_frequency
- set linkageFrequency=#{linkageFrequency},
- frequency=#{frequency},
- delStatus=#{delStatus}
- where id = #{id}
- </update>
- <update id="updateKeywordTimes">
- UPDATE cm_user_search_frequency
- SET frequency = frequency + 1,
- searchtime = NOW()
- WHERE id = #{id}
- </update>
- <update id="updateAllKeyword">
- update cm_user_search_frequency
- set recommendFlag=0,
- recommendStatus=0
- where trueStatus = 0
- and delStatus = 1
- </update>
- <update id="getRecommendKeyword">
- SELECT keyWordId
- FROM cm_label_source
- WHERE saveTime BETWEEN #{date} AND NOW()
- GROUP BY keyWordId
- HAVING COUNT(keywordId) > 1
- </update>
- <update id="updateRecommend">
- update cm_user_search_frequency
- set recommendStatus = 1
- where id in
- <foreach collection="ids" separator="," item="id" open="(" close=")">
- #{id}
- </foreach>
- </update>
- <insert id="saveInfo" parameterType="com.caimei365.tools.model.po.SearchFrequencyVo" useGeneratedKeys="true"
- keyProperty="id">
- insert into cm_user_search_frequency(keyword, frequency, searchTime)
- values (#{keyword}, #{frequency}, now())
- </insert>
- <insert id="insertLabelSource">
- insert into cm_label_source(keywordId, saveTime, path)
- VALUES (#{id}, now(), #{path})
- </insert>
- </mapper>
|