<?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.ruoyi.model.mapper.AppletOrderItemDateLogMapper">

    <resultMap type="AppletOrderItemDateLog" id="AppletOrderItemDateLogResult">
        <result property="id" column="id"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="glovePhoto" column="glove_photo"/>
        <result property="shoeCoverPhoto" column="shoe_cover_photo"/>
        <result property="petPhoto" column="pet_photo"/>
        <result property="teacherPhoto" column="teacher_photo"/>
        <result property="grainBowlFront" column="grain_bowl_front"/>
        <result property="grainBowlAfter" column="grain_bowl_after"/>
        <result property="waterBowlFront" column="water_bowl_front"/>
        <result property="waterBowlAfter" column="water_bowl_after"/>
        <result property="basinFront" column="basin_front"/>
        <result property="basinAfter" column="basin_after"/>
        <result property="workDogImage" column="work_dog_image"/>
        <result property="workPalyImage" column="work_paly_image"/>
        <result property="notes" column="notes"/>
        <result property="itemDateId" column="item_date_id"/>
        <result property="itemOrderId" column="item_order_id"/>
        <result property="orderId" column="order_id"/>
    </resultMap>

    <sql id="selectAppletOrderItemDateLogVo">
        select id, create_time, create_by, update_time, update_by, glove_photo, shoe_cover_photo, pet_photo, teacher_photo, grain_bowl_front, grain_bowl_after, water_bowl_front, water_bowl_after, basin_front, basin_after, work_dog_image, work_paly_image, notes, item_date_id, item_order_id, order_id  from applet_order_item_date_log
    </sql>

    <select id="selectList" parameterType="AppletOrderItemDateLog" resultMap="AppletOrderItemDateLogResult">
        <include refid="selectAppletOrderItemDateLogVo"/>
        <where>
            <if test="glovePhoto != null  and glovePhoto != ''"> and glove_photo = #{glovePhoto}</if>
            <if test="shoeCoverPhoto != null  and shoeCoverPhoto != ''"> and shoe_cover_photo = #{shoeCoverPhoto}</if>
            <if test="petPhoto != null  and petPhoto != ''"> and pet_photo = #{petPhoto}</if>
            <if test="teacherPhoto != null  and teacherPhoto != ''"> and teacher_photo = #{teacherPhoto}</if>
            <if test="grainBowlFront != null  and grainBowlFront != ''"> and grain_bowl_front = #{grainBowlFront}</if>
            <if test="grainBowlAfter != null  and grainBowlAfter != ''"> and grain_bowl_after = #{grainBowlAfter}</if>
            <if test="waterBowlFront != null  and waterBowlFront != ''"> and water_bowl_front = #{waterBowlFront}</if>
            <if test="waterBowlAfter != null  and waterBowlAfter != ''"> and water_bowl_after = #{waterBowlAfter}</if>
            <if test="basinFront != null  and basinFront != ''"> and basin_front = #{basinFront}</if>
            <if test="basinAfter != null  and basinAfter != ''"> and basin_after = #{basinAfter}</if>
            <if test="workDogImage != null  and workDogImage != ''"> and work_dog_image = #{workDogImage}</if>
            <if test="workPalyImage != null  and workPalyImage != ''"> and work_paly_image = #{workPalyImage}</if>
            <if test="notes != null  and notes != ''"> and notes = #{notes}</if>
            <if test="itemDateId != null "> and item_date_id = #{itemDateId}</if>
            <if test="itemOrderId != null "> and item_order_id = #{itemOrderId}</if>
            <if test="orderId != null "> and order_id = #{orderId}</if>
        </where>
    </select>

    <select id="selectById" parameterType="Long" resultMap="AppletOrderItemDateLogResult">
        <include refid="selectAppletOrderItemDateLogVo"/>
        where id = #{id}
    </select>

    <select id="selectAppletOrderItemDateLogByItemDateId" parameterType="AppletOrderItemDateLog" resultMap="AppletOrderItemDateLogResult">
        <include refid="selectAppletOrderItemDateLogVo"/>
        where item_date_id = #{itemDateId}
    </select>

    <insert id="insert" parameterType="AppletOrderItemDateLog" useGeneratedKeys="true" keyProperty="id">
        insert into applet_order_item_date_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="glovePhoto != null">glove_photo,</if>
            <if test="shoeCoverPhoto != null">shoe_cover_photo,</if>
            <if test="petPhoto != null">pet_photo,</if>
            <if test="teacherPhoto != null">teacher_photo,</if>
            <if test="grainBowlFront != null">grain_bowl_front,</if>
            <if test="grainBowlAfter != null">grain_bowl_after,</if>
            <if test="waterBowlFront != null">water_bowl_front,</if>
            <if test="waterBowlAfter != null">water_bowl_after,</if>
            <if test="basinFront != null">basin_front,</if>
            <if test="basinAfter != null">basin_after,</if>
            <if test="workDogImage != null">work_dog_image,</if>
            <if test="workPalyImage != null">work_paly_image,</if>
            <if test="notes != null">notes,</if>
            <if test="itemDateId != null">item_date_id,</if>
            <if test="itemOrderId != null">item_order_id,</if>
            <if test="orderId != null">order_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="glovePhoto != null">#{glovePhoto},</if>
            <if test="shoeCoverPhoto != null">#{shoeCoverPhoto},</if>
            <if test="petPhoto != null">#{petPhoto},</if>
            <if test="teacherPhoto != null">#{teacherPhoto},</if>
            <if test="grainBowlFront != null">#{grainBowlFront},</if>
            <if test="grainBowlAfter != null">#{grainBowlAfter},</if>
            <if test="waterBowlFront != null">#{waterBowlFront},</if>
            <if test="waterBowlAfter != null">#{waterBowlAfter},</if>
            <if test="basinFront != null">#{basinFront},</if>
            <if test="basinAfter != null">#{basinAfter},</if>
            <if test="workDogImage != null">#{workDogImage},</if>
            <if test="workPalyImage != null">#{workPalyImage},</if>
            <if test="notes != null">#{notes},</if>
            <if test="itemDateId != null">#{itemDateId},</if>
            <if test="itemOrderId != null">#{itemOrderId},</if>
            <if test="orderId != null">#{orderId},</if>
        </trim>
    </insert>

    <update id="update" parameterType="AppletOrderItemDateLog">
        update applet_order_item_date_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="glovePhoto != null">glove_photo = #{glovePhoto},</if>
            <if test="shoeCoverPhoto != null">shoe_cover_photo = #{shoeCoverPhoto},</if>
            <if test="petPhoto != null">pet_photo = #{petPhoto},</if>
            <if test="teacherPhoto != null">teacher_photo = #{teacherPhoto},</if>
            <if test="grainBowlFront != null">grain_bowl_front = #{grainBowlFront},</if>
            <if test="grainBowlAfter != null">grain_bowl_after = #{grainBowlAfter},</if>
            <if test="waterBowlFront != null">water_bowl_front = #{waterBowlFront},</if>
            <if test="waterBowlAfter != null">water_bowl_after = #{waterBowlAfter},</if>
            <if test="basinFront != null">basin_front = #{basinFront},</if>
            <if test="basinAfter != null">basin_after = #{basinAfter},</if>
            <if test="workDogImage != null">work_dog_image = #{workDogImage},</if>
            <if test="workPalyImage != null">work_paly_image = #{workPalyImage},</if>
            <if test="notes != null">notes = #{notes},</if>
            <if test="itemDateId != null">item_date_id = #{itemDateId},</if>
            <if test="itemOrderId != null">item_order_id = #{itemOrderId},</if>
            <if test="orderId != null">order_id = #{orderId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteById" parameterType="Long">
        delete from applet_order_item_date_log where id = #{id}
    </delete>

    <delete id="deleteByIds" parameterType="String">
        delete from applet_order_item_date_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <insert id="insertOrUpdate" parameterType="AppletOrderItemDateLog" useGeneratedKeys="true" keyProperty="id">
        insert into applet_order_item_date_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            create_time, create_by, update_time, update_by, glove_photo, shoe_cover_photo, pet_photo, teacher_photo, grain_bowl_front, grain_bowl_after, water_bowl_front, water_bowl_after, basin_front, basin_after, work_dog_image, work_paly_image, notes, item_date_id, item_order_id, order_id,

        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id, jdbcType=BIGINT},
            </if>
            #{createTime, jdbcType=TIMESTAMP},#{createBy, jdbcType=INTEGER},#{updateTime, jdbcType=TIMESTAMP},#{updateBy, jdbcType=INTEGER},#{glovePhoto, jdbcType=VARCHAR},#{shoeCoverPhoto, jdbcType=VARCHAR},#{petPhoto, jdbcType=VARCHAR},#{teacherPhoto, jdbcType=VARCHAR},#{grainBowlFront, jdbcType=VARCHAR},#{grainBowlAfter, jdbcType=VARCHAR},#{waterBowlFront, jdbcType=VARCHAR},#{waterBowlAfter, jdbcType=VARCHAR},#{basinFront, jdbcType=VARCHAR},#{basinAfter, jdbcType=VARCHAR},#{workDogImage, jdbcType=VARCHAR},#{workPalyImage, jdbcType=VARCHAR},#{notes, jdbcType=VARCHAR},#{itemDateId, jdbcType=BIGINT},#{itemOrderId, jdbcType=BIGINT},#{orderId, jdbcType=BIGINT},

        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=BIGINT},
            </if>
            create_time = #{createTime, jdbcType=TIMESTAMP},
            create_by = #{createBy, jdbcType=INTEGER},
            update_time = #{updateTime, jdbcType=TIMESTAMP},
            update_by = #{updateBy, jdbcType=INTEGER},
            glove_photo = #{glovePhoto, jdbcType=VARCHAR},
            shoe_cover_photo = #{shoeCoverPhoto, jdbcType=VARCHAR},
            pet_photo = #{petPhoto, jdbcType=VARCHAR},
            teacher_photo = #{teacherPhoto, jdbcType=VARCHAR},
            grain_bowl_front = #{grainBowlFront, jdbcType=VARCHAR},
            grain_bowl_after = #{grainBowlAfter, jdbcType=VARCHAR},
            water_bowl_front = #{waterBowlFront, jdbcType=VARCHAR},
            water_bowl_after = #{waterBowlAfter, jdbcType=VARCHAR},
            basin_front = #{basinFront, jdbcType=VARCHAR},
            basin_after = #{basinAfter, jdbcType=VARCHAR},
            work_dog_image = #{workDogImage, jdbcType=VARCHAR},
            work_paly_image = #{workPalyImage, jdbcType=VARCHAR},
            notes = #{notes, jdbcType=VARCHAR},
            item_date_id = #{itemDateId, jdbcType=BIGINT},
            item_order_id = #{itemOrderId, jdbcType=BIGINT},
            order_id = #{orderId, jdbcType=BIGINT},
        </trim>
    </insert>
</mapper>

