<?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.brand.BrandClassShopMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandClassShop">
|
<id column="bcs_id" property="id" jdbcType="BIGINT"/>
|
<result column="bcs_top" property="top" jdbcType="INTEGER"/>
|
<result column="bcs_orderby" property="orderby" jdbcType="INTEGER"/>
|
<result column="bcs_browse_num" property="browseNum" jdbcType="BIGINT"/>
|
<result column="bcs_state" property="state" jdbcType="INTEGER"/>
|
<result column="bcs_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="bcs_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<association column="bcs_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
|
<id column="bcs_cid" property="id" jdbcType="BIGINT" />
|
</association>
|
<association column="bcs_shop_id" property="shop"
|
resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
|
</association>
|
</resultMap>
|
|
|
<resultMap id="BaseResultAllMap" type="com.yeshi.fanli.entity.brand.BrandClassShop">
|
<id column="bcs_id" property="id" jdbcType="BIGINT"/>
|
<result column="bcs_top" property="top" jdbcType="INTEGER"/>
|
<result column="bcs_orderby" property="orderby" jdbcType="INTEGER"/>
|
<result column="bcs_browse_num" property="browseNum" jdbcType="BIGINT"/>
|
<result column="bcs_state" property="state" jdbcType="INTEGER"/>
|
<result column="bcs_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="bcs_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<association column="bcs_cid" property="brandClass"
|
resultMap="com.yeshi.fanli.dao.mybatis.brand.BrandClassMapper.BaseResultMap">
|
</association>
|
<association column="bcs_shop_id" property="shop"
|
resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
|
</association>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">bcs_id,bcs_cid,bcs_shop_id,bcs_top,bcs_orderby,bcs_browse_num,bcs_state,bcs_create_time,bcs_update_time,bcs_shop_id AS tsi_id</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_brand_class_shop where bcs_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_class_shop where bcs_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class_shop (bcs_id,bcs_cid,bcs_shop_id,bcs_top,bcs_orderby,bcs_browse_num,bcs_state,bcs_create_time,bcs_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{shop.id,jdbcType=BIGINT},#{top,jdbcType=INTEGER},#{orderby,jdbcType=INTEGER},#{browseNum,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class_shop
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">bcs_id,</if>
|
<if test="brandClass != null">bcs_cid,</if>
|
<if test="shop != null">bcs_shop_id,</if>
|
<if test="top != null">bcs_top,</if>
|
<if test="orderby != null">bcs_orderby,</if>
|
<if test="browseNum != null">bcs_browse_num,</if>
|
<if test="state != null">bcs_state,</if>
|
<if test="createTime != null">bcs_create_time,</if>
|
<if test="updateTime != null">bcs_update_time,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="brandClass != null">#{brandClass.id,jdbcType=BIGINT},</if>
|
<if test="shop != null">#{shop.id,jdbcType=BIGINT},</if>
|
<if test="top != null">#{top,jdbcType=INTEGER},</if>
|
<if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
|
<if test="browseNum != null">#{browseNum,jdbcType=BIGINT},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop">update yeshi_ec_brand_class_shop set bcs_cid = #{brandClass.id,jdbcType=BIGINT},bcs_shop_id = #{shop.id,jdbcType=BIGINT},bcs_top = #{top,jdbcType=INTEGER},bcs_orderby = #{orderby,jdbcType=INTEGER},bcs_browse_num = #{browseNum,jdbcType=BIGINT},bcs_state = #{state,jdbcType=INTEGER},bcs_create_time = #{createTime,jdbcType=TIMESTAMP},bcs_update_time = #{updateTime,jdbcType=TIMESTAMP} where bcs_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop">update yeshi_ec_brand_class_shop
|
<set>
|
<if test="brandClass != null">bcs_cid=#{brandClass.id,jdbcType=BIGINT},</if>
|
<if test="shop != null">bcs_shop_id=#{shop.id,jdbcType=BIGINT},</if>
|
<if test="top != null">bcs_top=#{top,jdbcType=INTEGER},</if>
|
<if test="orderby != null">bcs_orderby=#{orderby,jdbcType=INTEGER},</if>
|
<if test="browseNum != null">bcs_browse_num=#{browseNum,jdbcType=BIGINT},</if>
|
<if test="state != null">bcs_state=#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">bcs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">bcs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where bcs_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
|
<delete id="deleteBatchByClassId" parameterType="java.util.List">
|
delete from yeshi_ec_brand_class_shop WHERE bcs_cid in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</delete>
|
|
<select id="listEffective" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_brand_class_shop b
|
LEFT JOIN `yeshi_ec_taobao_shop_info` p ON b.`bcs_shop_id` = p.`tsi_id`
|
WHERE b.bcs_state = 1
|
<if test="cid != null and cid !=0 ">
|
AND b.`bcs_cid` = #{cid}
|
</if>
|
ORDER BY b.`bcs_top`,bcs_orderby
|
</select>
|
|
<select id="countEffective" resultType="Long">
|
SELECT IFNULL(COUNT(b.`bcs_cid`),0) FROM yeshi_ec_brand_class_shop b
|
LEFT JOIN `yeshi_ec_taobao_shop_info` p ON b.`bcs_shop_id` = p.`tsi_id`
|
WHERE b.bcs_state = 1
|
<if test="cid != null and cid !=0 ">
|
AND b.`bcs_cid` = #{cid}
|
</if>
|
</select>
|
|
<select id="getExistByShopIds" parameterType="java.util.List" resultMap="BaseResultAllMap">
|
SELECT * FROM yeshi_ec_brand_class_shop cp
|
LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
|
LEFT JOIN `yeshi_ec_brand_class` c ON c.`bc_id` = cp.`bcs_cid`
|
WHERE cp.bcs_shop_id in
|
<foreach collection="list" item="item" open="(" close=")"
|
separator=",">#{item}</foreach>
|
</select>
|
|
<select id="getByShopIdAndCid" resultMap="BaseResultAllMap">
|
SELECT * FROM yeshi_ec_brand_class_shop
|
WHERE bcs_shop_id = #{shopId} AND bcs_cid = #{cid}
|
limit 1
|
</select>
|
|
<select id="getByShopId" resultMap="BaseResultAllMap">
|
SELECT * FROM yeshi_ec_brand_class_shop
|
WHERE bcs_shop_id = #{shopId}
|
limit 1
|
</select>
|
|
<select id="getMaxOrder" resultType="Integer">
|
SELECT IFNULL(COUNT(bcs_id),0) FROM yeshi_ec_brand_class_shop
|
WHERE bcs_cid = #{cid}
|
</select>
|
|
|
<select id="getByAdjoinOrder" resultMap="BaseResultMap">
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_brand_class_shop
|
WHERE bcs_cid = #{cid}
|
<if test="type == -1">
|
AND bcs_orderby <![CDATA[<]]> #{order}
|
ORDER BY bcs_orderby desc
|
</if>
|
|
<if test="type == 1">
|
AND bcs_orderby <![CDATA[>]]> #{order}
|
ORDER BY bcs_orderby
|
</if>
|
LIMIT 1
|
</select>
|
|
<select id="listQuery" resultMap="BaseResultAllMap">
|
SELECT * FROM `yeshi_ec_brand_class_shop` cp
|
LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
|
LEFT JOIN `yeshi_ec_brand_class` c ON c.`bc_id` = cp.`bcs_cid`
|
WHERE 1=1
|
<if test="key != null and key !='' ">
|
AND p.`tsi_shop_name` LIKE '%${key}%' or p.`tsi_seller_nick` LIKE '%${key}%'
|
</if>
|
|
<if test="cid != null">
|
AND cp.`bcs_cid` = #{cid}
|
</if>
|
|
<if test="state != null">
|
AND cp.`bcs_state` = #{state}
|
</if>
|
ORDER BY cp.`bcs_top` DESC,cp.`bcs_orderby`
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countQuery" resultType="java.lang.Long">
|
SELECT IFNULL(COUNT(cp.bcs_id),0) FROM `yeshi_ec_brand_class_shop` cp
|
LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
|
WHERE 1=1
|
<if test="key != null and key !='' ">
|
AND p.`tsi_shop_name` LIKE '%${key}%' or p.`tsi_seller_nick` LIKE '%${key}%'
|
</if>
|
|
<if test="cid != null">
|
AND cp.`bcs_cid` = #{cid}
|
</if>
|
|
<if test="state != null">
|
AND cp.`bcs_state` = #{state}
|
</if>
|
</select>
|
|
|
</mapper>
|