<?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.RecordInvalidatedMapper">
    
    <resultMap type="RecordInvalidated" id="RecordInvalidatedResult">
        <result property="objid"    column="objid"    />
        <result property="epc"    column="epc"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectRecordInvalidatedVo">
        select objid, epc, create_by, create_time from record_invalidated
    </sql>

    <select id="selectRecordInvalidatedList" parameterType="RecordInvalidated" resultMap="RecordInvalidatedResult">
        <include refid="selectRecordInvalidatedVo"/>
        <where>  
            <if test="epc != null  and epc != ''"> and epc = #{epc}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
        </where>
    </select>
    
    <select id="selectRecordInvalidatedByObjid" parameterType="Long" resultMap="RecordInvalidatedResult">
        <include refid="selectRecordInvalidatedVo"/>
        where objid = #{objid}
    </select>
        
    <insert id="insertRecordInvalidated" parameterType="RecordInvalidated" useGeneratedKeys="true" keyProperty="objid">
        insert into record_invalidated
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="epc != null">epc,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="epc != null">#{epc},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="remark != null">#{remark },</if>
         </trim>
    </insert>

    <update id="updateRecordInvalidated" parameterType="RecordInvalidated">
        update record_invalidated
        <trim prefix="SET" suffixOverrides=",">
            <if test="epc != null">epc = #{epc},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteRecordInvalidatedByObjid" parameterType="Long">
        delete from record_invalidated where objid = #{objid}
    </delete>

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

</mapper>