Administrator
2018-10-30 4d2ed56ef49504d90640209c320d61cef8f4ad9c
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -1037,18 +1037,80 @@
   </select>
   
   
   <select id="listRecommendBykey" resultMap="BaseResultMap">
   <select id="listRecommendBykey"  resultMap="BaseResultMap">
      SELECT   <include refid="Base_Column_List" />  FROM `yeshi_ec_quality_factory` h
      LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
      WHERE 1=1  <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
      ORDER BY h.sg_weight DESC
      WHERE 1=1
      <!-- 关键词搜索  -->
      <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
      <!-- 在售价范围  -->
       <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
       </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
      </if>
      <!-- 有券  -->
      <if test='hasQuan != null'>
            AND <![CDATA[  tb.`couponLeftCount` > 1]]>
      </if>
      <!-- 天猫商品  -->
      <if test='userType != null'>
            AND <![CDATA[  tb.`userType` = 1]]>
      </if>
      ORDER BY
         <!-- 销量高到低   -->
          <if test='sort == 1'>
                tb.`biz30day` desc,
          </if>
          <!-- 价格 低到高   -->
          <if test='sort == 3'>
                tb.`zkPrice`,
          </if>
          <!-- 价格 高到低   -->
          <if test='sort == 2'>
                tb.`zkPrice` desc,
          </if>
          <!-- 推广量 高到低   -->
          <if test='sort == 4'>
                tb.`totalSales` desc,
          </if>
         <!-- 佣金比例  -->
          <if test='sort == 5'>
                tb.`tkRate` desc,
          </if>
          <!-- 佣金比例 -->
          <if test='sort == 6'>
                tb.`tkRate`,
          </if>
          <!-- 默认:权重高到低-->
         h.sg_weight DESC
      LIMIT #{start},#{count}
   </select>
   
   <select id="countRecommendBykey" resultType="java.lang.Long">
      SELECT IFNULL(COUNT( h.`sg_id`),0)  FROM `yeshi_ec_quality_factory` h
      SELECT IFNULL(COUNT(h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
      LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
      WHERE 1=1  <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
      WHERE 1=1
      <!-- 关键词搜索  -->
      <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
      <!-- 在售价范围  -->
       <if test='startprice != null'>
            AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
       </if>
        <if test='endprice != null'>
            AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
      </if>
      <!-- 有券  -->
      <if test='hasQuan != null'>
            AND <![CDATA[  tb.`couponLeftCount` > 1]]>
      </if>
      <!-- 天猫商品  -->
      <if test='userType != null'>
            AND <![CDATA[  tb.`userType` = 1]]>
      </if>
   </select>
   
</mapper>