123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <?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.manager.dao.user.CustomerServiceDao">
- <select id="getCustomerShopList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopStatistics">
- SELECT
- DISTINCT css.id as id,
- css.shopID AS shopId,
- s.name as shopName,
- s.linkMan,
- s.contractMobile AS mobile,
- s.status AS shopStatus,
- css.status,
- css.addTime
- FROM cm_shop_statistics css
- LEFT JOIN shop s ON css.shopId = s.shopId
- <where>
- css.delFlag = 0
- <if test="shopName != null and shopName != ''">
- and s.name like concat('%',#{shopName},'%')
- </if>
- <if test="status != null">
- and css.status = #{status}
- </if>
- </where>
- order by css.addTime desc, s.addTime desc
- </select>
- <select id="getCustomerShopId" resultType="java.lang.Integer">
- SELECT shopId FROM cm_shop_statistics where delFlag = 0
- </select>
- <select id="getShopList" resultType="com.caimei365.manager.entity.caimei.CmShop">
- select * from shop
- where status = 90 and shopType = 1
- <if test="shopName != null and shopName != ''">
- and name like concat('%',#{shopName},'%')
- </if>
- <if test="shopId != null">
- and shopId = #{shopId}
- </if>
- order by addTime desc
- </select>
- <insert id="insertCustomerShop">
- insert into cm_shop_statistics (shopId, status, addTime, delFlag)
- values (#{shopId}, #{status}, now(), #{delFlag})
- </insert>
- <update id="updateCustomerShop">
- update cm_shop_statistics
- set status = #{status}
- where id = #{id}
- </update>
- <select id="getCmInformationList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmRoosInformation">
- SELECT cri.id,
- cri.IP,
- cri.shopId,
- cri.followUpStatus,
- cri.consultName,
- cri.consultMobile,
- cri.isClick,
- cri.serviceProviderId,
- (select linkMan from serviceprovider where serviceProviderID = cri.serviceProviderId) as name,
- cri.createTime
- FROM cm_roos_information cri
- <where>
- shopId = #{shopId}
- AND consultName IS NOT NULL
- AND consultMobile IS NOT NULL
- <if test="consultName != null and consultName != ''">
- and consultName like concat('%',#{consultName},'%')
- </if>
- <if test="consultMobile != null and consultMobile != ''">
- and consultMobile like concat('%',#{consultMobile},'%')
- </if>
- <if test="followUpStatus != null">
- and followUpStatus = #{followUpStatus}
- </if>
- </where>
- order by createTime desc
- </select>
- <select id="updateInformation">
- update cm_roos_information
- set followUpStatus = #{followUpStatus}
- <if test="serviceProviderId != null">
- , serviceProviderId = #{serviceProviderId}
- </if>
- where id = #{id}
- </select>
- <insert id="insertInformationNote" keyProperty="id" useGeneratedKeys="true" keyColumn="id">
- insert into cm_information_notes(informationId, note, noteUser, addTime)
- values (#{informationId}, #{note}, #{noteUser}, now())
- </insert>
- <insert id="insertInformationNoteImage">
- insert into cm_information_notes_image(informationNoteId, image)
- values (#{informationNoteId}, #{image})
- </insert>
- <select id="getInformationNotes" resultType="com.caimei365.manager.entity.caimei.cmUser.CmInformationNotes">
- select
- id,
- informationId,
- note,
- noteUser,
- addTime
- from cm_information_notes
- where informationId = #{informationId}
- order by addTime desc
- </select>
- <select id="getinformationNotesImage" resultType="java.lang.String">
- select image from cm_information_notes_image where informationNoteId = #{informationNoteId};
- </select>
- <select id="getShopInfoList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopInfo">
- SELECT
- csi.id,
- csi.infoId,
- i.guidanceImage,
- i.title,
- i.pubdate,
- csi.status,
- csi.addTime
- FROM cm_shop_info csi
- LEFT JOIN info i ON i.id = csi.infoId
- <where>
- csi.shopId = #{shopId} and csi.delFlag = 0 and i.delFlag = 0
- <if test="infoId != null">
- and csi.infoId = #{infoId}
- </if>
- <if test="title != null and title != ''">
- and i.title like concat('%',#{title},'%')
- </if>
- <if test="status != null">
- and csi.status = #{status}
- </if>
- </where>
- order by csi.addTime desc, i.pubdate desc
- </select>
- <select id="getShopInfoId" resultType="java.lang.Integer">
- select infoId from cm_shop_info where delFlag = 0
- </select>
- <select id="getInfoList" resultType="com.caimei365.manager.entity.caimei.cmUser.Info">
- select * from info
- where delFlag = 0 and onlineStatus = 2
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="title != null and title != ''">
- and title like concat('%',#{title},'%')
- </if>
- order by pubdate desc
- </select>
- <insert id="insertShopInfo">
- insert into cm_shop_info (shopId, infoId, status, addTime, delFlag)
- values (#{shopId}, #{infoId}, #{status}, now(), #{delFlag})
- </insert>
- <update id="updateShopInfoStatus">
- update cm_shop_info
- set status = #{status}
- where id = #{id}
- </update>
- <update id="delShopInfo">
- update cm_shop_info
- set delFlag = 1
- where id = #{id}
- </update>
- <select id="getShopKeyword" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopKeyword">
- SELECT
- csk.id,
- csk.shopId,
- cusf.keyword,
- cusf.frequency as number,
- cusf.searchTime,
- csk.status,
- csk.addTime
- 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 cusf.delStatus = 1
- <if test="keyword != null and keyword != ''">
- and cusf.keyword like concat('%',#{keyword},'%')
- </if>
- <if test="status != null">
- and csk.status = #{status}
- </if>
- </where>
- order by csk.addTime desc, (SELECT COUNT(recordID) FROM cm_behavior_record WHERE pageType = 8 AND pageLabel = cusf.keyword) desc
- </select>
- <select id="getShopKeywordId" resultType="java.lang.Integer">
- select searchId from cm_shop_keyword where delFlag = 0
- </select>
- <select id="getSearchFrequencyList" resultType="com.caimei365.manager.entity.caimei.cmUser.CmUserSearchFrequency">
- select * from cm_user_search_frequency
- where delStatus = 1 and trueStatus = 1
- <if test="keyword != null and keyword != ''">
- and keyword like concat('%',#{keyword},'%')
- </if>
- order by searchTime desc
- </select>
- <insert id="insertShopKeyword">
- insert into cm_shop_keyword (shopId, searchId, status, addTime, delFlag)
- values (#{shopId}, #{searchId}, #{status}, now(), #{delFlag})
- </insert>
- <update id="updateShopKeywordStatus">
- update cm_shop_keyword
- set status = #{status}
- where id = #{id}
- </update>
- <update id="delShopKeyword">
- update cm_shop_keyword
- set delFlag = 1
- where id = #{id}
- </update>
- <select id="getShopPopUp" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopPopUp">
- select
- id,
- shopId,
- image,
- guidingOne,
- guidingTwo,
- addTime
- from cm_shop_popUp
- where shopId = #{shopId}
- </select>
- <insert id="insertShopPopUp">
- insert into cm_shop_popUp(shopId, image, guidingOne, guidingTwo, addTime)
- values (#{shopId}, #{image}, #{guidingOne}, #{guidingTwo}, now())
- </insert>
- <update id="updateShopPopUp">
- update cm_shop_popUp
- set image = #{image},
- guidingOne = #{guidingOne},
- guidingTwo = #{guidingTwo}
- where id = #{id}
- </update>
- <select id="getShopAdvertisingImage" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopAdvertisingImage">
- select
- csa.id,
- csa.shopId,
- s.name as shopName,
- csa.pcImage,
- csa.appImage,
- csa.jumpLink,
- csa.sort,
- csa.addTime,
- csa.status,
- csa.delFlag
- ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = 5 and csa.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
- from cm_shop_advertisingImage csa
- left join shop s on s.shopId = csa.shopId
- <where>
- csa.delFlag = 0
- <if test="shopName != null and shopName != ''">
- and s.name like concat('%',#{shopName},'%')
- </if>
- <if test="status != null">
- and csa.status = #{status}
- </if>
- </where>
- order by csa.sort asc, csa.addTime desc
- </select>
- <select id="getShopAdvertisingImageById" resultType="com.caimei365.manager.entity.caimei.cmUser.CmShopAdvertisingImage">
- select id, shopId, pcImage, appImage, jumpLink, sort, addTime, status, delFlag
- from cm_shop_advertisingImage
- where id = #{id}
- </select>
- <insert id="insertShopAdvertisingImage">
- insert into cm_shop_advertisingImage (shopId, pcImage, appImage, jumpLink, sort, addTime, status, delFlag)
- values (#{shopId}, #{pcImage}, #{appImage}, #{jumpLink}, #{sort}, now(), #{status}, #{delFlag})
- </insert>
- <update id="updateShopAdvertisingImage">
- update cm_shop_advertisingImage
- set shopId = #{shopId},
- pcImage = #{pcImage},
- appImage = #{appImage},
- jumpLink = #{jumpLink},
- status = #{status}
- where id = #{id}
- </update>
- <update id="updateShopAdvertisingImageSort">
- update cm_shop_advertisingImage
- set sort = #{sort}
- where id = #{id}
- </update>
- <update id="updateShopAdvertisingImageStatus">
- update cm_shop_advertisingImage
- set status = #{status}
- where id = #{id}
- </update>
- <update id="delShopAdvertisingImage">
- update cm_shop_advertisingImage
- set delFlag = 1
- where id = #{id}
- </update>
- <select id="getPageShop" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShop">
- SELECT
- cps.id,
- cps.shopId,
- s.name AS shopName,
- cps.shopLink,
- IFNULL(SUM(cps.accessNumber), 0) AS accessNumber,
- IFNULL(SUM(cps.accessDuration), 0) AS accessDuration,
- IFNULL((IFNULL(SUM(cps.accessDuration), 0) / IFNULL(SUM(cps.accessNumber), 0)), 0) AS averageDuration
- FROM cm_page_shop cps
- LEFT JOIN shop s ON s.shopId = cps.shopId
- <where>
- cps.shopId = #{shopId}
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and cps.accessDate BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- group by cps.shopId
- </select>
- <select id="getPageShopProduct" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopProduct">
- SELECT
- cpsp.id,
- cpsp.shopId,
- cpsp.productId,
- p.name as productName,
- p.mainImage,
- copi.validFlag,
- cpsp.link,
- IFNULL(SUM(cpsp.accessNumber), 0) AS accessNumber,
- IFNULL(SUM(cpsp.accessDuration), 0) AS accessDuration,
- IFNULL((IFNULL(SUM(cpsp.accessDuration), 0) / IFNULL(SUM(cpsp.accessNumber), 0)), 0) AS averageDuration
- FROM cm_page_shop_product cpsp
- LEFT JOIN product p ON p.productId = cpsp.productId
- LEFT JOIN cm_organize_product_info copi ON copi.productId = cpsp.productId
- WHERE cpsp.shopId = #{shopId} and copi.organizeId = 0
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and cpsp.accessDate BETWEEN #{startTime} and #{endTime}
- </if>
- group by cpsp.productId
- </select>
- <select id="getPageShopInfo" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopInfo">
- SELECT
- cpsi.id,
- cpsi.shopId,
- cpsi.infoId,
- i.guidanceImage,
- i.title,
- i.onlineStatus,
- cpsi.link,
- IFNULL(SUM(cpsi.accessNumber), 0) AS accessNumber,
- IFNULL(SUM(cpsi.accessDuration), 0) AS accessDuration,
- IFNULL((IFNULL(SUM(cpsi.accessDuration), 0) / IFNULL(SUM(cpsi.accessNumber), 0)), 0) AS averageDuration
- FROM cm_page_shop_info cpsi
- LEFT JOIN info i ON i.id = cpsi.infoId
- WHERE cpsi.shopId = #{shopId}
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and cpsi.accessDate BETWEEN #{startTime} and #{endTime}
- </if>
- group by cpsi.infoId
- </select>
- <select id="getPageShopKeyword" resultType="com.caimei365.manager.entity.caimei.cmUser.CmPageShopKeyword">
- SELECT
- cpsk.id,
- cpsk.shopId,
- cusf.keyword,
- cpsk.link,
- IFNULL(SUM(cpsk.accessNumber), 0) AS accessNumber,
- IFNULL(SUM(cpsk.accessDuration), 0) AS accessDuration,
- IFNULL((IFNULL(SUM(cpsk.accessDuration), 0) / IFNULL(SUM(cpsk.accessNumber), 0)), 0) AS averageDuration
- FROM cm_page_shop_keyword cpsk
- LEFT JOIN cm_user_search_frequency cusf ON cusf.id = cpsk.searchId
- WHERE cpsk.shopId = #{shopId}
- <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
- and cpsk.accessDate BETWEEN #{startTime} and #{endTime}
- </if>
- group by cpsk.searchId
- </select>
- </mapper>
|