ShopAdditionalImageMapper.xml 3.15 KB
<?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.yoho.search.dal.ShopAdditionalImageMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ShopAdditionalImage">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="shop_id" property="shopId" jdbcType="INTEGER"/>
        <result column="search_show_image" property="searchShowImage" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="INTEGER"/>
        <result column="shop_desc" property="shopDesc" jdbcType="VARCHAR"/>
        <result column="shop_back_img" property="shopBackImg" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, shop_id, search_show_image, create_time, update_time, shop_desc, shop_back_img
    </sql>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from shop_additional_image where id = #{id,jdbcType=INTEGER}
    </delete>

    <insert id="insert" parameterType="com.yoho.search.dal.model.ShopAdditionalImage">
        insert into shop_additional_image (id, shop_id, search_show_image, create_time, update_time, shop_desc, shop_back_img)
        values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{searchShowImage,jdbcType=VARCHAR},
         #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
         #{shopDesc,jdbcType=VARCHAR}, #{shopBackImg,jdbcType=VARCHAR})
    </insert>

    <select id="selectByShopIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from shop_additional_image where shop_id in
        <foreach item="item" index="index" collection="shopsIds"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>


    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from shop_additional_image
        where id = #{id,jdbcType=INTEGER}
        limit 1
    </select>


    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ShopAdditionalImage">
        update shop_additional_image
        <set>
            <if test="shopId != null">
                shop_id = #{shopId,jdbcType=INTEGER},
            </if>
            <if test="searchShowImage != null">
                search_show_image = #{searchShowImage,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=INTEGER},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=INTEGER},
            </if>
            <if test="shopDesc != null">
                shop_desc = #{shopDesc,jdbcType=VARCHAR},
            </if>
            <if test="shopBackImg != null">
                shop_back_img = #{shopBackImg,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id, jdbcType=INTEGER}
    </update>


</mapper>