<?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.yunfeiyun.agmp.fms.mapper.TssSourceEnvironmentMapper">
    
    <resultMap id="TssSourceEnvironmentResult" type="com.yunfeiyun.agmp.fms.domain.TssSourceEnvironment" >
        <result property="sourceEnvironmentId"    column="sourceEnvironmentId"    />
        <result property="sourceinfoId"    column="sourceinfoId"    />
        <result property="sourceEnvironmentName"    column="sourceEnvironmentName"    />
        <result property="sourceEnvironmentVlaue"    column="sourceEnvironmentVlaue"    />
        <result property="sourceEnvironmentunits"    column="sourceEnvironmentunits"    />
    </resultMap>

    <sql id="selectTssSourceEnvironmentVo">
        select sourceEnvironmentId, sourceinfoId, sourceEnvironmentName, sourceEnvironmentVlaue, sourceEnvironmentunits from TssSourceEnvironment
    </sql>


    <insert id="insertTssSourceEnvironmentBatch">
        insert into TssSourceEnvironment
        <trim prefix="(" suffix=")" suffixOverrides=",">
            sourceEnvironmentId,
            sourceinfoId,
            sourceEnvironmentName,
            sourceEnvironmentVlaue,
            sourceEnvironmentunits,
        </trim>
        values
        <foreach item="data" collection="list" separator=",">
            (
            #{data.sourceEnvironmentId},
            #{data.sourceinfoId},
            #{data.sourceEnvironmentName},
            #{data.sourceEnvironmentVlaue},
            #{data.sourceEnvironmentunits}
            )
        </foreach>
    </insert>

    <delete id="deleteTssSourceEnvironmentBySourceinfoId" parameterType="String">
        delete from TssSourceEnvironment where sourceinfoId = #{sourceinfoId}
    </delete>

    <select id="selectTssSourceEnvironmentList" resultMap="TssSourceEnvironmentResult">
        <include refid="selectTssSourceEnvironmentVo"/>
        <where>
            <if test="sourceinfoId != null  and sourceinfoId != ''"> and sourceinfoId = #{sourceinfoId}</if>
        </where>
    </select>

</mapper>