<?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.manage.mapper.RecordInvalidatedImgMapper">
    
    <resultMap type="RecordInvalidatedImg" id="RecordInvalidatedImgResult">
        <result property="objid"    column="objid"    />
        <result property="invalidatedId"    column="invalidated_id"    />
        <result property="epc"    column="epc"    />
        <result property="imgPath"    column="img_path"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectRecordInvalidatedImgVo">
        select objid, invalidated_id, epc, img_path, create_by, create_time from record_invalidated_img
    </sql>

    <select id="selectRecordInvalidatedImgList" parameterType="RecordInvalidatedImg" resultMap="RecordInvalidatedImgResult">
        <include refid="selectRecordInvalidatedImgVo"/>
        <where>  
            <if test="invalidatedId != null "> and invalidated_id = #{invalidatedId}</if>
            <if test="epc != null  and epc != ''"> and epc = #{epc}</if>
            <if test="imgPath != null  and imgPath != ''"> and img_path = #{imgPath}</if>
        </where>
    </select>
    
    <select id="selectRecordInvalidatedImgByObjid" parameterType="Long" resultMap="RecordInvalidatedImgResult">
        <include refid="selectRecordInvalidatedImgVo"/>
        where objid = #{objid}
    </select>
        
    <insert id="insertRecordInvalidatedImg" parameterType="RecordInvalidatedImg" useGeneratedKeys="true" keyProperty="objid">
        insert into record_invalidated_img
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="invalidatedId != null">invalidated_id,</if>
            <if test="epc != null and epc != ''">epc,</if>
            <if test="imgPath != null and imgPath != ''">img_path,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="invalidatedId != null">#{invalidatedId},</if>
            <if test="epc != null and epc != ''">#{epc},</if>
            <if test="imgPath != null and imgPath != ''">#{imgPath},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateRecordInvalidatedImg" parameterType="RecordInvalidatedImg">
        update record_invalidated_img
        <trim prefix="SET" suffixOverrides=",">
            <if test="invalidatedId != null">invalidated_id = #{invalidatedId},</if>
            <if test="epc != null and epc != ''">epc = #{epc},</if>
            <if test="imgPath != null and imgPath != ''">img_path = #{imgPath},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteRecordInvalidatedImgByObjid" parameterType="Long">
        delete from record_invalidated_img where objid = #{objid}
    </delete>

    <delete id="deleteRecordInvalidatedImgByObjids" parameterType="String">
        delete from record_invalidated_img where objid in 
        <foreach item="objid" collection="array" open="(" separator="," close=")">
            #{objid}
        </foreach>
    </delete>

</mapper>