From 59bfbce44674e52aefbe883233ffaea93d750a8f Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 25 十一月 2019 09:56:17 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml | 2852 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 1,426 insertions(+), 1,426 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
index c3add65..1278ee6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -1,1426 +1,1426 @@
-<?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.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper">
-	<resultMap id="BaseResultMap"
-		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
-		<id column="sg_id" property="id" jdbcType="BIGINT" />
-		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
-		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
-		<result column="sg_goods_source" property="goodsSource"
-			jdbcType="INTEGER" />
-		<result column="sg_source_calss" property="sourceCalss"
-			jdbcType="VARCHAR" />
-		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
-		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
-		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
-
-		<association property="taoBaoGoodsBrief" column="sg_goods_id"
-			select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
-		</association>
-
-		<association property="boutiqueAutoRule" column="sg_rule_id"
-			javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
-			<id column="sg_rule_id" property="id" jdbcType="BIGINT" />
-		</association>
-
-		<association property="createUser" column="sg_create_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
-		</association>
-		<association property="updateUser" column="sg_update_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
-		</association>
-	</resultMap>
-
-	<resultMap id="ResultMap"
-		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
-		<id column="sg_id" property="id" jdbcType="BIGINT" />
-		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
-		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
-		<result column="sg_goods_source" property="goodsSource"
-			jdbcType="INTEGER" />
-		<result column="sg_source_calss" property="sourceCalss"
-			jdbcType="VARCHAR" />
-		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
-		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
-		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
-
-		<association property="boutiqueAutoRule" column="sg_rule_id"
-			select="com.yeshi.fanli.dao.mybatis.lable.BoutiqueAutoRuleMapper.selectByPrimaryKey">
-		</association>
-
-		<association property="taoBaoGoodsBrief" column="sg_goods_id"
-			select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
-		</association>
-
-		<association property="createUser" column="sg_create_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
-		</association>
-		<association property="updateUser" column="sg_update_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
-		</association>
-	</resultMap>
-
-	<resultMap id="GoodsResultMap"
-		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
-		<id column="sg_id" property="id" jdbcType="BIGINT" />
-		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
-		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
-		<result column="sg_goods_source" property="goodsSource"
-			jdbcType="INTEGER" />
-		<result column="sg_source_calss" property="sourceCalss"
-			jdbcType="VARCHAR" />
-		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
-		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
-		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
-
-		<association property="boutiqueAutoRule" column="sg_rule_id"
-			javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
-			<id column="sg_rule_id" property="id" jdbcType="BIGINT" />
-		</association>
-
-		<association property="taoBaoGoodsBrief" column="sg_goods_id"
-			resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap" />
-
-		<association property="createUser" column="sg_create_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
-		</association>
-		<association property="updateUser" column="sg_update_aid"
-			javaType="com.yeshi.fanli.entity.common.AdminUser">
-			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
-		</association>
-	</resultMap>
-
-	<sql id="Base_Column_List">sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime
-	</sql>
-	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
-		parameterType="java.lang.Long">
-		select
-		<include refid="Base_Column_List" />
-		from yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
-	</select>
-	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
-		yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
-	</delete>
-	<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
-		useGeneratedKeys="true" keyProperty="id">insert into
-		yeshi_ec_quality_factory
-		(sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime)
-		values
-		(#{id,jdbcType=BIGINT},#{systemCid,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{entryMode,jdbcType=INTEGER},#{goodsSource,jdbcType=INTEGER},#{sourceCalss,jdbcType=VARCHAR},#{boutiqueAutoRule.id,jdbcType=BIGINT},#{weight,jdbcType=INTEGER},#{createUser.id,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updateUser.id,jdbcType=BIGINT},#{updatetime,jdbcType=TIMESTAMP})
-	</insert>
-	<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
-		useGeneratedKeys="true" keyProperty="id">
-		insert into yeshi_ec_quality_factory
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="id != null">sg_id,</if>
-			<if test="systemCid != null">sg_class_id,</if>
-			<if test="taoBaoGoodsBrief != null">sg_goods_id,</if>
-			<if test="entryMode != null">sg_entry_mode,</if>
-			<if test="goodsSource != null">sg_goods_source,</if>
-			<if test="sourceCalss != null">sg_source_calss,</if>
-			<if test="boutiqueAutoRule != null">sg_rule_id,</if>
-			<if test="weight != null">sg_weight,</if>
-			<if test="createUser != null">sg_create_aid,</if>
-			<if test="createtime != null">sg_createtime,</if>
-			<if test="updateUser != null">sg_update_aid,</if>
-			<if test="updatetime != null">sg_updatetime,</if>
-		</trim>
-		values
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="id != null">#{id,jdbcType=BIGINT},</if>
-			<if test="systemCid != null">#{systemCid,jdbcType=BIGINT},</if>
-			<if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
-			<if test="entryMode != null">#{entryMode,jdbcType=INTEGER},</if>
-			<if test="goodsSource != null">#{goodsSource,jdbcType=INTEGER},</if>
-			<if test="sourceCalss != null">#{sourceCalss,jdbcType=VARCHAR},</if>
-			<if test="boutiqueAutoRule != null">#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
-			<if test="weight != null">#{weight,jdbcType=INTEGER},</if>
-			<if test="createUser != null">#{createUser.id,jdbcType=BIGINT},</if>
-			<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
-			<if test="updateUser != null">#{updateUser.id,jdbcType=BIGINT},</if>
-			<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
-		</trim>
-	</insert>
-	<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">update
-		yeshi_ec_quality_factory set sg_class_id =
-		#{systemCid,jdbcType=BIGINT},sg_goods_id =
-		#{taoBaoGoodsBrief.id,jdbcType=BIGINT},sg_entry_mode =
-		#{entryMode,jdbcType=INTEGER},sg_goods_source =
-		#{goodsSource,jdbcType=INTEGER},sg_source_calss =
-		#{sourceCalss,jdbcType=VARCHAR},sg_rule_id =
-		#{boutiqueAutoRule.id,jdbcType=BIGINT},sg_weight =
-		#{weight,jdbcType=INTEGER},sg_create_aid =
-		#{createUser.id,jdbcType=BIGINT},sg_createtime =
-		#{createtime,jdbcType=TIMESTAMP},sg_update_aid =
-		#{updateUser.id,jdbcType=BIGINT},sg_updatetime =
-		#{updatetime,jdbcType=TIMESTAMP} where sg_id = #{id,jdbcType=BIGINT}
-	</update>
-	<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">
-		update yeshi_ec_quality_factory
-		<set>
-			<if test="systemCid != null">sg_class_id=#{systemCid,jdbcType=BIGINT},</if>
-			<if test="taoBaoGoodsBrief != null">sg_goods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
-			<if test="entryMode != null">sg_entry_mode=#{entryMode,jdbcType=INTEGER},</if>
-			<if test="goodsSource != null">sg_goods_source=#{goodsSource,jdbcType=INTEGER},</if>
-			<if test="sourceCalss != null">sg_source_calss=#{sourceCalss,jdbcType=VARCHAR},</if>
-			<if test="boutiqueAutoRule != null">sg_rule_id=#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
-			<if test="weight != null">sg_weight=#{weight,jdbcType=INTEGER},</if>
-			<if test="createUser != null">sg_create_aid=#{createUser.id,jdbcType=BIGINT},</if>
-			<if test="createtime != null">sg_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
-			<if test="updateUser != null">sg_update_aid=#{updateUser.id,jdbcType=BIGINT},</if>
-			<if test="updatetime != null">sg_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
-		</set>
-		where sg_id = #{id,jdbcType=BIGINT}
-	</update>
-
-
-	<!-- 鏌ヨ瓒呰繃4涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
-	<update id="updateWeight">
-		UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
-		WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
-	</update>
-
-
-
-	<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
-		DELETE FROM yeshi_ec_quality_factory WHERE sg_id in
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-	</delete>
-
-	<delete id="deleteBatchByGoodsId" parameterType="java.util.List">
-		DELETE FROM yeshi_ec_quality_factory WHERE sg_goods_id in
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-	</delete>
-
-
-	<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"
-		parameterType="java.util.List">
-		INSERT IGNORE yeshi_ec_quality_factory
-		(
-		<include refid="Base_Column_List" />
-		)
-		values
-
-		<foreach collection="list" item="item" separator=",">
-			(
-			#{item.id,jdbcType=BIGINT},
-			#{item.systemCid,jdbcType=BIGINT},
-			#{item.taoBaoGoodsBrief.id,jdbcType=BIGINT},
-			#{item.entryMode,jdbcType=INTEGER},
-			#{item.goodsSource,jdbcType=INTEGER},
-			#{item.sourceCalss,jdbcType=VARCHAR},
-			#{item.boutiqueAutoRule.id,jdbcType=BIGINT},
-			#{item.weight,jdbcType=INTEGER},
-			#{item.createUser.id,jdbcType=BIGINT},
-			#{item.createtime,jdbcType=TIMESTAMP},
-			#{item.updateUser.id,jdbcType=BIGINT},
-			#{item.updatetime,jdbcType=TIMESTAMP}
-			)
-
-		</foreach>
-	</insert>
-
-	<update id="updateBatchSelective" parameterType="java.util.List">
-
-		update yeshi_ec_quality_factory
-		<trim prefix="set" suffixOverrides=",">
-			<trim prefix="sg_weight =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.weight !=null">
-						when sg_id=#{item.id} then #{item.weight}
-					</if>
-				</foreach>
-			</trim>
-
-			<trim prefix="sg_goods_source =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.goodsSource !=null">
-						when sg_id=#{item.id} then #{item.goodsSource}
-					</if>
-				</foreach>
-			</trim>
-			<trim prefix="sg_rule_id =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.boutiqueAutoRule !=null">
-						when sg_id=#{item.id} then #{item.boutiqueAutoRule.id}
-					</if>
-				</foreach>
-			</trim>
-
-			<trim prefix="sg_source_calss =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.sourceCalss !=null">
-						when sg_id=#{item.id} then #{item.sourceCalss}
-					</if>
-				</foreach>
-			</trim>
-			<trim prefix="sg_createtime =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.createtime !=null">
-						when sg_id=#{item.id} then #{item.createtime}
-					</if>
-				</foreach>
-			</trim>
-			<trim prefix="sg_updatetime =case" suffix="end,">
-				<foreach collection="list" item="item" index="index">
-					<if test="item.updatetime !=null">
-						when sg_id=#{item.id} then #{item.updatetime}
-					</if>
-				</foreach>
-			</trim>
-		</trim>
-		where sg_id in
-		<foreach collection="list" index="index" item="item"
-			separator="," open="(" close=")">
-			#{item.id,jdbcType=BIGINT}
-		</foreach>
-	</update>
-
-	<!-- 鏌ヨ鎵�鏈夊晢鍝佷俊鎭� 鏇存柊鏃堕棿杈冩棭鍦ㄥ墠 -->
-	<select id="queryAll" resultMap="BaseResultMap">
-		SELECT * FROM yeshi_ec_quality_factory
-		<if test="days != null">
-			WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
-			DATE(lab_updatetime);
-		</if>
-		order by sg_updatetime LIMIT ${start},${count}
-
-	</select>
-
-
-	<!-- 鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
-	<select id="query" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
-		resultMap="ResultMap">
-
-		SELECT ts.* FROM (
-		SELECT DISTINCT( tt.`sg_id`) AS id FROM
-		yeshi_ec_quality_factory tt
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		tt.`sg_goods_id`= tb.`id`
-		<if test='keyType == 3'>
-			LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
-			lg.`lg_goods_id`
-			LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
-			lab.`lab_id`
-		</if>
-		WHERE 1=1
-		<if test="goodsSource != null">
-			<!-- 鏉ユ簮 -->
-			AND tt.`sg_goods_source` = ${goodsSource}
-		</if>
-
-		<if test="days != null">
-			<!-- 鍏ュ簱鏃堕棿 -->
-			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startZkPrice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
-		</if>
-
-		<if test='endZkPrice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
-		</if>
-
-		<!-- 鏈堥攢閲� -->
-		<if test='startBiz30day != null'>
-			AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
-		</if>
-		<if test='endBiz30day != null'>
-			AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
-		</if>
-
-		<!-- 鏉冮噸鑼冨洿 -->
-		<if test='startWeight != null'>
-			AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
-		</if>
-		<if test='endWeight != null'>
-			AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
-		</if>
-
-		<!-- 浣i噾姣斾緥鑼冨洿 -->
-		<if test='startTkRate != null'>
-			AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
-		</if>
-		<if test='endTkRate != null'>
-			AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
-		</if>
-
-		<!-- 鍒搁潰棰濓細鍑忓灏� -->
-		<if test='startAmount != null'>
-			AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
-		</if>
-		<if test='endAmount != null'>
-			AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
-		</if>
-
-		<!-- 鍒告瘮渚� -->
-		<if test='startPropor != null'>
-			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
-		</if>
-		<!-- 鍒告瘮渚� -->
-		<if test='endPropor != null'>
-			AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
-		</if>
-
-		<!-- 鏈変紭鎯犲埜 -->
-		<if test='hasCoupon == 1'>
-			AND <![CDATA[  tb.`couponAmount` > 0 ]]>
-		</if>
-
-		<!-- 鍖呴偖 -->
-		<if test='freeShipment == 1'>
-			AND tb.`freeShipment` = 1
-		</if>
-
-		<!-- 娑堣垂鑰呬繚闅� -->
-		<if test='isPrepay == 1'>
-			AND tb.`isPrepay` = 1
-		</if>
-
-		<!-- 鎴愪氦杞寲 -->
-		<if test='payRate30 == 1'>
-			AND tb.`payRate30` = 1
-		</if>
-
-		<!-- 濂借瘎鐜� -->
-		<if test='goodRate == 1'>
-			AND tb.`goodRate` = 1
-		</if>
-
-		<!-- 閫�娆剧巼 -->
-		<if test='rfdRate == 1'>
-			AND tb.`rfdRate` = 1
-		</if>
-
-		<!-- 鍒嗙被id -->
-		<if test='gcid != null'>
-			AND tt.sg_class_id = #{gcid}
-		</if>
-		<!-- 鎼滅储鏉′欢: 鍟嗗搧鍚嶇О銆佸晢鍝乮d銆佹爣绛惧悕绉� -->
-		<if test='key != null and key != ""'>
-			<if test='keyType == 1'>
-				AND tb.`auctionId` = '${key}'
-			</if>
-			<if test='keyType == 2'>
-				AND tb.`title` LIKE '%${key}%'
-			</if>
-			<if test='keyType == 3'>
-				AND lab.`lab_title` = '${key}'
-			</if>
-			<if test='keyType == 4'>
-				AND tb.`shopTitle` = '${key}'
-			</if>
-		</if>
-
-		ORDER BY
-
-		<!-- 閿�閲� -->
-		<if test='totalSales == 1'>
-			tb.`biz30day`,
-		</if>
-		<if test='totalSales == 2'>
-			tb.`biz30day` desc,
-		</if>
-		<!-- 浠锋牸 -->
-		<if test='price == 1'>
-			tb.`zkPrice`,
-		</if>
-		<if test='price == 2'>
-			tb.`zkPrice` desc,
-		</if>
-		<!-- 浠锋牸 -->
-		<if test='tkRate == 1'>
-			tb.`tkRate`,
-		</if>
-		<if test='tkRate == 2'>
-			tb.`tkRate` desc,
-		</if>
-		<!-- 鍒告瘮渚� -->
-		<if test='propor == 1'>
-			ROUND(tb.couponAmount/tb.`zkPrice` *100,2),
-		</if>
-		<if test='propor == 2'>
-			ROUND(tb.couponAmount/tb.`zkPrice` *100,2) desc,
-		</if>
-		tt.`sg_updatetime` desc
-		LIMIT ${start},${count}
-		) a LEFT JOIN
-		yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
-
-
-	</select>
-
-	<select id="queryCount" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
-		resultType="java.lang.Long">
-		<!-- 鏍规嵁鏉′欢缁熻鎵�鏈夋爣绛炬暟閲� -->
-		SELECT count(ts.sg_id) FROM (
-		SELECT DISTINCT( tt.`sg_id`) AS id FROM
-		yeshi_ec_quality_factory tt
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		tt.`sg_goods_id`= tb.`id`
-		<if test='keyType == 3'>
-			LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
-			lg.`lg_goods_id`
-			LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
-			lab.`lab_id`
-		</if>
-		WHERE 1=1
-		<if test="goodsSource != null">
-			<!-- 鏉ユ簮 -->
-			AND tt.`sg_goods_source` = ${goodsSource}
-		</if>
-
-		<if test="days != null">
-			<!-- 鍏ュ簱鏃堕棿 -->
-			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startZkPrice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
-		</if>
-
-		<if test='endZkPrice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
-		</if>
-
-		<!-- 鏈堥攢閲� -->
-		<if test='startBiz30day != null'>
-			AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
-		</if>
-		<if test='endBiz30day != null'>
-			AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
-		</if>
-
-		<!-- 鏉冮噸鑼冨洿 -->
-		<if test='startWeight != null'>
-			AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
-		</if>
-		<if test='endWeight != null'>
-			AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
-		</if>
-
-		<!-- 浣i噾姣斾緥鑼冨洿 -->
-		<if test='startTkRate != null'>
-			AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
-		</if>
-		<if test='endTkRate != null'>
-			AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
-		</if>
-
-		<!-- 鍒搁潰棰濓細鍑忓灏� -->
-		<if test='startAmount != null'>
-			AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
-		</if>
-		<if test='endAmount != null'>
-			AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
-		</if>
-
-		<!-- 鍒告瘮渚� -->
-		<if test='startPropor != null'>
-			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
-		</if>
-		<!-- 鍒告瘮渚� -->
-		<if test='endPropor != null'>
-			AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
-		</if>
-
-		<!-- 鏈変紭鎯犲埜 -->
-		<if test='hasCoupon == 1'>
-			AND <![CDATA[  tb.`couponAmount` > 0 ]]>
-		</if>
-
-		<!-- 鍖呴偖 -->
-		<if test='freeShipment == 1'>
-			AND tb.`freeShipment` = 1
-		</if>
-
-		<!-- 娑堣垂鑰呬繚闅� -->
-		<if test='isPrepay == 1'>
-			AND tb.`isPrepay` = 1
-		</if>
-
-		<!-- 鎴愪氦杞寲 -->
-		<if test='payRate30 == 1'>
-			AND tb.`payRate30` = 1
-		</if>
-
-		<!-- 濂借瘎鐜� -->
-		<if test='goodRate == 1'>
-			AND tb.`goodRate` = 1
-		</if>
-
-		<!-- 閫�娆剧巼 -->
-		<if test='rfdRate == 1'>
-			AND tb.`rfdRate` = 1
-		</if>
-
-		<!-- 鍒嗙被id -->
-		<if test='gcid != null'>
-			AND tt.sg_class_id = #{gcid}
-		</if>
-		<!-- 鎼滅储鏉′欢: 鍟嗗搧鍚嶇О銆佸晢鍝乮d銆佹爣绛惧悕绉� -->
-		<if test='key != null and key != ""'>
-			<if test='keyType == 1'>
-				AND tb.`auctionId` = '${key}'
-			</if>
-			<if test='keyType == 2'>
-				AND tb.`title` LIKE '%${key}%'
-			</if>
-			<if test='keyType == 3'>
-				AND lab.`lab_title` = '${key}'
-			</if>
-			<if test='keyType == 4'>
-				AND tb.`shopTitle` = '${key}'
-			</if>
-		</if>
-
-		) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
-	</select>
-
-	<!--鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
-	<select id="queryByGoodsId" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_quality_factory WHERE sg_goods_id = ${goodsId}
-	</select>
-
-
-	<!--鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
-	<select id="getByAuctionId" resultMap="BaseResultMap">
-		SELECT * FROM
-		yeshi_ec_quality_factory
-		WHERE sg_goods_id = ${auctionId}
-		limit 1
-	</select>
-
-
-
-	<select id="queryCountByGoodsId" resultType="java.lang.Long">
-		SELECT COUNT(sg_id)
-		FROM yeshi_ec_quality_factory WHERE sg_goods_id =
-		${goodsId}
-	</select>
-
-	<select id="getCountAll" resultType="java.util.HashMap">
-		<!-- 缁熻浠婃棩鍚勭鏂瑰紡褰曞叆鏁伴噺 -->
-		SELECT COUNT(sg_id) AS total, IFNULL(SUM(CASE WHEN sg_entry_mode = 1
-		THEN 1 ELSE 0 END),0) AS totalMANUAL,
-		IFNULL(SUM(CASE WHEN
-		sg_entry_mode = 2 THEN 1 ELSE 0 END),0) AS totalSYSTEM,
-		IFNULL(SUM(CASE WHEN sg_entry_mode = 3 THEN 1 ELSE 0 END),0) AS
-		totalSEARCH,
-		IFNULL(SUM(CASE WHEN sg_goods_source = 1 THEN 1 ELSE 0
-		END),0) AS totalTB,
-		IFNULL(SUM(CASE WHEN sg_goods_source = 2 THEN 1
-		ELSE 0 END),0) AS
-		totalJD,
-		IFNULL(SUM(CASE WHEN sg_goods_source = 3 THEN
-		1 ELSE 0 END),0) AS totalPDD,
-		IFNULL(SUM(CASE WHEN sg_goods_source = 4
-		THEN 1 ELSE 0 END),0) AS
-		totalWPH
-		FROM yeshi_ec_quality_factory
-	</select>
-
-	<delete id="deleteByGoodsId" parameterType="java.lang.Long">
-		delete from
-		yeshi_ec_quality_factory where sg_goods_id =
-		#{goodsId,jdbcType=BIGINT}
-	</delete>
-
-	<select id="countTotalRows" resultType="java.lang.Long">
-		SELECT COUNT(sg_id) FROM yeshi_ec_quality_factory
-		<if test="days != null">
-			WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
-			DATE(lab_updatetime);
-		</if>
-	</select>
-
-	<select id="listQuery" resultMap="BaseResultMap">
-		<!-- 绉诲姩鏌ヨ -->
-		SELECT * FROM `yeshi_ec_quality_factory` h
-		<if test="labId != null">
-			LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
-			g.`lg_goods_id`
-		</if>
-		<!-- 鍟嗗搧鍏抽敭璇� -->
-		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>
-		<!-- 鍒嗙被id -->
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = ${systemCid}
-		</if>
-		<!-- 鏍囩id -->
-		<if test="labId != null">
-			AND g.`lg_label_id`= ${labId}
-		</if>
-		<!-- 澶氫釜鍒嗙被id -->
-		<if test='cids != null and cids != ""'>
-			AND h.`sg_class_id` in (${cids})
-		</if>
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <> '']]>
-		</if>
-
-		<!-- 鎺掑簭锛氭潈閲� 閿�閲� -->
-		ORDER BY h.sg_weight desc,tb.`biz30day`desc
-
-		LIMIT ${start},${count}
-
-	</select>
-
-	<select id="countQuery" resultType="java.lang.Long">
-		<!-- 绉诲姩缁熻 -->
-		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
-		<if test="labId != null">
-			LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
-			g.`lg_goods_id`
-		</if>
-		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>
-		<!-- 鍒嗙被id -->
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = #{systemCid}
-		</if>
-		<!-- 鏍囩id -->
-		<if test="labId != null">
-			AND g.`lg_label_id`= #{labId}
-		</if>
-		<if test='cids != null and cids != ""'>
-			AND h.`sg_class_id` in (#{cids})
-		</if>
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
-		</if>
-	</select>
-
-
-
-
-
-	<delete id="removeStorageGoods" parameterType="java.lang.Long">
-		DELETE FROM yeshi_ec_quality_factory h
-		WHERE h.`sg_class_id`= #{gcids}
-		AND <![CDATA[ h.`sg_createtime` < #{doTime} ]]>
-		AND h.`sg_goods_id` NOT extsts(SELECT DISTINCT lg.`lg_goods_id` FROM
-		yeshi_ec_label_goods lg)
-	</delete>
-
-	<select id="listQueryGoodsByGoodsId" resultMap="BaseResultMap">
-		<!-- 鏍规嵁auctionId 鏌ヨ鍟嗗搧淇℃伅 -->
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_quality_factory
-		WHERE sg_goods_id in
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-	</select>
-
-
-	<select id="listQueryByKey" 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 tb.`title` LIKE '%${key}%'
-
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = #{systemCid}
-		</if>
-
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
-		</if>
-
-		<!-- 澶╃尗 -->
-		<if test="userType == 1 ">
-			AND tb.userType = #{userType}
-		</if>
-
-		<!-- 閿�閲忎互涓� -->
-		<if test="biz30day != null ">
-			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
-		</if>
-
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
-		</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>
-		h.`sg_weight` desc
-
-		LIMIT #{start},#{count}
-
-	</select>
-
-	<select id="countQueryByKey" resultType="java.lang.Long">
-		<!-- 绉诲姩缁熻 -->
-		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
-		tb.`title` LIKE '%${key}%'
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = #{systemCid}
-		</if>
-
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
-		</if>
-
-		<!-- 澶╃尗 -->
-		<if test="userType == 1 ">
-			AND tb.userType = #{userType}
-		</if>
-
-		<!-- 閿�閲忎互涓� -->
-		<if test="biz30day != null ">
-			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
-		</if>
-
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
-		</if>
-	</select>
-
-	<select id="listQueryByAuctionId" 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
-		tb.auctionId in
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-	</select>
-
-
-	<select id="listQueryByCouponAmount" 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="startAmount != null">
-			AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
-		</if>
-		<if test="endAmount != null">
-			AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
-		</if>
-		<!-- 鍒告瘮渚� -->
-		<if test='startPropor != null'>
-			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
-		</if>
-		ORDER BY h.sg_weight desc,tb.`biz30day`desc
-
-		LIMIT #{start},#{count}
-
-	</select>
-
-	<select id="countQueryByCouponAmount" resultType="java.lang.Long">
-		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="startAmount != null">
-			AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
-		</if>
-		<if test="endAmount != null">
-			AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
-		</if>
-		<!-- 鍒告瘮渚� -->
-		<if test='startPropor != null'>
-			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
-		</if>
-	</select>
-
-	<select id="listQueryByFlashSale" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM yeshi_ec_quality_flash_sale s
-		LEFT JOIN yeshi_ec_quality_factory h ON h.`sg_goods_id` =
-		s.`fs_qfgoods_id`
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		h.`sg_goods_id`= tb.`id`
-
-		WHERE <![CDATA[ tb.`couponTotalCount` > 0 AND tb.couponLeftCount<tb.couponTotalCount ]]>
-
-		ORDER BY (tb.couponLeftCount/tb.couponTotalCount),s.fs_weight desc
-
-		LIMIT ${start},${count}
-	</select>
-
-	<select id="countQueryByFlashSale" resultType="java.lang.Long">
-		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM yeshi_ec_quality_factory h
-		RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` =
-		s.`fs_qfgoods_id`
-
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		h.`sg_goods_id`= tb.`id`
-
-		WHERE <![CDATA[ tb.`couponTotalCount` > 0  AND tb.couponLeftCount<tb.couponTotalCount]]>
-	</select>
-
-
-	<select id="listFlashSaleRandGoods" resultMap="GoodsResultMap">
-		SELECT h.*, tb.* FROM yeshi_ec_quality_factory h
-		RIGHT JOIN
-		yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` = s.`fs_qfgoods_id`
-		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-
-		WHERE s.`fs_id` IS NOT NULL AND tb.`biz30day` <![CDATA[>=]]>
-		10000
-		AND tb.`couponTotalCount` <![CDATA[>]]>10
-		AND tb.couponLeftCount <![CDATA[<]]>
-		tb.couponTotalCount
-		ORDER BY RAND()
-		LIMIT 3
-	</select>
-
-
-	<!-- 鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
-	<select id="listQueryByKeyAndlabIDs" resultMap="BaseResultMap">
-
-		SELECT ts.* FROM (
-		SELECT DISTINCT( tt.`sg_id`) AS id FROM
-		yeshi_ec_quality_factory tt
-
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		tt.`sg_goods_id`= tb.`id`
-
-		LEFT JOIN yeshi_ec_label_goods lg ON
-		tt.`sg_goods_id` = lg.`lg_goods_id`
-
-		WHERE (tb.`title` LIKE '%${key}%'
-		OR lg.`lg_label_id` IN
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-		)
-		<if test="systemCid != null">
-			AND tt.`sg_class_id` = #{systemCid}
-		</if>
-
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
-		</if>
-
-		<!-- 澶╃尗 -->
-		<if test="userType == 1 ">
-			AND tb.userType = #{userType}
-		</if>
-
-		<!-- 閿�閲忎互涓� -->
-		<if test="biz30day != null ">
-			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
-		</if>
-
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
-		</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.`tkRate` desc,
-		</if>
-		tt.`sg_weight` desc
-
-		LIMIT ${start},${count}
-
-		) a LEFT JOIN
-		yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
-
-	</select>
-
-	<select id="countQueryKeyAndlabIDs" resultType="java.lang.Long">
-		<!-- 鏍规嵁鏉′欢缁熻鎵�鏈夋爣绛炬暟閲� -->
-		SELECT count(ts.sg_id) FROM (
-		SELECT DISTINCT(tt.`sg_id`) AS id FROM
-		yeshi_ec_quality_factory tt
-
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		tt.`sg_goods_id`= tb.`id`
-
-		LEFT JOIN yeshi_ec_label_goods lg ON
-		tt.`sg_goods_id` = lg.`lg_goods_id`
-
-		WHERE (tb.`title` LIKE '%${key}%'
-		OR lg.`lg_label_id` IN
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-		)
-
-		<if test="systemCid != null">
-			AND tt.`sg_class_id` = #{systemCid}
-		</if>
-
-		<!-- 鏈夊埜 -->
-		<if test="hasQuan == 1 ">
-			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
-		</if>
-
-		<!-- 澶╃尗 -->
-		<if test="userType == 1 ">
-			AND tb.userType = #{userType}
-		</if>
-
-		<!-- 閿�閲忎互涓� -->
-		<if test="biz30day != null ">
-			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
-		</if>
-
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
-		</if>
-
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
-		</if>
-
-		) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
-	</select>
-
-
-	<select id="listQueryByRebateAmount" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		(SELECT
-		tb.`id`,tb.biz30day,(CASE WHEN<![CDATA[ tb.`zkPrice` < tb.`couponStartFee`]]>
-		THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
-		ELSE
-		(tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
-		END)AS RateAmount FROM yeshi_ec_taobao_goods tb
-		where tb.tkRate >
-		#{tkRate})g
-
-		ON h.`sg_goods_id`= g.`id`
-		WHERE 1=1
-
-		<if test="startAmount != null">
-			AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
-		</if>
-		<if test="endAmount != null">
-			AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
-		</if>
-
-		ORDER BY g.biz30day desc
-
-		LIMIT #{start},#{count}
-
-	</select>
-
-	<select id="countQueryByRebateAmount" resultType="java.lang.Long">
-		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-
-		(SELECT tb.`id`,(CASE WHEN <![CDATA[tb.`zkPrice` < tb.`couponStartFee`]]>
-		THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
-		ELSE
-		(tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
-		END)AS RateAmount FROM yeshi_ec_taobao_goods tb
-		where tb.tkRate >
-		#{tkRate})g
-
-		ON h.`sg_goods_id`= g.`id`
-		WHERE 1=1
-
-		<if test="startAmount != null">
-			AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
-		</if>
-		<if test="endAmount != null">
-			AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
-		</if>
-	</select>
-
-
-	<select id="getAuctionIdbyClassId" resultType="java.lang.Long">
-		SELECT h.`sg_goods_id` FROM `yeshi_ec_quality_factory` h
-		WHERE h.`sg_goods_source` = #{goodsSource}
-		AND h.`sg_updatetime` <![CDATA[<]]>
-		#{beforeTime}
-		<if test="systemCid != null">AND h.`sg_class_id` = #{systemCid}</if>
-	</select>
-
-
-	<select id="listRecommendToIndex" resultMap="BaseResultMap">
-		SELECT
-		<include refid="Base_Column_List" />
-		FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		(SELECT tb.`id`,tb.tkRate,
-				<![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
-     			ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion} END)AS rateAmount 
-     			FROM  yeshi_ec_taobao_goods tb
-     			WHERE tb.tkRate >=  #{tkRate} 
-     				AND tb.`couponAmount` >=  #{couponAmount}
-     				AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
-     			]]>
-		)g
-
-		ON h.`sg_goods_id`= g.`id`
-
-		WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
-
-		ORDER BY h.sg_weight DESC
-
-		LIMIT #{start},#{count}
-
-	</select>
-
-	<select id="countRecommendToIndex" resultType="java.lang.Long">
-		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		(SELECT tb.`id`,tb.tkRate,
-				 <![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*${proportion}
-     			ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*${proportion} END)AS RateAmount 
-     			FROM  yeshi_ec_taobao_goods tb
-     			WHERE tb.tkRate >=  #{tkRate} 
-     				  AND tb.`couponAmount` >=  #{couponAmount}
-     			      AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
-     			]]>
-		)g
-
-		ON h.`sg_goods_id`= g.`id`
-
-		WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
-	</select>
-
-
-	<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>
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
-		</if>
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
-		</if>
-		<!-- 杩斿埄姣旇寖鍥� -->
-		<if test='startTkRate != null'>
-			AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
-		</if>
-		<if test='endTkRate != null'>
-			AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
-		</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>
-		<!-- 浣i噾姣斾緥 -->
-		<if test='sort == 5'>
-			tb.`tkRate` desc,
-		</if>
-		<!-- 浣i噾姣斾緥 -->
-		<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
-		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>
-		<!-- 鍦ㄥ敭浠疯寖鍥� -->
-		<if test='startprice != null'>
-			AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
-		</if>
-		<if test='endprice != null'>
-			AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
-		</if>
-		<!-- 杩斿埄姣旇寖鍥� -->
-		<if test='startTkRate != null'>
-			AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
-		</if>
-		<if test='endTkRate != null'>
-			AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
-		</if>
-		<!-- 鏈夊埜 -->
-		<if test='hasQuan != null'>
-			AND <![CDATA[  tb.`couponLeftCount` > 1]]>
-		</if>
-		<!-- 澶╃尗鍟嗗搧 -->
-		<if test='userType != null'>
-			AND <![CDATA[  tb.`userType` = 1]]>
-		</if>
-	</select>
-
-	<select id="listQueryBylabIDs" resultMap="GoodsResultMap">
-		SELECT * FROM (
-		SELECT DISTINCT( tt.`sg_id`) AS tbid FROM
-		yeshi_ec_quality_factory tt
-
-		LEFT JOIN yeshi_ec_taobao_goods tb ON
-		tt.`sg_goods_id`= tb.`id`
-
-		LEFT JOIN yeshi_ec_label_goods lg ON
-		tt.`sg_goods_id` = lg.`lg_goods_id`
-
-		WHERE tb.`id` != #{gid}
-		<if test='systemCid != null'>
-			AND tt.`sg_class_id` = #{systemCid}
-		</if>
-		AND lg.`lg_label_id` IN
-		<foreach collection="list" item="item" open="(" close=")"
-			separator=",">#{item}</foreach>
-		LIMIT ${start},${count}
-		) a LEFT JOIN yeshi_ec_quality_factory ts ON
-		ts.`sg_id`=a.tbid
-		LEFT JOIN yeshi_ec_taobao_goods tbb ON
-		ts.`sg_goods_id`= tbb.`id`
-	</select>
-
-
-	<select id="listByMinSalesCountOrderByCreateTimeDesc" resultMap="BaseResultMap">
-		SELECT f.* FROM `yeshi_ec_quality_factory` f LEFT JOIN
-		yeshi_ec_taobao_goods t ON f.`sg_goods_id`=t.`id` WHERE
-		t.`biz30day`>=#{salesCount} ORDER BY f.`sg_createtime` DESC limit
-		#{start},#{count}
-	</select>
-
-
-	<select id="listByShopId" resultMap="GoodsResultMap">
-		SELECT * FROM
-		yeshi_ec_quality_factory q
-		LEFT JOIN `yeshi_ec_taobao_goods` t ON
-		q.`sg_goods_id` = t.`id`
-		WHERE t.`sellerId` = #{shopId}
-		ORDER BY
-		q.`sg_weight` DESC
-		LIMIT #{start},#{count}
-	</select>
-
-	<select id="countByShopId" resultType="java.lang.Long">
-		SELECT
-		ifnull(count(sg_id),0) FROM yeshi_ec_quality_factory q
-		LEFT JOIN
-		`yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
-		WHERE
-		t.`sellerId` = #{shopId}
-	</select>
-
-	<select id="get9k9ClassGoods" resultMap="GoodsResultMap">
-		SELECT * FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE
-		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
-		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-		AND tb.`zkPrice` <![CDATA[<=]]>
-		#{zkPrice}
-		AND tb.`biz30day` <![CDATA[>=]]>
-		#{biz30day}
-		<!-- 鍒稿悗浠疯寖鍥� -->
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
-		#{minQuanPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
-		#{maxQuanPrice}
-		<!-- 澶氫釜鍒嗙被id -->
-		<if test='cids != null and cids != ""'>
-			AND h.`sg_class_id` in (${cids})
-		</if>
-		ORDER BY h.sg_weight desc,tb.`biz30day`desc
-		LIMIT ${start},${count}
-	</select>
-
-	<select id="count9k9ClassGoods" resultType="java.lang.Long">
-		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
-		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
-		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-		AND tb.`zkPrice` <![CDATA[<=]]>
-		#{zkPrice}
-		AND tb.`biz30day` <![CDATA[>=]]>
-		#{biz30day}
-		<!-- 鍒稿悗浠疯寖鍥� -->
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
-		#{minQuanPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
-		#{maxQuanPrice}
-		<!-- 澶氫釜鍒嗙被id -->
-		<if test='cids != null and cids != ""'>
-			AND h.`sg_class_id` in (${cids})
-		</if>
-	</select>
-
-
-	<!-- 姣忔棩蹇呮姠 -->
-	<select id="listQueryEverydayRob" resultMap="GoodsResultMap">
-		SELECT * FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE
-		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
-		1 AND tb.couponAmount <![CDATA[<=]]>
-		50
-		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-		AND tb.`zkPrice` <![CDATA[<=]]>
-		#{zkPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
-		#{minQuanPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
-		#{maxQuanPrice}
-		ORDER BY h.sg_createtime desc
-		LIMIT ${start},${count}
-	</select>
-
-	<select id="countQueryEverydayRob" resultType="java.lang.Long">
-		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
-		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
-		1 AND tb.couponAmount <![CDATA[<=]]>
-		50
-		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-		AND tb.`zkPrice` <![CDATA[<=]]>
-		#{zkPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
-		#{minQuanPrice}
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
-		#{maxQuanPrice}
-	</select>
-
-	<select id="listFreeGoods" resultMap="GoodsResultMap">
- 		SELECT * FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0 
-			 AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-			 <!-- 鍦ㄥ敭浠�  209.9 -->
-			 AND tb.`zkPrice` <![CDATA[<=]]> 209.9
-			 <!--  鍒稿悗浠疯寖鍥�  0~9.9 -->
-			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> 0
-			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]> 9.9
-			 <!-- 姣斾緥  20 -->
-			 AND  tb.`tkRate` <![CDATA[>=]]> 20
-		ORDER BY h.sg_weight desc
-		LIMIT ${start},${count}
-	</select>
-
-
-
-
-	<select id="countFreeGoods" resultType="java.lang.Long">
-		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
-		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
-		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
-		<!-- 鍦ㄥ敭浠� 209.9 -->
-		AND tb.`zkPrice` <![CDATA[<=]]>
-		209.9
-		<!-- 鍒稿悗浠疯寖鍥� 0~9.9 -->
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
-		0
-		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
-		9.9
-		<!-- 姣斾緥 20 -->
-		AND tb.`tkRate` <![CDATA[>=]]>
-		20
-	</select>
-
-
-</mapper>
+<?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.yeshi.fanli.dao.mybatis.lable.QualityFactoryMapper">
+	<resultMap id="BaseResultMap"
+		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
+		<id column="sg_id" property="id" jdbcType="BIGINT" />
+		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
+		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
+		<result column="sg_goods_source" property="goodsSource"
+			jdbcType="INTEGER" />
+		<result column="sg_source_calss" property="sourceCalss"
+			jdbcType="VARCHAR" />
+		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
+		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
+		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+
+		<association property="taoBaoGoodsBrief" column="sg_goods_id"
+			select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
+		</association>
+
+		<association property="boutiqueAutoRule" column="sg_rule_id"
+			javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
+			<id column="sg_rule_id" property="id" jdbcType="BIGINT" />
+		</association>
+
+		<association property="createUser" column="sg_create_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
+		</association>
+		<association property="updateUser" column="sg_update_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
+		</association>
+	</resultMap>
+
+	<resultMap id="ResultMap"
+		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
+		<id column="sg_id" property="id" jdbcType="BIGINT" />
+		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
+		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
+		<result column="sg_goods_source" property="goodsSource"
+			jdbcType="INTEGER" />
+		<result column="sg_source_calss" property="sourceCalss"
+			jdbcType="VARCHAR" />
+		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
+		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
+		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+
+		<association property="boutiqueAutoRule" column="sg_rule_id"
+			select="com.yeshi.fanli.dao.mybatis.lable.BoutiqueAutoRuleMapper.selectByPrimaryKey">
+		</association>
+
+		<association property="taoBaoGoodsBrief" column="sg_goods_id"
+			select="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.selectByPrimaryKey">
+		</association>
+
+		<association property="createUser" column="sg_create_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
+		</association>
+		<association property="updateUser" column="sg_update_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
+		</association>
+	</resultMap>
+
+	<resultMap id="GoodsResultMap"
+		type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
+		<id column="sg_id" property="id" jdbcType="BIGINT" />
+		<result column="sg_class_id" property="systemCid" jdbcType="BIGINT" />
+		<result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER" />
+		<result column="sg_goods_source" property="goodsSource"
+			jdbcType="INTEGER" />
+		<result column="sg_source_calss" property="sourceCalss"
+			jdbcType="VARCHAR" />
+		<result column="sg_weight" property="weight" jdbcType="INTEGER" />
+		<result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP" />
+		<result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP" />
+
+		<association property="boutiqueAutoRule" column="sg_rule_id"
+			javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
+			<id column="sg_rule_id" property="id" jdbcType="BIGINT" />
+		</association>
+
+		<association property="taoBaoGoodsBrief" column="sg_goods_id"
+			resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap" />
+
+		<association property="createUser" column="sg_create_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
+		</association>
+		<association property="updateUser" column="sg_update_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
+		</association>
+	</resultMap>
+
+	<sql id="Base_Column_List">sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime
+	</sql>
+	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
+		parameterType="java.lang.Long">
+		select
+		<include refid="Base_Column_List" />
+		from yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
+	</select>
+	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
+		yeshi_ec_quality_factory where sg_id = #{id,jdbcType=BIGINT}
+	</delete>
+	<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
+		useGeneratedKeys="true" keyProperty="id">insert into
+		yeshi_ec_quality_factory
+		(sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime)
+		values
+		(#{id,jdbcType=BIGINT},#{systemCid,jdbcType=BIGINT},#{taoBaoGoodsBrief.id,jdbcType=BIGINT},#{entryMode,jdbcType=INTEGER},#{goodsSource,jdbcType=INTEGER},#{sourceCalss,jdbcType=VARCHAR},#{boutiqueAutoRule.id,jdbcType=BIGINT},#{weight,jdbcType=INTEGER},#{createUser.id,jdbcType=BIGINT},#{createtime,jdbcType=TIMESTAMP},#{updateUser.id,jdbcType=BIGINT},#{updatetime,jdbcType=TIMESTAMP})
+	</insert>
+	<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory"
+		useGeneratedKeys="true" keyProperty="id">
+		insert into yeshi_ec_quality_factory
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null">sg_id,</if>
+			<if test="systemCid != null">sg_class_id,</if>
+			<if test="taoBaoGoodsBrief != null">sg_goods_id,</if>
+			<if test="entryMode != null">sg_entry_mode,</if>
+			<if test="goodsSource != null">sg_goods_source,</if>
+			<if test="sourceCalss != null">sg_source_calss,</if>
+			<if test="boutiqueAutoRule != null">sg_rule_id,</if>
+			<if test="weight != null">sg_weight,</if>
+			<if test="createUser != null">sg_create_aid,</if>
+			<if test="createtime != null">sg_createtime,</if>
+			<if test="updateUser != null">sg_update_aid,</if>
+			<if test="updatetime != null">sg_updatetime,</if>
+		</trim>
+		values
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null">#{id,jdbcType=BIGINT},</if>
+			<if test="systemCid != null">#{systemCid,jdbcType=BIGINT},</if>
+			<if test="taoBaoGoodsBrief != null">#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
+			<if test="entryMode != null">#{entryMode,jdbcType=INTEGER},</if>
+			<if test="goodsSource != null">#{goodsSource,jdbcType=INTEGER},</if>
+			<if test="sourceCalss != null">#{sourceCalss,jdbcType=VARCHAR},</if>
+			<if test="boutiqueAutoRule != null">#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
+			<if test="weight != null">#{weight,jdbcType=INTEGER},</if>
+			<if test="createUser != null">#{createUser.id,jdbcType=BIGINT},</if>
+			<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
+			<if test="updateUser != null">#{updateUser.id,jdbcType=BIGINT},</if>
+			<if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if>
+		</trim>
+	</insert>
+	<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">update
+		yeshi_ec_quality_factory set sg_class_id =
+		#{systemCid,jdbcType=BIGINT},sg_goods_id =
+		#{taoBaoGoodsBrief.id,jdbcType=BIGINT},sg_entry_mode =
+		#{entryMode,jdbcType=INTEGER},sg_goods_source =
+		#{goodsSource,jdbcType=INTEGER},sg_source_calss =
+		#{sourceCalss,jdbcType=VARCHAR},sg_rule_id =
+		#{boutiqueAutoRule.id,jdbcType=BIGINT},sg_weight =
+		#{weight,jdbcType=INTEGER},sg_create_aid =
+		#{createUser.id,jdbcType=BIGINT},sg_createtime =
+		#{createtime,jdbcType=TIMESTAMP},sg_update_aid =
+		#{updateUser.id,jdbcType=BIGINT},sg_updatetime =
+		#{updatetime,jdbcType=TIMESTAMP} where sg_id = #{id,jdbcType=BIGINT}
+	</update>
+	<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.lable.QualityFactory">
+		update yeshi_ec_quality_factory
+		<set>
+			<if test="systemCid != null">sg_class_id=#{systemCid,jdbcType=BIGINT},</if>
+			<if test="taoBaoGoodsBrief != null">sg_goods_id=#{taoBaoGoodsBrief.id,jdbcType=BIGINT},</if>
+			<if test="entryMode != null">sg_entry_mode=#{entryMode,jdbcType=INTEGER},</if>
+			<if test="goodsSource != null">sg_goods_source=#{goodsSource,jdbcType=INTEGER},</if>
+			<if test="sourceCalss != null">sg_source_calss=#{sourceCalss,jdbcType=VARCHAR},</if>
+			<if test="boutiqueAutoRule != null">sg_rule_id=#{boutiqueAutoRule.id,jdbcType=BIGINT},</if>
+			<if test="weight != null">sg_weight=#{weight,jdbcType=INTEGER},</if>
+			<if test="createUser != null">sg_create_aid=#{createUser.id,jdbcType=BIGINT},</if>
+			<if test="createtime != null">sg_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
+			<if test="updateUser != null">sg_update_aid=#{updateUser.id,jdbcType=BIGINT},</if>
+			<if test="updatetime != null">sg_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
+		</set>
+		where sg_id = #{id,jdbcType=BIGINT}
+	</update>
+
+
+	<!-- 鏌ヨ瓒呰繃4涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
+	<update id="updateWeight">
+		UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
+		WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
+	</update>
+
+
+
+	<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
+		DELETE FROM yeshi_ec_quality_factory WHERE sg_id in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	</delete>
+
+	<delete id="deleteBatchByGoodsId" parameterType="java.util.List">
+		DELETE FROM yeshi_ec_quality_factory WHERE sg_goods_id in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	</delete>
+
+
+	<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"
+		parameterType="java.util.List">
+		INSERT IGNORE yeshi_ec_quality_factory
+		(
+		<include refid="Base_Column_List" />
+		)
+		values
+
+		<foreach collection="list" item="item" separator=",">
+			(
+			#{item.id,jdbcType=BIGINT},
+			#{item.systemCid,jdbcType=BIGINT},
+			#{item.taoBaoGoodsBrief.id,jdbcType=BIGINT},
+			#{item.entryMode,jdbcType=INTEGER},
+			#{item.goodsSource,jdbcType=INTEGER},
+			#{item.sourceCalss,jdbcType=VARCHAR},
+			#{item.boutiqueAutoRule.id,jdbcType=BIGINT},
+			#{item.weight,jdbcType=INTEGER},
+			#{item.createUser.id,jdbcType=BIGINT},
+			#{item.createtime,jdbcType=TIMESTAMP},
+			#{item.updateUser.id,jdbcType=BIGINT},
+			#{item.updatetime,jdbcType=TIMESTAMP}
+			)
+
+		</foreach>
+	</insert>
+
+	<update id="updateBatchSelective" parameterType="java.util.List">
+
+		update yeshi_ec_quality_factory
+		<trim prefix="set" suffixOverrides=",">
+			<trim prefix="sg_weight =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.weight !=null">
+						when sg_id=#{item.id} then #{item.weight}
+					</if>
+				</foreach>
+			</trim>
+
+			<trim prefix="sg_goods_source =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.goodsSource !=null">
+						when sg_id=#{item.id} then #{item.goodsSource}
+					</if>
+				</foreach>
+			</trim>
+			<trim prefix="sg_rule_id =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.boutiqueAutoRule !=null">
+						when sg_id=#{item.id} then #{item.boutiqueAutoRule.id}
+					</if>
+				</foreach>
+			</trim>
+
+			<trim prefix="sg_source_calss =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.sourceCalss !=null">
+						when sg_id=#{item.id} then #{item.sourceCalss}
+					</if>
+				</foreach>
+			</trim>
+			<trim prefix="sg_createtime =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.createtime !=null">
+						when sg_id=#{item.id} then #{item.createtime}
+					</if>
+				</foreach>
+			</trim>
+			<trim prefix="sg_updatetime =case" suffix="end,">
+				<foreach collection="list" item="item" index="index">
+					<if test="item.updatetime !=null">
+						when sg_id=#{item.id} then #{item.updatetime}
+					</if>
+				</foreach>
+			</trim>
+		</trim>
+		where sg_id in
+		<foreach collection="list" index="index" item="item"
+			separator="," open="(" close=")">
+			#{item.id,jdbcType=BIGINT}
+		</foreach>
+	</update>
+
+	<!-- 鏌ヨ鎵�鏈夊晢鍝佷俊鎭� 鏇存柊鏃堕棿杈冩棭鍦ㄥ墠 -->
+	<select id="queryAll" resultMap="BaseResultMap">
+		SELECT * FROM yeshi_ec_quality_factory
+		<if test="days != null">
+			WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
+			DATE(lab_updatetime);
+		</if>
+		order by sg_updatetime LIMIT ${start},${count}
+
+	</select>
+
+
+	<!-- 鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
+	<select id="query" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
+		resultMap="ResultMap">
+
+		SELECT ts.* FROM (
+		SELECT DISTINCT( tt.`sg_id`) AS id FROM
+		yeshi_ec_quality_factory tt
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		tt.`sg_goods_id`= tb.`id`
+		<if test='keyType == 3'>
+			LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
+			lg.`lg_goods_id`
+			LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
+			lab.`lab_id`
+		</if>
+		WHERE 1=1
+		<if test="goodsSource != null">
+			<!-- 鏉ユ簮 -->
+			AND tt.`sg_goods_source` = ${goodsSource}
+		</if>
+
+		<if test="days != null">
+			<!-- 鍏ュ簱鏃堕棿 -->
+			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startZkPrice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
+		</if>
+
+		<if test='endZkPrice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
+		</if>
+
+		<!-- 鏈堥攢閲� -->
+		<if test='startBiz30day != null'>
+			AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
+		</if>
+		<if test='endBiz30day != null'>
+			AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
+		</if>
+
+		<!-- 鏉冮噸鑼冨洿 -->
+		<if test='startWeight != null'>
+			AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
+		</if>
+		<if test='endWeight != null'>
+			AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
+		</if>
+
+		<!-- 浣i噾姣斾緥鑼冨洿 -->
+		<if test='startTkRate != null'>
+			AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
+		</if>
+		<if test='endTkRate != null'>
+			AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
+		</if>
+
+		<!-- 鍒搁潰棰濓細鍑忓灏� -->
+		<if test='startAmount != null'>
+			AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
+		</if>
+		<if test='endAmount != null'>
+			AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
+		</if>
+
+		<!-- 鍒告瘮渚� -->
+		<if test='startPropor != null'>
+			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
+		</if>
+		<!-- 鍒告瘮渚� -->
+		<if test='endPropor != null'>
+			AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
+		</if>
+
+		<!-- 鏈変紭鎯犲埜 -->
+		<if test='hasCoupon == 1'>
+			AND <![CDATA[  tb.`couponAmount` > 0 ]]>
+		</if>
+
+		<!-- 鍖呴偖 -->
+		<if test='freeShipment == 1'>
+			AND tb.`freeShipment` = 1
+		</if>
+
+		<!-- 娑堣垂鑰呬繚闅� -->
+		<if test='isPrepay == 1'>
+			AND tb.`isPrepay` = 1
+		</if>
+
+		<!-- 鎴愪氦杞寲 -->
+		<if test='payRate30 == 1'>
+			AND tb.`payRate30` = 1
+		</if>
+
+		<!-- 濂借瘎鐜� -->
+		<if test='goodRate == 1'>
+			AND tb.`goodRate` = 1
+		</if>
+
+		<!-- 閫�娆剧巼 -->
+		<if test='rfdRate == 1'>
+			AND tb.`rfdRate` = 1
+		</if>
+
+		<!-- 鍒嗙被id -->
+		<if test='gcid != null'>
+			AND tt.sg_class_id = #{gcid}
+		</if>
+		<!-- 鎼滅储鏉′欢: 鍟嗗搧鍚嶇О銆佸晢鍝乮d銆佹爣绛惧悕绉� -->
+		<if test='key != null and key != ""'>
+			<if test='keyType == 1'>
+				AND tb.`auctionId` = '${key}'
+			</if>
+			<if test='keyType == 2'>
+				AND tb.`title` LIKE '%${key}%'
+			</if>
+			<if test='keyType == 3'>
+				AND lab.`lab_title` = '${key}'
+			</if>
+			<if test='keyType == 4'>
+				AND tb.`shopTitle` = '${key}'
+			</if>
+		</if>
+
+		ORDER BY
+
+		<!-- 閿�閲� -->
+		<if test='totalSales == 1'>
+			tb.`biz30day`,
+		</if>
+		<if test='totalSales == 2'>
+			tb.`biz30day` desc,
+		</if>
+		<!-- 浠锋牸 -->
+		<if test='price == 1'>
+			tb.`zkPrice`,
+		</if>
+		<if test='price == 2'>
+			tb.`zkPrice` desc,
+		</if>
+		<!-- 浠锋牸 -->
+		<if test='tkRate == 1'>
+			tb.`tkRate`,
+		</if>
+		<if test='tkRate == 2'>
+			tb.`tkRate` desc,
+		</if>
+		<!-- 鍒告瘮渚� -->
+		<if test='propor == 1'>
+			ROUND(tb.couponAmount/tb.`zkPrice` *100,2),
+		</if>
+		<if test='propor == 2'>
+			ROUND(tb.couponAmount/tb.`zkPrice` *100,2) desc,
+		</if>
+		tt.`sg_updatetime` desc
+		LIMIT ${start},${count}
+		) a LEFT JOIN
+		yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
+
+
+	</select>
+
+	<select id="queryCount" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
+		resultType="java.lang.Long">
+		<!-- 鏍规嵁鏉′欢缁熻鎵�鏈夋爣绛炬暟閲� -->
+		SELECT count(ts.sg_id) FROM (
+		SELECT DISTINCT( tt.`sg_id`) AS id FROM
+		yeshi_ec_quality_factory tt
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		tt.`sg_goods_id`= tb.`id`
+		<if test='keyType == 3'>
+			LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` =
+			lg.`lg_goods_id`
+			LEFT JOIN yeshi_ec_label lab ON lg.`lg_label_id` =
+			lab.`lab_id`
+		</if>
+		WHERE 1=1
+		<if test="goodsSource != null">
+			<!-- 鏉ユ簮 -->
+			AND tt.`sg_goods_source` = ${goodsSource}
+		</if>
+
+		<if test="days != null">
+			<!-- 鍏ュ簱鏃堕棿 -->
+			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >= tt.`sg_createtime`]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startZkPrice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= ${startZkPrice} ]]>
+		</if>
+
+		<if test='endZkPrice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= ${endZkPrice} ]]>
+		</if>
+
+		<!-- 鏈堥攢閲� -->
+		<if test='startBiz30day != null'>
+			AND <![CDATA[  tb.`biz30day` >= ${startBiz30day} ]]>
+		</if>
+		<if test='endBiz30day != null'>
+			AND <![CDATA[  tb.`biz30day` <= ${endBiz30day} ]]>
+		</if>
+
+		<!-- 鏉冮噸鑼冨洿 -->
+		<if test='startWeight != null'>
+			AND <![CDATA[   tt.`sg_weight` >= ${startWeight} ]]>
+		</if>
+		<if test='endWeight != null'>
+			AND <![CDATA[   tt.`sg_weight` <= ${endWeight} ]]>
+		</if>
+
+		<!-- 浣i噾姣斾緥鑼冨洿 -->
+		<if test='startTkRate != null'>
+			AND <![CDATA[   tb.`tkRate` >= ${startTkRate} ]]>
+		</if>
+		<if test='endTkRate != null'>
+			AND <![CDATA[   tb.`tkRate` <= ${endTkRate} ]]>
+		</if>
+
+		<!-- 鍒搁潰棰濓細鍑忓灏� -->
+		<if test='startAmount != null'>
+			AND <![CDATA[   tb.`couponAmount` >= ${startAmount} ]]>
+		</if>
+		<if test='endAmount != null'>
+			AND <![CDATA[   tb.`couponAmount` <= ${endAmount} ]]>
+		</if>
+
+		<!-- 鍒告瘮渚� -->
+		<if test='startPropor != null'>
+			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= ${startPropor} ]]>
+		</if>
+		<!-- 鍒告瘮渚� -->
+		<if test='endPropor != null'>
+			AND <![CDATA[  ROUND(tb.couponAmount/tb.`zkPrice`*100,2) <= ${endPropor} ]]>
+		</if>
+
+		<!-- 鏈変紭鎯犲埜 -->
+		<if test='hasCoupon == 1'>
+			AND <![CDATA[  tb.`couponAmount` > 0 ]]>
+		</if>
+
+		<!-- 鍖呴偖 -->
+		<if test='freeShipment == 1'>
+			AND tb.`freeShipment` = 1
+		</if>
+
+		<!-- 娑堣垂鑰呬繚闅� -->
+		<if test='isPrepay == 1'>
+			AND tb.`isPrepay` = 1
+		</if>
+
+		<!-- 鎴愪氦杞寲 -->
+		<if test='payRate30 == 1'>
+			AND tb.`payRate30` = 1
+		</if>
+
+		<!-- 濂借瘎鐜� -->
+		<if test='goodRate == 1'>
+			AND tb.`goodRate` = 1
+		</if>
+
+		<!-- 閫�娆剧巼 -->
+		<if test='rfdRate == 1'>
+			AND tb.`rfdRate` = 1
+		</if>
+
+		<!-- 鍒嗙被id -->
+		<if test='gcid != null'>
+			AND tt.sg_class_id = #{gcid}
+		</if>
+		<!-- 鎼滅储鏉′欢: 鍟嗗搧鍚嶇О銆佸晢鍝乮d銆佹爣绛惧悕绉� -->
+		<if test='key != null and key != ""'>
+			<if test='keyType == 1'>
+				AND tb.`auctionId` = '${key}'
+			</if>
+			<if test='keyType == 2'>
+				AND tb.`title` LIKE '%${key}%'
+			</if>
+			<if test='keyType == 3'>
+				AND lab.`lab_title` = '${key}'
+			</if>
+			<if test='keyType == 4'>
+				AND tb.`shopTitle` = '${key}'
+			</if>
+		</if>
+
+		) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
+	</select>
+
+	<!--鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
+	<select id="queryByGoodsId" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_quality_factory WHERE sg_goods_id = ${goodsId}
+	</select>
+
+
+	<!--鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
+	<select id="getByAuctionId" resultMap="BaseResultMap">
+		SELECT * FROM
+		yeshi_ec_quality_factory
+		WHERE sg_goods_id = ${auctionId}
+		limit 1
+	</select>
+
+
+
+	<select id="queryCountByGoodsId" resultType="java.lang.Long">
+		SELECT COUNT(sg_id)
+		FROM yeshi_ec_quality_factory WHERE sg_goods_id =
+		${goodsId}
+	</select>
+
+	<select id="getCountAll" resultType="java.util.HashMap">
+		<!-- 缁熻浠婃棩鍚勭鏂瑰紡褰曞叆鏁伴噺 -->
+		SELECT COUNT(sg_id) AS total, IFNULL(SUM(CASE WHEN sg_entry_mode = 1
+		THEN 1 ELSE 0 END),0) AS totalMANUAL,
+		IFNULL(SUM(CASE WHEN
+		sg_entry_mode = 2 THEN 1 ELSE 0 END),0) AS totalSYSTEM,
+		IFNULL(SUM(CASE WHEN sg_entry_mode = 3 THEN 1 ELSE 0 END),0) AS
+		totalSEARCH,
+		IFNULL(SUM(CASE WHEN sg_goods_source = 1 THEN 1 ELSE 0
+		END),0) AS totalTB,
+		IFNULL(SUM(CASE WHEN sg_goods_source = 2 THEN 1
+		ELSE 0 END),0) AS
+		totalJD,
+		IFNULL(SUM(CASE WHEN sg_goods_source = 3 THEN
+		1 ELSE 0 END),0) AS totalPDD,
+		IFNULL(SUM(CASE WHEN sg_goods_source = 4
+		THEN 1 ELSE 0 END),0) AS
+		totalWPH
+		FROM yeshi_ec_quality_factory
+	</select>
+
+	<delete id="deleteByGoodsId" parameterType="java.lang.Long">
+		delete from
+		yeshi_ec_quality_factory where sg_goods_id =
+		#{goodsId,jdbcType=BIGINT}
+	</delete>
+
+	<select id="countTotalRows" resultType="java.lang.Long">
+		SELECT COUNT(sg_id) FROM yeshi_ec_quality_factory
+		<if test="days != null">
+			WHERE DATE_SUB(CURDATE(), INTERVAL ${days} DAY) >
+			DATE(lab_updatetime);
+		</if>
+	</select>
+
+	<select id="listQuery" resultMap="BaseResultMap">
+		<!-- 绉诲姩鏌ヨ -->
+		SELECT * FROM `yeshi_ec_quality_factory` h
+		<if test="labId != null">
+			LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
+			g.`lg_goods_id`
+		</if>
+		<!-- 鍟嗗搧鍏抽敭璇� -->
+		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>
+		<!-- 鍒嗙被id -->
+		<if test="systemCid != null">
+			AND h.`sg_class_id` = ${systemCid}
+		</if>
+		<!-- 鏍囩id -->
+		<if test="labId != null">
+			AND g.`lg_label_id`= ${labId}
+		</if>
+		<!-- 澶氫釜鍒嗙被id -->
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (${cids})
+		</if>
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <> '']]>
+		</if>
+
+		<!-- 鎺掑簭锛氭潈閲� 閿�閲� -->
+		ORDER BY h.sg_weight desc,tb.`biz30day`desc
+
+		LIMIT ${start},${count}
+
+	</select>
+
+	<select id="countQuery" resultType="java.lang.Long">
+		<!-- 绉诲姩缁熻 -->
+		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
+		<if test="labId != null">
+			LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
+			g.`lg_goods_id`
+		</if>
+		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>
+		<!-- 鍒嗙被id -->
+		<if test="systemCid != null">
+			AND h.`sg_class_id` = #{systemCid}
+		</if>
+		<!-- 鏍囩id -->
+		<if test="labId != null">
+			AND g.`lg_label_id`= #{labId}
+		</if>
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (#{cids})
+		</if>
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
+		</if>
+	</select>
+
+
+
+
+
+	<delete id="removeStorageGoods" parameterType="java.lang.Long">
+		DELETE FROM yeshi_ec_quality_factory h
+		WHERE h.`sg_class_id`= #{gcids}
+		AND <![CDATA[ h.`sg_createtime` < #{doTime} ]]>
+		AND h.`sg_goods_id` NOT extsts(SELECT DISTINCT lg.`lg_goods_id` FROM
+		yeshi_ec_label_goods lg)
+	</delete>
+
+	<select id="listQueryGoodsByGoodsId" resultMap="BaseResultMap">
+		<!-- 鏍规嵁auctionId 鏌ヨ鍟嗗搧淇℃伅 -->
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_quality_factory
+		WHERE sg_goods_id in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	</select>
+
+
+	<select id="listQueryByKey" 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 tb.`title` LIKE '%${key}%'
+
+		<if test="systemCid != null">
+			AND h.`sg_class_id` = #{systemCid}
+		</if>
+
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
+		</if>
+
+		<!-- 澶╃尗 -->
+		<if test="userType == 1 ">
+			AND tb.userType = #{userType}
+		</if>
+
+		<!-- 閿�閲忎互涓� -->
+		<if test="biz30day != null ">
+			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
+		</if>
+
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
+		</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>
+		h.`sg_weight` desc
+
+		LIMIT #{start},#{count}
+
+	</select>
+
+	<select id="countQueryByKey" resultType="java.lang.Long">
+		<!-- 绉诲姩缁熻 -->
+		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
+		tb.`title` LIKE '%${key}%'
+		<if test="systemCid != null">
+			AND h.`sg_class_id` = #{systemCid}
+		</if>
+
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
+		</if>
+
+		<!-- 澶╃尗 -->
+		<if test="userType == 1 ">
+			AND tb.userType = #{userType}
+		</if>
+
+		<!-- 閿�閲忎互涓� -->
+		<if test="biz30day != null ">
+			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
+		</if>
+
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
+		</if>
+	</select>
+
+	<select id="listQueryByAuctionId" 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
+		tb.auctionId in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	</select>
+
+
+	<select id="listQueryByCouponAmount" 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="startAmount != null">
+			AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
+		</if>
+		<if test="endAmount != null">
+			AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
+		</if>
+		<!-- 鍒告瘮渚� -->
+		<if test='startPropor != null'>
+			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
+		</if>
+		ORDER BY h.sg_weight desc,tb.`biz30day`desc
+
+		LIMIT #{start},#{count}
+
+	</select>
+
+	<select id="countQueryByCouponAmount" resultType="java.lang.Long">
+		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="startAmount != null">
+			AND <![CDATA[ tb.`couponAmount` >= #{startAmount}]]>
+		</if>
+		<if test="endAmount != null">
+			AND <![CDATA[ tb.`couponAmount` < #{endAmount}]]>
+		</if>
+		<!-- 鍒告瘮渚� -->
+		<if test='startPropor != null'>
+			AND <![CDATA[   ROUND(tb.couponAmount/tb.`zkPrice`*100,2) >= #{startPropor} ]]>
+		</if>
+	</select>
+
+	<select id="listQueryByFlashSale" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM yeshi_ec_quality_flash_sale s
+		LEFT JOIN yeshi_ec_quality_factory h ON h.`sg_goods_id` =
+		s.`fs_qfgoods_id`
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		h.`sg_goods_id`= tb.`id`
+
+		WHERE <![CDATA[ tb.`couponTotalCount` > 0 AND tb.couponLeftCount<tb.couponTotalCount ]]>
+
+		ORDER BY (tb.couponLeftCount/tb.couponTotalCount),s.fs_weight desc
+
+		LIMIT ${start},${count}
+	</select>
+
+	<select id="countQueryByFlashSale" resultType="java.lang.Long">
+		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM yeshi_ec_quality_factory h
+		RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` =
+		s.`fs_qfgoods_id`
+
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		h.`sg_goods_id`= tb.`id`
+
+		WHERE <![CDATA[ tb.`couponTotalCount` > 0  AND tb.couponLeftCount<tb.couponTotalCount]]>
+	</select>
+
+
+	<select id="listFlashSaleRandGoods" resultMap="GoodsResultMap">
+		SELECT h.*, tb.* FROM yeshi_ec_quality_factory h
+		RIGHT JOIN
+		yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` = s.`fs_qfgoods_id`
+		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+
+		WHERE s.`fs_id` IS NOT NULL AND tb.`biz30day` <![CDATA[>=]]>
+		10000
+		AND tb.`couponTotalCount` <![CDATA[>]]>10
+		AND tb.couponLeftCount <![CDATA[<]]>
+		tb.couponTotalCount
+		ORDER BY RAND()
+		LIMIT 3
+	</select>
+
+
+	<!-- 鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
+	<select id="listQueryByKeyAndlabIDs" resultMap="BaseResultMap">
+
+		SELECT ts.* FROM (
+		SELECT DISTINCT( tt.`sg_id`) AS id FROM
+		yeshi_ec_quality_factory tt
+
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		tt.`sg_goods_id`= tb.`id`
+
+		LEFT JOIN yeshi_ec_label_goods lg ON
+		tt.`sg_goods_id` = lg.`lg_goods_id`
+
+		WHERE (tb.`title` LIKE '%${key}%'
+		OR lg.`lg_label_id` IN
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+		)
+		<if test="systemCid != null">
+			AND tt.`sg_class_id` = #{systemCid}
+		</if>
+
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
+		</if>
+
+		<!-- 澶╃尗 -->
+		<if test="userType == 1 ">
+			AND tb.userType = #{userType}
+		</if>
+
+		<!-- 閿�閲忎互涓� -->
+		<if test="biz30day != null ">
+			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
+		</if>
+
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
+		</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.`tkRate` desc,
+		</if>
+		tt.`sg_weight` desc
+
+		LIMIT ${start},${count}
+
+		) a LEFT JOIN
+		yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
+
+	</select>
+
+	<select id="countQueryKeyAndlabIDs" resultType="java.lang.Long">
+		<!-- 鏍规嵁鏉′欢缁熻鎵�鏈夋爣绛炬暟閲� -->
+		SELECT count(ts.sg_id) FROM (
+		SELECT DISTINCT(tt.`sg_id`) AS id FROM
+		yeshi_ec_quality_factory tt
+
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		tt.`sg_goods_id`= tb.`id`
+
+		LEFT JOIN yeshi_ec_label_goods lg ON
+		tt.`sg_goods_id` = lg.`lg_goods_id`
+
+		WHERE (tb.`title` LIKE '%${key}%'
+		OR lg.`lg_label_id` IN
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+		)
+
+		<if test="systemCid != null">
+			AND tt.`sg_class_id` = #{systemCid}
+		</if>
+
+		<!-- 鏈夊埜 -->
+		<if test="hasQuan == 1 ">
+			AND <![CDATA[tb.couponInfo is not null AND tb.couponInfo <>'']]>
+		</if>
+
+		<!-- 澶╃尗 -->
+		<if test="userType == 1 ">
+			AND tb.userType = #{userType}
+		</if>
+
+		<!-- 閿�閲忎互涓� -->
+		<if test="biz30day != null ">
+			AND <![CDATA[tb.biz30day >= #{biz30day} ]]>
+		</if>
+
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice} ]]>
+		</if>
+
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice} ]]>
+		</if>
+
+		) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.id
+	</select>
+
+
+	<select id="listQueryByRebateAmount" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		(SELECT
+		tb.`id`,tb.biz30day,(CASE WHEN<![CDATA[ tb.`zkPrice` < tb.`couponStartFee`]]>
+		THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
+		ELSE
+		(tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
+		END)AS RateAmount FROM yeshi_ec_taobao_goods tb
+		where tb.tkRate >
+		#{tkRate})g
+
+		ON h.`sg_goods_id`= g.`id`
+		WHERE 1=1
+
+		<if test="startAmount != null">
+			AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
+		</if>
+		<if test="endAmount != null">
+			AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
+		</if>
+
+		ORDER BY g.biz30day desc
+
+		LIMIT #{start},#{count}
+
+	</select>
+
+	<select id="countQueryByRebateAmount" resultType="java.lang.Long">
+		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+
+		(SELECT tb.`id`,(CASE WHEN <![CDATA[tb.`zkPrice` < tb.`couponStartFee`]]>
+		THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
+		ELSE
+		(tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion}
+		END)AS RateAmount FROM yeshi_ec_taobao_goods tb
+		where tb.tkRate >
+		#{tkRate})g
+
+		ON h.`sg_goods_id`= g.`id`
+		WHERE 1=1
+
+		<if test="startAmount != null">
+			AND <![CDATA[ g.rateAmount >= #{startAmount} ]]>
+		</if>
+		<if test="endAmount != null">
+			AND <![CDATA[ g.rateAmount < #{endAmount} ]]>
+		</if>
+	</select>
+
+
+	<select id="getAuctionIdbyClassId" resultType="java.lang.Long">
+		SELECT h.`sg_goods_id` FROM `yeshi_ec_quality_factory` h
+		WHERE h.`sg_goods_source` = #{goodsSource}
+		AND h.`sg_updatetime` <![CDATA[<]]>
+		#{beforeTime}
+		<if test="systemCid != null">AND h.`sg_class_id` = #{systemCid}</if>
+	</select>
+
+
+	<select id="listRecommendToIndex" resultMap="BaseResultMap">
+		SELECT
+		<include refid="Base_Column_List" />
+		FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		(SELECT tb.`id`,tb.tkRate,
+				<![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*#{proportion}
+     			ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*#{proportion} END)AS rateAmount 
+     			FROM  yeshi_ec_taobao_goods tb
+     			WHERE tb.tkRate >=  #{tkRate} 
+     				AND tb.`couponAmount` >=  #{couponAmount}
+     				AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
+     			]]>
+		)g
+
+		ON h.`sg_goods_id`= g.`id`
+
+		WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
+
+		ORDER BY h.sg_weight DESC
+
+		LIMIT #{start},#{count}
+
+	</select>
+
+	<select id="countRecommendToIndex" resultType="java.lang.Long">
+		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		(SELECT tb.`id`,tb.tkRate,
+				 <![CDATA[(CASE WHEN  tb.`zkPrice` < tb.`couponStartFee`  THEN tb.`zkPrice` * tb.`tkRate`/10000*${proportion}
+     			ELSE (tb.`zkPrice`-tb.`couponAmount`) * tb.`tkRate`/10000*${proportion} END)AS RateAmount 
+     			FROM  yeshi_ec_taobao_goods tb
+     			WHERE tb.tkRate >=  #{tkRate} 
+     				  AND tb.`couponAmount` >=  #{couponAmount}
+     			      AND (tb.`couponAmount`/ tb.zkPrice)*100 > #{couponRatio}
+     			]]>
+		)g
+
+		ON h.`sg_goods_id`= g.`id`
+
+		WHERE  <![CDATA[ g.rateAmount >= #{commision} ]]>
+	</select>
+
+
+	<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>
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
+		</if>
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
+		</if>
+		<!-- 杩斿埄姣旇寖鍥� -->
+		<if test='startTkRate != null'>
+			AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
+		</if>
+		<if test='endTkRate != null'>
+			AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
+		</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>
+		<!-- 浣i噾姣斾緥 -->
+		<if test='sort == 5'>
+			tb.`tkRate` desc,
+		</if>
+		<!-- 浣i噾姣斾緥 -->
+		<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
+		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>
+		<!-- 鍦ㄥ敭浠疯寖鍥� -->
+		<if test='startprice != null'>
+			AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
+		</if>
+		<if test='endprice != null'>
+			AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
+		</if>
+		<!-- 杩斿埄姣旇寖鍥� -->
+		<if test='startTkRate != null'>
+			AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
+		</if>
+		<if test='endTkRate != null'>
+			AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
+		</if>
+		<!-- 鏈夊埜 -->
+		<if test='hasQuan != null'>
+			AND <![CDATA[  tb.`couponLeftCount` > 1]]>
+		</if>
+		<!-- 澶╃尗鍟嗗搧 -->
+		<if test='userType != null'>
+			AND <![CDATA[  tb.`userType` = 1]]>
+		</if>
+	</select>
+
+	<select id="listQueryBylabIDs" resultMap="GoodsResultMap">
+		SELECT * FROM (
+		SELECT DISTINCT( tt.`sg_id`) AS tbid FROM
+		yeshi_ec_quality_factory tt
+
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		tt.`sg_goods_id`= tb.`id`
+
+		LEFT JOIN yeshi_ec_label_goods lg ON
+		tt.`sg_goods_id` = lg.`lg_goods_id`
+
+		WHERE tb.`id` != #{gid}
+		<if test='systemCid != null'>
+			AND tt.`sg_class_id` = #{systemCid}
+		</if>
+		AND lg.`lg_label_id` IN
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+		LIMIT ${start},${count}
+		) a LEFT JOIN yeshi_ec_quality_factory ts ON
+		ts.`sg_id`=a.tbid
+		LEFT JOIN yeshi_ec_taobao_goods tbb ON
+		ts.`sg_goods_id`= tbb.`id`
+	</select>
+
+
+	<select id="listByMinSalesCountOrderByCreateTimeDesc" resultMap="BaseResultMap">
+		SELECT f.* FROM `yeshi_ec_quality_factory` f LEFT JOIN
+		yeshi_ec_taobao_goods t ON f.`sg_goods_id`=t.`id` WHERE
+		t.`biz30day`>=#{salesCount} ORDER BY f.`sg_createtime` DESC limit
+		#{start},#{count}
+	</select>
+
+
+	<select id="listByShopId" resultMap="GoodsResultMap">
+		SELECT * FROM
+		yeshi_ec_quality_factory q
+		LEFT JOIN `yeshi_ec_taobao_goods` t ON
+		q.`sg_goods_id` = t.`id`
+		WHERE t.`sellerId` = #{shopId}
+		ORDER BY
+		q.`sg_weight` DESC
+		LIMIT #{start},#{count}
+	</select>
+
+	<select id="countByShopId" resultType="java.lang.Long">
+		SELECT
+		ifnull(count(sg_id),0) FROM yeshi_ec_quality_factory q
+		LEFT JOIN
+		`yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
+		WHERE
+		t.`sellerId` = #{shopId}
+	</select>
+
+	<select id="get9k9ClassGoods" resultMap="GoodsResultMap">
+		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND tb.`biz30day` <![CDATA[>=]]>
+		#{biz30day}
+		<!-- 鍒稿悗浠疯寖鍥� -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		#{maxQuanPrice}
+		<!-- 澶氫釜鍒嗙被id -->
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (${cids})
+		</if>
+		ORDER BY h.sg_weight desc,tb.`biz30day`desc
+		LIMIT ${start},${count}
+	</select>
+
+	<select id="count9k9ClassGoods" resultType="java.lang.Long">
+		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
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND tb.`biz30day` <![CDATA[>=]]>
+		#{biz30day}
+		<!-- 鍒稿悗浠疯寖鍥� -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		#{maxQuanPrice}
+		<!-- 澶氫釜鍒嗙被id -->
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (${cids})
+		</if>
+	</select>
+
+
+	<!-- 姣忔棩蹇呮姠 -->
+	<select id="listQueryEverydayRob" resultMap="GoodsResultMap">
+		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE
+		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
+		1 AND tb.couponAmount <![CDATA[<=]]>
+		50
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
+		#{maxQuanPrice}
+		ORDER BY h.sg_createtime desc
+		LIMIT ${start},${count}
+	</select>
+
+	<select id="countQueryEverydayRob" resultType="java.lang.Long">
+		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
+		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
+		1 AND tb.couponAmount <![CDATA[<=]]>
+		50
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
+		#{maxQuanPrice}
+	</select>
+
+	<select id="listFreeGoods" resultMap="GoodsResultMap">
+ 		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0 
+			 AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+			 <!-- 鍦ㄥ敭浠�  209.9 -->
+			 AND tb.`zkPrice` <![CDATA[<=]]> 209.9
+			 <!--  鍒稿悗浠疯寖鍥�  0~9.9 -->
+			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> 0
+			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]> 9.9
+			 <!-- 姣斾緥  20 -->
+			 AND  tb.`tkRate` <![CDATA[>=]]> 20
+		ORDER BY h.sg_weight desc
+		LIMIT ${start},${count}
+	</select>
+
+
+
+
+	<select id="countFreeGoods" resultType="java.lang.Long">
+		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
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		<!-- 鍦ㄥ敭浠� 209.9 -->
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		209.9
+		<!-- 鍒稿悗浠疯寖鍥� 0~9.9 -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		0
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		9.9
+		<!-- 姣斾緥 20 -->
+		AND tb.`tkRate` <![CDATA[>=]]>
+		20
+	</select>
+
+
+</mapper>

--
Gitblit v1.8.0