<?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.interfaces.mapper.PtDataImpMapper">

    <resultMap id="PtDatImpMap" type="com.ruoyi.interfaces.domain.PtDataImp">
        <id column="ID" property="id"/>
        <result column="NAME" property="name"/>
        <result column="CATE" property="cate"/>
        <result column="TYPE" property="type"/>
        <result column="RULE" property="rule"/>
        <result column="SOURCE" property="source"/>
        <result column="WIMPL" property="wimpl"/>
        <result column="START_ROW" property="startRow"/>
        <result column="START_COL" property="startCol"/>
        <result column="END_ROW" property="endRow"/>
        <result column="END_COL" property="endCol"/>
        <result column="NOTE" property="note"/>
    </resultMap>
    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtDataImp">
        insert into PT_DATA_IMP
        (ID, NAME, CATE, TYPE, RULE, SOURCE, WIMPL, START_ROW, START_COL, END_ROW, END_COL, NOTE)
        values (#{id}, #{name}, #{cate}, #{type}, #{rule}, #{source}, #{wimpl}, #{startRow}, #{startCol}, #{endRow},
                #{endCol}, #{note})
    </insert>

    <update id="update" parameterType="com.ruoyi.interfaces.domain.PtDataImp">
        update PT_DATA_IMP
        set NAME      = #{name},
            CATE      = #{cate},
            TYPE      =#{type},
            RULE      = #{rule},
            SOURCE    = #{source},
            WIMPL     = #{wimpl}
                ,
            START_ROW =#{startRow},
            START_COL = #{startCol},
            END_ROW   = #{endRow},
            END_COL   = #{endCol},
            NOTE      = #{note}
        where ID = #{id}
    </update>

    <delete id="delete" parameterType="java.lang.String">
        delete
        from PT_DATA_IMP
        where ID = #{id}
    </delete>

    <select id="selectAll" parameterType="com.ruoyi.interfaces.domain.PtDataImp" resultMap="PtDatImpMap">
        select
        ID , NAME , CATE ,TYPE , RULE , SOURCE , WIMPL ,START_ROW , START_COL , END_ROW , END_COL , NOTE
        from PT_DATA_IMP
        <if test="cate !=null and cate !=''">
            where CATE = #{cate}
        </if>
    </select>

    <select id="findByOne" parameterType="java.lang.String" resultMap="PtDatImpMap">
        select ID,
               NAME,
               CATE,
               TYPE,
               RULE,
               SOURCE,
               WIMPL,
               START_ROW,
               START_COL,
               END_ROW,
               END_COL,
               NOTE
        from PT_DATA_IMP
        where ID = #{id}
    </select>

    <insert id="insertPtDatImpField" parameterType="com.ruoyi.interfaces.domain.PtDataImpField">
        insert into PT_DATA_IMP_FIELD(FID, ID, CODE, NAME, TYPE, LENGTH, FORMAT, DICT, SEQ, POS_X, POS_Y)
        values (#{fid}, #{id}, #{code}, #{name}, #{type}, #{length}, #{format}, #{dict}, #{seq}, #{posX}, #{posY})
    </insert>

    <update id="updatePtDatImpField" parameterType="com.ruoyi.interfaces.domain.PtDataImpField">
        update PT_DATA_IMP_FIELD
        set CODE  = #{code},
            NAME  = #{name},
            TYPE=#{type},
            LENGTH=#{length},
            FORMAT=#{format},
            DICT=#{dict},
            SEQ   = ${seq},
            POS_X=#{posX},
            POS_Y = #{posY}
        where FID = #{fid}
    </update>

    <delete id="deletePtDataImpField" parameterType="com.ruoyi.interfaces.domain.PtDataImpField">
        delete from PT_DATA_IMP_FIELD
        <where>
            <if test="fid != null and fid !=''">
                FID = #{fid}
            </if>
            <if test="id != null and id !=''">
                ID = #{id}
            </if>
        </where>
    </delete>

    <select id="selectAllPtDatImpField" parameterType="com.ruoyi.interfaces.domain.PtDataImpField"
            resultType="com.ruoyi.interfaces.domain.PtDataImpField">
        select FID    as fid
             , ID     as id
             , CODE   as code
             , NAME   as name
             , TYPE   as type
             , LENGTH as length
             , FORMAT as format
             , DICT   as dict
             , SEQ    as seq
             , POS_X  as posX
             , POS_Y  as posY
        from PT_DATA_IMP_FIELD
        where ID = #{id}
    </select>

    <!--    <insert id="insertTest" parameterType="com.ruoyi.interfaces.domain.Test">-->
    <!--        insert into test(id  , name) values (#{id} , #{name})-->
    <!--    </insert>-->
</mapper>
