| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?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.ruixuan.salesLeads.mapper.SaleClueInfoMapper">
- <!-- 批量新增销售线索-->
- <insert id="replaceSaleClueInfoBatch">
- replace into sale_clue_info(
- sales_leads_type,
- seller_id,
- seller_name,
- fans,
- industry_id,
- province_id,
- city_id,
- telephone,
- provider_flag,
- transition_flag,
- upload_date,
- distribution_sale_flag,
- sale_id,
- state,
- offline_sale_flag,
- create_user_id,
- create_time)
- values
- <foreach collection="saleClueList" item="info" separator=",">
- (
- #{info.salesLeadsType},
- #{info.sellerId},
- #{info.sellerName},
- #{info.fans},
- #{info.industryId},
- #{info.provinceId},
- #{info.cityId},
- #{info.telephone},
- #{info.providerFlag},
- #{info.transitionFlag},
- #{info.uploadDate},
- #{info.distributionSaleFlag},
- #{info.saleId},
- #{info.state},
- #{info.offlineSaleFlag},
- #{info.createUserId},
- NOW()
- )
- </foreach>
- </insert>
- <!-- 销售线索列表信息 -->
- <select id="selectSaleClueInfoList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
- SELECT
- s.id,
- s.sales_leads_type,
- s.seller_id,
- s.seller_name,
- s.fans,
- s.industry_id,
- (SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
- s.province_id,
- (SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
- s.city_id,
- (SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
- s.telephone,
- s.provider_flag,
- s.transition_flag,
- s.upload_date,
- s.distribution_sale_flag,
- s.sale_id,
- (SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
- s.state,
- s.offline_sale_flag,
- s.create_user_id,
- s.create_time
- FROM
- sale_clue_info s
- <where>
- <if test="sellerName !=null and sellerName != ''">
- and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
- </if>
- <if test="uploadDate !=null and uploadDate != ''">
- and s.upload_date = #{uploadDate}
- </if>
- <if test="distributionSaleFlag !=null and distributionSaleFlag != ''" >
- and s.distribution_sale_flag = #{distributionSaleFlag}
- </if>
- <if test="industryId !=null and industryId != ''">
- and s.industry_id = #{industryId}
- </if>
- <if test="state !=null and state != ''">
- and s.state = #{state}
- </if>
- <if test="userId !=null and userId != ''">
- and s.update_user_id = #{userId}
- </if>
- <if test="fansType == '1'.toString()">
- and s.fans BETWEEN 0 AND 500000
- </if>
- <if test="fansType == '2'.toString()">
- and s.fans BETWEEN 500000 AND 2000000
- </if>
- <if test="fansType == '3'.toString()">
- and s.fans BETWEEN 2000000 AND 5000000
- </if>
- <if test="fansType == '4'.toString()">
- and s.fans >=5000000
- </if>
- </where>
- </select>
- <!-- 销售线索 任务 列表信息 -->
- <select id="selectSaleClueTaskList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
- SELECT
- s.id,
- s.sales_leads_type,
- s.seller_id,
- s.seller_name,
- s.fans,
- s.industry_id,
- (SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
- s.province_id,
- (SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
- s.city_id,
- (SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
- s.telephone,
- s.provider_flag,
- s.transition_flag,
- s.upload_date,
- s.distribution_sale_flag,
- s.sale_id,
- (SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
- s.state,
- s.offline_sale_flag,
- s.create_user_id,
- s.create_time
- FROM
- sale_clue_info s
- <where>
- <if test="sellerName !=null and sellerName != ''">
- and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
- </if>
- <if test="state !=null and state != ''">
- and s.state = #{state}
- </if>
- <if test="saleId !=null and saleId != ''">
- and s.sale_id = #{saleId}
- </if>
- </where>
- </select>
- <!-- 根据卖家ids 查询销售线索 -->
- <select id="selectSaleClueInfoBySellers" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
- SELECT
- s.id,
- s.sales_leads_type,
- s.seller_id,
- s.seller_name,
- s.fans,
- s.industry_id,
- s.province_id,
- s.city_id,
- s.telephone,
- s.provider_flag,
- s.transition_flag,
- s.upload_date,
- s.distribution_sale_flag,
- s.sale_id,
- s.state,
- s.offline_sale_flag,
- s.create_user_id,
- s.create_time
- FROM
- sale_clue_info s
- <where>
- <if test="sellerIds != null and sellerIds.size() != 0 ">
- and s.seller_id in
- <foreach collection="sellerIds" item="item" separator=","
- open="(" close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <!-- 修改销售线索 销售人员 -->
- <update id="updateSaleClueSale">
- UPDATE sale_clue_info
- SET
- distribution_sale_flag = #{distributionSaleFlag},
- sale_id = #{saleId}
- WHERE
- seller_id = #{sellerId}
- </update>
- <!-- 修改销售线索 状态 -->
- <update id="updateSaleClueState">
- UPDATE sale_clue_info
- SET
- state = #{state}
- WHERE
- seller_id = #{sellerId}
- </update>
- </mapper>
|