<?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.iamberry.wechat.service.mapper.IntegralProductPictureMapper">
    <resultMap  id="BaseResultMap" type="IntegralProductPicture" >
        <result    column="picture_id"    property="pictureId" />
        <result    column="integral_product_id"    property="integralProductId" />
        <result    column="picture_url"    property="pictureUrl" />
        <result    column="picture_create_date"    property="pictureCreateDate" />
    </resultMap>
    <sql    id="Base_List" >
        t.picture_id,
        t.integral_product_id,
        t.picture_url,
        t.picture_create_date
    </sql>
    <select id="getIntegralProductPictureList" resultMap="BaseResultMap" parameterType="IntegralProductPicture" >
        select
        <include refid="Base_List" />
        from tb_iamberry_integral_product_picture t
        <where>
            <if test="pictureId != null ">
                AND t.picture_id = #{pictureId}
            </if >
            <if test="integralProductId != null ">
                AND t.integral_product_id = #{integralProductId}
            </if >
            <if test="pictureUrl != null and pictureUrl != ''">
                AND t.picture_url = #{pictureUrl}
            </if >
        </where>
    </select>
    <select id="getIntegralProductPictureById" resultMap="BaseResultMap" parameterType="Integer" >
        select
        <include refid="Base_List" />
        from tb_iamberry_integral_product_picture t
        where t.picture_id= #{pictureId}
    </select>
    <insert id="save" parameterType="IntegralProductPicture" >
        insert into
        tb_iamberry_integral_product_picture
        (
        picture_id,
        integral_product_id,
        picture_url
        )
        values
        (
        #{pictureId},
        #{integralProductId},
        #{pictureUrl}
        )
    </insert>
    <update id="update" parameterType="IntegralProductPicture" >
        update
        tb_iamberry_integral_product_picture
        <set >
            <if test="pictureId != null ">
                picture_id = #{pictureId},
            </if >
            <if test="integralProductId != null ">
                integral_product_id = #{integralProductId},
            </if >
            <if test="pictureUrl != null and pictureUrl != ''">
                picture_url = #{pictureUrl},
            </if >
        </set >
        where picture_id= #{pictureId}
    </update>
    <delete id="delete" parameterType="Integer" >
        delete
        tb_iamberry_integral_product_picture
        where picture_id=#{pictureId}
    </delete>
</mapper>