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

    <resultMap type="TSyStationparameternotes" id="TSyStationparameternotesResult">
        <result property="id"    column="ID"    />
        <result property="tabelName"    column="TabelName"    />
        <result property="paraColumn"    column="ParaColumn"    />
        <result property="paraMeaning"    column="ParaMeaning"    />
        <result property="stationID"    column="StationID"    />
        <result property="stationCode"    column="StationCode"    />
        <result property="parentStationID"    column="ParentStationID"    />
        <result property="parentStationCode"    column="ParentStationCode"    />
        <result property="parentStationName"    column="ParentStationName"    />
        <result property="usedFlag"    column="UsedFlag"    />
    </resultMap>

    <sql id="selectTSyStationparameternotesVo">
        select ID, TabelName, ParaColumn, ParaMeaning, StationID, StationCode, ParentStationID, ParentStationCode, ParentStationName, UsedFlag from T_SY_StationParameterNotes
    </sql>

    <select id="selectTSyStationparameternotesList" parameterType="TSyStationparameternotes" resultMap="TSyStationparameternotesResult">
        <include refid="selectTSyStationparameternotesVo"/>
        <where>
            <if test="tabelName != null  and tabelName != ''"> and TabelName like ('%' + #{tabelName} + '%')</if>
            <if test="paraColumn != null  and paraColumn != ''"> and ParaColumn = #{paraColumn}</if>
            <if test="paraMeaning != null "> and ParaMeaning = #{paraMeaning}</if>
            <if test="stationID != null  and stationID != ''"> and StationID = #{stationID}</if>
            <if test="stationCode != null "> and StationCode = #{stationCode}</if>
            <if test="parentStationID != null  and parentStationID != ''"> and ParentStationID = #{parentStationID}</if>
            <if test="parentStationCode != null "> and ParentStationCode = #{parentStationCode}</if>
            <if test="parentStationName != null "> and ParentStationName like ('%' + #{parentStationName} + '%')</if>
            <if test="usedFlag != null  and usedFlag != ''"> and UsedFlag = #{usedFlag}</if>
        </where>
    </select>

    <select id="selectTSyStationparameternotesById" parameterType="Long" resultMap="TSyStationparameternotesResult">
        <include refid="selectTSyStationparameternotesVo"/>
        where ID = #{id}
    </select>
    <select id="getParaVal" resultMap="TSyStationparameternotesResult">
        select ID, TabelName, ParaColumn, ParaMeaning, StationID, StationCode, ParentStationID, ParentStationCode, ParentStationName, UsedFlag from T_SY_StationParameterNotes
        where StationID = #{param1} and ParaColumn = #{param2}
    </select>

    <select id="selectByStationID" parameterType="String" resultMap="TSyStationparameternotesResult">
        select ID, TabelName, ParaColumn, ParaMeaning, StationID, StationCode, ParentStationID, ParentStationCode, ParentStationName, UsedFlag from T_SY_StationParameterNotes
        where StationID = #{stationID}
    </select>


    <insert id="insertTSyStationparameternotes" parameterType="TSyStationparameternotes">
        insert into T_SY_StationParameterNotes
        <trim prefix="(" suffix=")" suffixOverrides=",">
<!--            <if test="id != null">ID,</if>-->
            <if test="tabelName != null">TabelName,</if>
            <if test="paraColumn != null">ParaColumn,</if>
            <if test="paraMeaning != null">ParaMeaning,</if>
            <if test="stationID != null">StationID,</if>
            <if test="stationCode != null">StationCode,</if>
            <if test="parentStationID != null">ParentStationID,</if>
            <if test="parentStationCode != null">ParentStationCode,</if>
            <if test="parentStationName != null">ParentStationName,</if>
            <if test="usedFlag != null">UsedFlag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
<!--            <if test="id != null">#{id},</if>-->
            <if test="tabelName != null">#{tabelName},</if>
            <if test="paraColumn != null">#{paraColumn},</if>
            <if test="paraMeaning != null">#{paraMeaning},</if>
            <if test="stationID != null">#{stationID},</if>
            <if test="stationCode != null">#{stationCode},</if>
            <if test="parentStationID != null">#{parentStationID},</if>
            <if test="parentStationCode != null">#{parentStationCode},</if>
            <if test="parentStationName != null">#{parentStationName},</if>
            <if test="usedFlag != null">#{usedFlag},</if>
         </trim>
    </insert>

    <update id="updateTSyStationparameternotes" parameterType="TSyStationparameternotes">
        update T_SY_StationParameterNotes
        <trim prefix="SET" suffixOverrides=",">
            <if test="tabelName != null">TabelName = #{tabelName},</if>
            <if test="paraColumn != null">ParaColumn = #{paraColumn},</if>
            <if test="paraMeaning != null">ParaMeaning = #{paraMeaning},</if>
            <if test="stationID != null">StationID = #{stationID},</if>
            <if test="stationCode != null">StationCode = #{stationCode},</if>
            <if test="parentStationID != null">ParentStationID = #{parentStationID},</if>
            <if test="parentStationCode != null">ParentStationCode = #{parentStationCode},</if>
            <if test="parentStationName != null">ParentStationName = #{parentStationName},</if>
            <if test="usedFlag != null">UsedFlag = #{usedFlag},</if>
        </trim>
        where ID = #{id}
    </update>

    <delete id="deleteTSyStationparameternotesById" parameterType="Long">
        delete from T_SY_StationParameterNotes where ID = #{id}
    </delete>

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

</mapper>
