123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <?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.user.mapper.RoosInformationMapper">
- <select id="selIsClick" resultType="integer">
- SELECT isClick FROM cm_roos_information cri
- left join cm_shop_product csp on csp.id = cri.shopProductId
- left join cm_shop_statistics css on css.id = csp.statisticsId
- <if test="infoId != null">
- LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
- </if>
- <if test="keyword != null and keyword != ''">
- left join shop s on s.shopId = cri.shopId
- LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
- left join cm_user_search_frequency cusf on cusf.id = csk.searchId
- </if>
- <where>
- cri.IP = #{IP} and cri.createTime LIKE concat('%',#{createTime},'%')
- <if test="shopId != null">
- and css.shopId = #{shopId}
- </if>
- <if test="productId != null">
- and csp.productId = #{productId}
- </if>
- <if test="infoId != null">
- and csi.status = 0
- and csi.infoId = #{infoId}
- </if>
- <if test="keyword != null and keyword != ''">
- and ((csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%'))
- </if>
- </where>
- </select>
- <select id="getShopStatus" resultType="java.lang.Integer">
- select csp.status
- from cm_shop_statistics css
- left join cm_shop_product csp on csp.statisticsId = css.id
- <if test="infoId != null">
- LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
- </if>
- <if test="keyword != null and keyword != ''">
- left join shop s on s.shopId = css.shopId
- LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
- left join cm_user_search_frequency cusf on cusf.id = csk.searchId
- </if>
- <where>
- css.delFlag = 0 AND csp.delFlag = 0
- <if test="shopId != null">
- and css.shopId = #{shopId}
- </if>
- <if test="productId != null">
- and csp.productId = #{productId}
- </if>
- <if test="infoId != null">
- and csi.status = 0
- and csi.infoId = #{infoId}
- </if>
- <if test="keyword != null and keyword != ''">
- and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
- </if>
- </where>
- limit 1
- </select>
- <select id="getShopProductIds" resultType="java.lang.Integer">
- SELECT
- csp.productId
- FROM cm_shop_product csp
- LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
- WHERE css.shopId = #{shopId} AND csp.delFlag = 0
- </select>
- <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
- select csa.* from cm_shop_advertisingImage csa
- left join cm_shop_statistics cps on csa.shopId = cps.shopId
- where cps.status = 0 and csa.status = 0 and csa.delFlag = 0
- <if test="shopIds.size()>0">
- and csa.shopId in
- <foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
- #{shopId}
- </foreach>
- </if>
- order by csa.sort asc, csa.addTime desc
- </select>
- <select id="getShopPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
- SELECT
- csp.id,
- css.shopId,
- csp.image,
- csp.guidingOne,
- csp.guidingTwo,
- csp.addTime
- FROM cm_shop_popUp csp
- left join cm_shop_product cspd on cspd.id = csp.shopProductId
- left join cm_shop_statistics css on cspd.statisticsId = css.id
- <if test="infoId != null">
- LEFT JOIN cm_shop_info csi ON csi.shopProductId = cspd.id
- </if>
- <if test="keyword != null and keyword != ''">
- LEFT JOIN cm_shop_keyword csk ON csk.shopId = cspd.id
- left join cm_user_search_frequency cusf on cusf.id = csk.searchId
- </if>
- <where>
- css.status = 0 and cspd.status = 0 and cspd.delFlag = 0
- <if test="productId != null">
- and cspd.productId = #{productId}
- </if>
- <if test="infoId != null">
- and csi.status = 0
- and csi.infoId = #{infoId}
- </if>
- <if test="keyword != null and keyword != ''">
- and csk.status = 0
- and cusf.keyword like concat('%',#{keyword},'%')
- </if>
- </where>
- limit 1
- </select>
- <select id="getProductPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
- SELECT
- csp.id,
- css.shopId,
- csp.image,
- csp.guidingOne,
- csp.guidingTwo,
- csp.addTime
- FROM cm_shop_popUp csp
- left join cm_shop_product cspd on cspd.id = csp.shopProductId
- left join cm_shop_statistics css on css.id = cspd.statisticsId
- where css.shopId = #{shopId}
- AND cspd.delFlag = 0
- limit 1
- </select>
- <insert id="insRoosInformation">
- INSERT INTO cm_roos_information
- (
- IP,
- shopId,
- <if test="consultName != null and consultName != ''">
- consultName,
- </if>
- <if test="consultMobile != null and consultMobile != ''">
- consultMobile,
- </if>
- isClick,
- createTime
- )
- VALUES(
- #{ip},
- #{shopId},
- <if test="consultName != null and consultName != ''">
- #{consultName},
- </if>
- <if test="consultMobile != null and consultMobile != ''">
- #{consultMobile},
- </if>
- #{isClick},
- #{createTime}
- )
- </insert>
- <select id="getShopId" resultType="java.lang.Integer">
- select shopId from cm_shop_statistics where status = 0 and delFlag = 0
- </select>
- <select id="getShopProductId" resultType="java.lang.Integer">
- select productId from product where shopId = #{shopId}
- </select>
- <select id="getShopInfoId" resultType="java.lang.Integer">
- select
- csi.infoId
- FROM cm_shop_info csi
- LEFT JOIN cm_shop_product csp ON csp.id = csi.shopProductId
- LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
- WHERE css.shopId = #{shopId}
- AND csi.status = 0 AND csi.delFlag = 0
- AND csp.status = 0 AND csp.delFlag = 0
- AND css.status = 0 AND css.delFlag = 0
- </select>
- <select id="getShopKeyword" resultType="java.lang.String">
- SELECT cusf.keyword
- FROM cm_shop_keyword csk
- LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
- LEFT JOIN cm_shop_product csp ON csp.id = csk.shopProductId
- LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
- WHERE css.shopId = #{shopId}
- AND csk.status = 0 AND csk.delFlag = 0
- AND csp.status = 0 AND csp.delFlag = 0
- AND css.status = 0 AND css.delFlag = 0
- </select>
- <select id="getBehavior" resultType="java.lang.Integer">
- SELECT recordID
- 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 = #{pagePath}
- </if>
- <if test="userId != 0">
- AND userID = #{userId}
- </if>
- <if test="userId == 0">
- AND IP = #{ip}
- </if>
- </where>
- </select>
- </mapper>
|