<?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.siwei.rsmonitoring.mapper.TDkYwypXlsxDetailsMapper">
    
    <resultMap type="TDkYwypXlsxDetails" id="TDkYwypXlsxDetailsResult">
        <result property="id"    column="id"    />
        <result property="uploadId"    column="upload_id"    />
        <result property="sheet"    column="sheet"    />
        <result property="swid"    column="swid"    />
        <result property="sheetJson"    column="sheet_json"    />
    </resultMap>

    <sql id="selectTDkYwypXlsxDetailsVo">
        select id, upload_id, sheet, swid, sheet_json from t_dk_ywyp_xlsx_details
    </sql>

    <select id="selectTDkYwypXlsxDetailsList" parameterType="TDkYwypXlsxDetails" resultMap="TDkYwypXlsxDetailsResult">
        <include refid="selectTDkYwypXlsxDetailsVo"/>
        <where>  
            <if test="uploadId != null  and uploadId != ''"> and upload_id = #{uploadId}</if>
            <if test="sheet != null  and sheet != ''"> and sheet = #{sheet}</if>
            <if test="swid != null  and swid != ''"> and swid = #{swid}</if>
            <if test="sheetJson != null  and sheetJson != ''"> and sheet_json = #{sheetJson}</if>
        </where>
    </select>
    
    <select id="selectTDkYwypXlsxDetailsById" parameterType="String" resultMap="TDkYwypXlsxDetailsResult">
        <include refid="selectTDkYwypXlsxDetailsVo"/>
        where id = #{id}
    </select>

    <select id="selectTDkYwypXlsxDetailsBySheet" parameterType="TDkYwypXlsxDetails" resultMap="TDkYwypXlsxDetailsResult">
        <include refid="selectTDkYwypXlsxDetailsVo"/>
        where upload_id = #{uploadId}  and sheet = #{sheet}  and swid = #{swid}
    </select>



    <insert id="insertTDkYwypXlsxDetails" parameterType="TDkYwypXlsxDetails">
        insert into t_dk_ywyp_xlsx_details
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="uploadId != null and uploadId != ''">upload_id,</if>
            <if test="sheet != null">sheet,</if>
            <if test="swid != null">swid,</if>
            <if test="sheetJson != null">sheet_json,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="uploadId != null and uploadId != ''">#{uploadId},</if>
            <if test="sheet != null">#{sheet},</if>
            <if test="swid != null">#{swid},</if>
            <if test="sheetJson != null">#{sheetJson},</if>
         </trim>
    </insert>

    <update id="updateTDkYwypXlsxDetails" parameterType="TDkYwypXlsxDetails">
        update t_dk_ywyp_xlsx_details
        <trim prefix="SET" suffixOverrides=",">
            <if test="uploadId != null and uploadId != ''">upload_id = #{uploadId},</if>
            <if test="sheet != null">sheet = #{sheet},</if>
            <if test="swid != null">swid = #{swid},</if>
            <if test="sheetJson != null">sheet_json = #{sheetJson},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTDkYwypXlsxDetailsById" parameterType="String">
        delete from t_dk_ywyp_xlsx_details where id = #{id}
    </delete>

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

    <delete id="deleteTDkYwypXlsxDetailsByUploadId" parameterType="String">
        delete from t_dk_ywyp_xlsx_details where upload_id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>