<?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.taobao.TaoBaoShopMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.taobao.TaoBaoShop">
|
<id column="tsi_id" property="id" jdbcType="BIGINT" />
|
<result column="tsi_user_type" property="userType" jdbcType="INTEGER" />
|
<result column="tsi_shop_id" property="shopId" jdbcType="BIGINT" />
|
<result column="tsi_shop_name" property="shopName" jdbcType="VARCHAR" />
|
<result column="tsi_shop_name_custom" property="shopNameCustom" jdbcType="VARCHAR" />
|
<result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" />
|
<result column="tsi_shop_link" property="shopLink" jdbcType="VARCHAR" />
|
<result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" />
|
<result column="tsi_shop_icon_custom" property="shopIconCustom" jdbcType="VARCHAR" />
|
<result column="tsi_key" property="key" jdbcType="VARCHAR" />
|
<result column="tsi_score_goods" property="scoreGoods"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_seller" property="scoreSeller"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_logistics" property="scoreLogistics"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_goods_d" property="scoreGoodsD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_seller_d" property="scoreSellerD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_logistics_d" property="scoreLogisticsD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_update_time" property="updateTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tsi_good_rate_percentage" property="goodRatePercentage"
|
jdbcType="DECIMAL" />
|
</resultMap>
|
|
|
<resultMap id="BaseResultVOMap" type="com.yeshi.fanli.vo.brand.TaoBaoShopVO">
|
<id column="tsi_id" property="id" jdbcType="BIGINT" />
|
<result column="tsi_user_type" property="userType" jdbcType="INTEGER" />
|
<result column="tsi_shop_id" property="shopId" jdbcType="BIGINT" />
|
<result column="tsi_shop_name" property="shopName" jdbcType="VARCHAR" />
|
<result column="tsi_shop_name_custom" property="shopNameCustom" jdbcType="VARCHAR" />
|
<result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" />
|
<result column="tsi_shop_link" property="shopLink" jdbcType="VARCHAR" />
|
<result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" />
|
<result column="tsi_shop_icon_custom" property="shopIconCustom" jdbcType="VARCHAR" />
|
<result column="tsi_key" property="key" jdbcType="VARCHAR" />
|
<result column="tsi_score_goods" property="scoreGoods"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_seller" property="scoreSeller"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_logistics" property="scoreLogistics"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_goods_d" property="scoreGoodsD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_seller_d" property="scoreSellerD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_score_logistics_d" property="scoreLogisticsD"
|
jdbcType="DECIMAL" />
|
<result column="tsi_update_time" property="updateTime"
|
jdbcType="TIMESTAMP" />
|
<result column="tsi_good_rate_percentage" property="goodRatePercentage"
|
jdbcType="DECIMAL" />
|
|
<collection property="listGoodsBrief" column="id" resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap"/>
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_seller_nick,tsi_shop_link,tsi_shop_icon,tsi_shop_icon_custom,tsi_key,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_taobao_shop_info where tsi_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_taobao_shop_info where tsi_id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop"
|
useGeneratedKeys="true" keyProperty="id">insert into
|
yeshi_ec_taobao_shop_info
|
(tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_key,tsi_seller_nick,tsi_shop_link,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage)
|
values
|
(#{id,jdbcType=BIGINT},#{userType,jdbcType=INTEGER},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopNameCustom,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{sellerNick,jdbcType=VARCHAR},#{shopLink,jdbcType=VARCHAR},#{shopIcon,jdbcType=VARCHAR},#{shopIconCustom,jdbcType=VARCHAR},#{scoreGoods,jdbcType=DECIMAL},#{scoreSeller,jdbcType=DECIMAL},#{scoreLogistics,jdbcType=DECIMAL},#{scoreGoodsD,jdbcType=DECIMAL},#{scoreSellerD,jdbcType=DECIMAL},#{scoreLogisticsD,jdbcType=DECIMAL},#{updateTime,jdbcType=TIMESTAMP},#{goodRatePercentage,jdbcType=DECIMAL})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_taobao_shop_info
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">tsi_id,</if>
|
<if test="userType != null">tsi_user_type,</if>
|
<if test="shopId != null">tsi_shop_id,</if>
|
<if test="shopName != null">tsi_shop_name,</if>
|
<if test="shopNameCustom != null">tsi_shop_name_custom,</if>
|
<if test="sellerNick != null">tsi_seller_nick,</if>
|
<if test="shopLink != null">tsi_shop_link,</if>
|
<if test="shopIcon != null">tsi_shop_icon,</if>
|
<if test="shopIconCustom != null">tsi_shop_icon_custom,</if>
|
<if test="key != null">tsi_key,</if>
|
<if test="scoreGoods != null">tsi_score_goods,</if>
|
<if test="scoreSeller != null">tsi_score_seller,</if>
|
<if test="scoreLogistics != null">tsi_score_logistics,</if>
|
<if test="scoreGoodsD != null">tsi_score_goods_d,</if>
|
<if test="scoreSellerD != null">tsi_score_seller_d,</if>
|
<if test="scoreLogisticsD != null">tsi_score_logistics_d,</if>
|
<if test="updateTime != null">tsi_update_time,</if>
|
<if test="goodRatePercentage != null">tsi_good_rate_percentage,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="userType != null">#{userType,jdbcType=INTEGER},</if>
|
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
|
<if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if>
|
<if test="shopNameCustom != null">#{shopNameCustom,jdbcType=VARCHAR},</if>
|
<if test="sellerNick != null">#{sellerNick,jdbcType=VARCHAR},</if>
|
<if test="shopLink != null">#{shopLink,jdbcType=VARCHAR},</if>
|
<if test="shopIcon != null">#{shopIcon,jdbcType=VARCHAR},</if>
|
<if test="shopIconCustom != null">#{shopIconCustom,jdbcType=VARCHAR},</if>
|
<if test="key != null">#{key,jdbcType=VARCHAR},</if>
|
<if test="scoreGoods != null">#{scoreGoods,jdbcType=DECIMAL},</if>
|
<if test="scoreSeller != null">#{scoreSeller,jdbcType=DECIMAL},</if>
|
<if test="scoreLogistics != null">#{scoreLogistics,jdbcType=DECIMAL},</if>
|
<if test="scoreGoodsD != null">#{scoreGoodsD,jdbcType=DECIMAL},</if>
|
<if test="scoreSellerD != null">#{scoreSellerD,jdbcType=DECIMAL},</if>
|
<if test="scoreLogisticsD != null">#{scoreLogisticsD,jdbcType=DECIMAL},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="goodRatePercentage != null">#{goodRatePercentage,jdbcType=DECIMAL}</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop">update
|
yeshi_ec_taobao_shop_info set
|
tsi_user_type = #{userType,jdbcType=INTEGER},
|
tsi_shop_id = #{shopId,jdbcType=BIGINT},
|
tsi_shop_name = #{shopName,jdbcType=VARCHAR},
|
tsi_shop_name_custom = #{shopNameCustom,jdbcType=VARCHAR},
|
tsi_seller_nick = #{sellerNick,jdbcType=VARCHAR},
|
tsi_shop_link = #{shopLink,jdbcType=VARCHAR},
|
tsi_shop_icon = #{shopIcon,jdbcType=VARCHAR},
|
tsi_shop_icon_custom = #{shopIconCustom,jdbcType=VARCHAR},
|
tsi_key = #{key,jdbcType=VARCHAR},
|
tsi_score_goods = #{scoreGoods,jdbcType=DECIMAL},
|
tsi_score_seller = #{scoreSeller,jdbcType=DECIMAL},
|
tsi_score_logistics = #{scoreLogistics,jdbcType=DECIMAL},
|
tsi_score_goods_d = #{scoreGoodsD,jdbcType=DECIMAL},
|
tsi_score_seller_d = #{scoreSellerD,jdbcType=DECIMAL},
|
tsi_score_logistics_d = #{scoreLogisticsD,jdbcType=DECIMAL},
|
tsi_update_time = #{updateTime,jdbcType=TIMESTAMP} ,
|
tsi_good_rate_percentage = #{goodRatePercentage,jdbcType=DECIMAL}
|
where tsi_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop">
|
update yeshi_ec_taobao_shop_info
|
<set>
|
<if test="userType != null">tsi_user_type=#{userType,jdbcType=INTEGER},</if>
|
<if test="shopId != null">tsi_shop_id=#{shopId,jdbcType=BIGINT},</if>
|
<if test="shopName != null">tsi_shop_name=#{shopName,jdbcType=VARCHAR},</if>
|
<if test="shopNameCustom != null">tsi_shop_name_custom=#{shopNameCustom,jdbcType=VARCHAR},</if>
|
<if test="sellerNick != null">tsi_seller_nick=#{sellerNick,jdbcType=VARCHAR},</if>
|
<if test="shopLink != null">tsi_shop_link=#{shopLink,jdbcType=VARCHAR},</if>
|
<if test="shopIcon != null">tsi_shop_icon=#{shopIcon,jdbcType=VARCHAR},</if>
|
<if test="shopIconCustom != null">tsi_shop_icon_custom=#{shopIconCustom,jdbcType=VARCHAR},</if>
|
<if test="key != null">tsi_key=#{key,jdbcType=VARCHAR},</if>
|
<if test="scoreGoods != null">tsi_score_goods=#{scoreGoods,jdbcType=DECIMAL},</if>
|
<if test="scoreSeller != null">tsi_score_seller=#{scoreSeller,jdbcType=DECIMAL},</if>
|
<if test="scoreLogistics != null">tsi_score_logistics=#{scoreLogistics,jdbcType=DECIMAL},</if>
|
<if test="scoreGoodsD != null">tsi_score_goods_d=#{scoreGoodsD,jdbcType=DECIMAL},</if>
|
<if test="scoreSellerD != null">tsi_score_seller_d=#{scoreSellerD,jdbcType=DECIMAL},</if>
|
<if test="scoreLogisticsD != null">tsi_score_logistics_d=#{scoreLogisticsD,jdbcType=DECIMAL},</if>
|
<if test="updateTime != null">tsi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="goodRatePercentage !=null">tsi_good_rate_percentage=#{goodRatePercentage,jdbcType=DECIMAL},</if>
|
</set>
|
where tsi_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="listBrandShopinfo" resultMap="BaseResultVOMap" >
|
SELECT tt.*,tg.* FROM
|
(SELECT COUNT(t.`id`) AS totalGoods,t.`sellerId` FROM `yeshi_ec_taobao_goods` t
|
LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
|
WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 AND t.`couponAmount` <![CDATA[>]]> 0
|
<if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
|
GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2
|
ORDER BY p.`bcs_top`,p.`bcs_create_time` DESC
|
LIMIT ${start},${count}
|
)a
|
LEFT JOIN `yeshi_ec_brand_class_shop` pp ON a.sellerId = pp.bcs_shop_id
|
LEFT JOIN `yeshi_ec_taobao_shop_info` tt ON tt.`tsi_id` = pp.bcs_shop_id
|
LEFT JOIN `yeshi_ec_taobao_goods` tg ON tg.`sellerId` = a.sellerId
|
WHERE (SELECT COUNT(DISTINCT(e1.id)) FROM yeshi_ec_taobao_goods AS e1
|
WHERE e1.couponAmount<![CDATA[>]]>0 AND e1.sellerId = tg.sellerId
|
AND e1.biz30day <![CDATA[ >]]> tg.biz30day)<![CDATA[<]]> 3
|
AND pp.`bcs_state` = 1 AND tg.`couponAmount` <![CDATA[>]]> 0
|
ORDER BY pp.`bcs_top`,pp.`bcs_orderby`
|
</select>
|
|
<select id="countBrandShopinfo" resultType="Long">
|
SELECT IFNULL(COUNT(*),0) FROM (SELECT COUNT(t.`id`) AS totalGoods FROM `yeshi_ec_taobao_goods` t
|
LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
|
WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 AND t.`couponAmount` <![CDATA[>]]>0
|
<if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
|
GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2)a
|
</select>
|
|
<select id="getShopByKey" resultMap="BaseResultVOMap" >
|
SELECT * FROM (SELECT COUNT(t.`id`) AS totalGoods,po.* FROM yeshi_ec_taobao_shop_info po
|
LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id`
|
WHERE <![CDATA[t.`couponAmount` > 0 AND FIND_IN_SET(#{key},po.`tsi_key`)
|
GROUP BY t.`sellerId` HAVING totalGoods> 2]]>)A
|
LEFT JOIN (SELECT t.*,po.`tsi_id` FROM yeshi_ec_taobao_shop_info po
|
LEFT JOIN `yeshi_ec_taobao_goods` t ON t.`sellerId` = po.`tsi_id`
|
WHERE<![CDATA[ t.`couponAmount` > 0 ]]>AND FIND_IN_SET(#{key},po.`tsi_key`)
|
ORDER BY t.`biz30day` DESC
|
LIMIT 3)B ON B.`tsi_id` = A.`tsi_id`
|
</select>
|
|
</mapper>
|