<?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.shkj.wms.mapper.BusinPlcExceptionMapper">
    
    <resultMap type="BusinPlcException" id="BusinPlcExceptionResult">
        <result property="id"    column="id"    />
        <result property="plcPoint"    column="plc_point"    />
        <result property="execMsg"    column="exec_msg"    />
        <result property="execDate"    column="exec_date"    />
        <result property="execDev"    column="exec_dev"    />
    </resultMap>

    <sql id="selectBusinPlcExceptionVo">
        select id, plc_point, exec_msg, exec_date, exec_dev from busin_plc_exception
    </sql>

    <select id="selectBusinPlcExceptionList" parameterType="BusinPlcException" resultMap="BusinPlcExceptionResult">
        <include refid="selectBusinPlcExceptionVo"/>
        <where>  
            <if test="plcPoint != null  and plcPoint != ''"> and plc_point = #{plcPoint}</if>
            <if test="execMsg != null  and execMsg != ''"> and exec_msg = #{execMsg}</if>
            <if test="execDate != null "> and exec_date = #{execDate}</if>
            <if test="execDev != null  and execDev != ''"> and exec_dev = #{execDev}</if>
        </where>
    </select>
    
    <select id="selectBusinPlcExceptionById" parameterType="Long" resultMap="BusinPlcExceptionResult">
        <include refid="selectBusinPlcExceptionVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBusinPlcException" parameterType="BusinPlcException" useGeneratedKeys="true" keyProperty="id">
        insert into busin_plc_exception
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="plcPoint != null">plc_point,</if>
            <if test="execMsg != null">exec_msg,</if>
            <if test="execDate != null">exec_date,</if>
            <if test="execDev != null">exec_dev,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="plcPoint != null">#{plcPoint},</if>
            <if test="execMsg != null">#{execMsg},</if>
            <if test="execDate != null">#{execDate},</if>
            <if test="execDev != null">#{execDev},</if>
         </trim>
    </insert>

    <update id="updateBusinPlcException" parameterType="BusinPlcException">
        update busin_plc_exception
        <trim prefix="SET" suffixOverrides=",">
            <if test="plcPoint != null">plc_point = #{plcPoint},</if>
            <if test="execMsg != null">exec_msg = #{execMsg},</if>
            <if test="execDate != null">exec_date = #{execDate},</if>
            <if test="execDev != null">exec_dev = #{execDev},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBusinPlcExceptionById" parameterType="Long">
        delete from busin_plc_exception where id = #{id}
    </delete>

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