<?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.PtDataExpMapper">

    <resultMap id="PtDatExpMap" type="com.ruoyi.interfaces.domain.PtDataExp">
        <id column="ID" property="id"></id>
        <result column="NAME" property="name"/>
        <result column="CATE" property="cate"/>
        <result column="TYPE" property="type"/>
        <result column="SOURCE" property="source"/>
        <result column="NOTE" property="note"/>
    </resultMap>
    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtDataExp">
        insert into PT_DATA_EXP
            (ID, NAME, CATE, TYPE, SOURCE, NOTE)
        values (#{id}, #{name}, #{cate}, #{type}, #{source}, #{note})
    </insert>

    <update id="update" parameterType="com.ruoyi.interfaces.domain.PtDataExp">
        update PT_DATA_EXP
        set NAME   = #{name},
            CATE   = #{cate},
            TYPE   =#{type},
            SOURCE = #{source},
            NOTE   = #{note}
        where ID = #{id}
    </update>

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

    <select id="selectAll" parameterType="com.ruoyi.interfaces.domain.PtDataExp" resultMap="PtDatExpMap">
        select
        ID , NAME , CATE ,TYPE , SOURCE , NOTE
        from PT_DATA_EXP
        <if test="cate !=null and cate !=''">
            where CATE = #{cate}
        </if>
    </select>

    <select id="findByOne" parameterType="java.lang.String" resultMap="PtDatExpMap">
        select ID,
               NAME,
               CATE,
               TYPE,
               SOURCE,
               NOTE
        from PT_DATA_EXP
        where ID = #{id}
    </select>

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

    <update id="updatePtDataExpField" parameterType="com.ruoyi.interfaces.domain.PtDataExpField">
        update PT_DATA_EXP_FIELD
        set CODE  = #{code}
          , NAME  = #{name}
          , TYPE=#{type}
          , LENGTH=#{length}
          , FORMAT=#{format}
          , DICT=#{dict} SEQ = #{seq}
          , POS_X = #{posX}
          , POS_Y = #{posY}
          , WIDTH = #{width}
          , HEIGHT=#{height}
        where FID = #{fid}
    </update>

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

    <select id="selectAllPtDataExpField" parameterType="com.ruoyi.interfaces.domain.PtDataExpField"
            resultType="com.ruoyi.interfaces.domain.PtDataExpField">
        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,
               WIDTH  as width,
               HEIGHT as height
        from PT_DATA_EXP_FIELD
        where ID = #{id}
    </select>
</mapper>
