<?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.nanjing.mapper.TBdLinetypeMapper">

    <resultMap type="TBdLinetype" id="TBdLinetypeResult">
        <result property="LineID"    column="LineID"    />
        <result property="LineTypeName"    column="LineTypeName"    />
        <result property="LineTypeFlag"    column="LineTypeFlag"    />
        <result property="BarcodeHead"    column="BarcodeHead"    />
    </resultMap>

    <sql id="selectTBdLinetypeVo">
        select LineID, LineTypeName, LineTypeFlag, BarcodeHead from T_BD_LineType
    </sql>

    <select id="selectTBdLinetypeList" parameterType="TBdLinetype" resultMap="TBdLinetypeResult">
        <include refid="selectTBdLinetypeVo"/>
        <where>
            <if test="LineTypeName != null  and LineTypeName != ''"> and LineTypeName like ('%' + #{LineTypeName} + '%')</if>
            <if test="LineTypeFlag != null  and LineTypeFlag != ''"> and LineTypeFlag = #{LineTypeFlag}</if>
        </where>
        order by LineID desc
    </select>

    <select id="selectTBdLinetypeById" parameterType="Long" resultMap="TBdLinetypeResult">
        <include refid="selectTBdLinetypeVo"/>
        where LineID = #{LineID}
    </select>

    <insert id="insertTBdLinetype" parameterType="TBdLinetype">
        insert into T_BD_LineType
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="LineID != null">LineID,</if>
            <if test="LineTypeName != null">LineTypeName,</if>
            <if test="LineTypeFlag != null">LineTypeFlag,</if>
            <if test="BarcodeHead != null">BarcodeHead,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="LineID != null">#{LineID},</if>
            <if test="LineTypeName != null">#{LineTypeName},</if>
            <if test="LineTypeFlag != null">#{LineTypeFlag},</if>
            <if test="BarcodeHead != null">#{BarcodeHead},</if>
         </trim>
    </insert>

    <update id="updateTBdLinetype" parameterType="TBdLinetype">
        update T_BD_LineType
        <trim prefix="SET" suffixOverrides=",">
            <if test="LineTypeName != null">LineTypeName = #{LineTypeName},</if>
            <if test="LineTypeFlag != null">LineTypeFlag = #{LineTypeFlag},</if>
            <if test="BarcodeHead != null">BarcodeHead = #{BarcodeHead},</if>
        </trim>
        where LineID = #{LineID}
    </update>

    <delete id="deleteTBdLinetypeById" parameterType="Long">
        delete from T_BD_LineType where LineID = #{LineID}
    </delete>

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

</mapper>
