<?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.system.mapper.TdCheckMapper">
    
    <resultMap type="TdCheck" id="TdCheckResult">
        <result property="checkId"    column="check_id"    />
        <result property="adduser"    column="adduser"    />
        <result property="depart"    column="depart"    />
        <result property="checkStartTime"    column="check_start_time"    />
        <result property="checkEndTime"    column="check_end_time"    />
        <result property="checkType"    column="check_type"    />
        <result property="checkContent"    column="check_content"    />
        <result property="checkResult"    column="check_result"    />
        <result property="address"    column="address"    />
        <result property="departreault"    column="departreault"    />
        <result property="area"    column="area"    />
        <result property="framework"    column="framework"    />
        <result property="checkState"    column="check_state"    />
        <result property="checkName"    column="check_name"    />
        <result property="checkAddress"    column="check_address"    />
        <result property="checkcontentry"    column="checkcontentry"    />
        <result property="checkcontentryjt"    column="checkcontentryjt"    />
        <result property="checkcontentrywj"    column="checkcontentrywj"    />
        <result property="checkcontentrywjjt"    column="checkcontentrywjjt"    />
        <result property="checkcontentrysb"    column="checkcontentrysb"    />
        <result property="checkcontentrysbjt"    column="checkcontentrysbjt"    />
        <result property="checkcontentryglzd"    column="checkcontentryglzd"    />
        <result property="checkcontentryglzdjt"    column="checkcontentryglzdjt"    />
        <result property="checkcontentryxmsj"    column="checkcontentryxmsj"    />
        <result property="checkcontentryxmsjjt"    column="checkcontentryxmsjjt"    />
        <result property="checkcontentryother"    column="checkcontentryother"    />
        <result property="checkcontentryxmsjotherjt"    column="checkcontentryxmsjotherjt"    />
        <result property="checkresult1"    column="checkresult1"    />
        <result property="checkresult2"    column="checkresult2"    />
        <result property="checkresult3"    column="checkresult3"    />
        <result property="checkresult4"    column="checkresult4"    />
        <result property="checkresult5"    column="checkresult5"    />
        <result property="checkresult6"    column="checkresult6"    />
        <result property="remark1"    column="remark1"    />
        <result property="remark2"    column="remark2"    />
        <result property="remark3"    column="remark3"    />
        <result property="remark4"    column="remark4"    />
        <result property="remark5"    column="remark5"    />
        <result property="remark6"    column="remark6"    />
        <result property="checkownresult1"    column="checkownresult1"    />
        <result property="checkownresult2"    column="checkownresult2"    />
        <result property="checkownresult3"    column="checkownresult3"    />
        <result property="checkownresult4"    column="checkownresult4"    />
        <result property="checkownresult5"    column="checkownresult5"    />
        <result property="checkownresult6"    column="checkownresult6"    />
        <result property="checkownresulttime"    column="checkownresulttime"    />
    </resultMap>

    <sql id="selectTdCheckVo">
        select check_id, adduser, depart, check_start_time, check_end_time, check_type, check_content, check_result, address, departreault, area, framework, check_state, check_name, check_address, checkcontentry, checkcontentryjt, checkcontentrywj, checkcontentrywjjt, checkcontentrysb, checkcontentrysbjt, checkcontentryglzd, checkcontentryglzdjt, checkcontentryxmsj, checkcontentryxmsjjt, checkcontentryother, checkcontentryxmsjotherjt, checkresult1, checkresult2, checkresult3, checkresult4, checkresult5, checkresult6, remark1, remark2, remark3, remark4, remark5, remark6, checkownresult1, checkownresult2, checkownresult3, checkownresult4, checkownresult5, checkownresult6, checkownresulttime from td_check
    </sql>

    <select id="selectTdCheckList" parameterType="TdCheck" resultMap="TdCheckResult">
        <include refid="selectTdCheckVo"/>
        <where>  
            <if test="adduser != null  and adduser != ''"> and adduser = #{adduser}</if>
            <if test="depart != null  and depart != ''"> and depart = #{depart}</if>
            <if test="checkStartTime != null "> and check_start_time = #{checkStartTime}</if>
            <if test="checkEndTime != null "> and check_end_time = #{checkEndTime}</if>
            <if test="checkType != null  and checkType != ''"> and check_type = #{checkType}</if>
            <if test="checkContent != null  and checkContent != ''"> and check_content = #{checkContent}</if>
            <if test="checkResult != null  and checkResult != ''"> and check_result = #{checkResult}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="departreault != null  and departreault != ''"> and departreault = #{departreault}</if>
            <if test="area != null  and area != ''"> and area = #{area}</if>
            <if test="framework != null  and framework != ''"> and framework = #{framework}</if>
            <if test="checkState != null  and checkState != ''"> and check_state = #{checkState}</if>
            <if test="checkName != null  and checkName != ''"> and check_name = #{checkName}</if>
            <if test="checkAddress != null  and checkAddress != ''"> and check_address = #{checkAddress}</if>
            <if test="checkcontentry != null  and checkcontentry != ''"> and checkcontentry = #{checkcontentry}</if>
            <if test="checkcontentryjt != null  and checkcontentryjt != ''"> and checkcontentryjt = #{checkcontentryjt}</if>
            <if test="checkcontentrywj != null  and checkcontentrywj != ''"> and checkcontentrywj = #{checkcontentrywj}</if>
            <if test="checkcontentrywjjt != null  and checkcontentrywjjt != ''"> and checkcontentrywjjt = #{checkcontentrywjjt}</if>
            <if test="checkcontentrysb != null  and checkcontentrysb != ''"> and checkcontentrysb = #{checkcontentrysb}</if>
            <if test="checkcontentrysbjt != null  and checkcontentrysbjt != ''"> and checkcontentrysbjt = #{checkcontentrysbjt}</if>
            <if test="checkcontentryglzd != null  and checkcontentryglzd != ''"> and checkcontentryglzd = #{checkcontentryglzd}</if>
            <if test="checkcontentryglzdjt != null  and checkcontentryglzdjt != ''"> and checkcontentryglzdjt = #{checkcontentryglzdjt}</if>
            <if test="checkcontentryxmsj != null  and checkcontentryxmsj != ''"> and checkcontentryxmsj = #{checkcontentryxmsj}</if>
            <if test="checkcontentryxmsjjt != null  and checkcontentryxmsjjt != ''"> and checkcontentryxmsjjt = #{checkcontentryxmsjjt}</if>
            <if test="checkcontentryother != null  and checkcontentryother != ''"> and checkcontentryother = #{checkcontentryother}</if>
            <if test="checkcontentryxmsjotherjt != null  and checkcontentryxmsjotherjt != ''"> and checkcontentryxmsjotherjt = #{checkcontentryxmsjotherjt}</if>
            <if test="checkresult1 != null  and checkresult1 != ''"> and checkresult1 = #{checkresult1}</if>
            <if test="checkresult2 != null  and checkresult2 != ''"> and checkresult2 = #{checkresult2}</if>
            <if test="checkresult3 != null  and checkresult3 != ''"> and checkresult3 = #{checkresult3}</if>
            <if test="checkresult4 != null  and checkresult4 != ''"> and checkresult4 = #{checkresult4}</if>
            <if test="checkresult5 != null  and checkresult5 != ''"> and checkresult5 = #{checkresult5}</if>
            <if test="checkresult6 != null  and checkresult6 != ''"> and checkresult6 = #{checkresult6}</if>
            <if test="remark1 != null  and remark1 != ''"> and remark1 = #{remark1}</if>
            <if test="remark2 != null  and remark2 != ''"> and remark2 = #{remark2}</if>
            <if test="remark3 != null  and remark3 != ''"> and remark3 = #{remark3}</if>
            <if test="remark4 != null  and remark4 != ''"> and remark4 = #{remark4}</if>
            <if test="remark5 != null  and remark5 != ''"> and remark5 = #{remark5}</if>
            <if test="remark6 != null  and remark6 != ''"> and remark6 = #{remark6}</if>
            <if test="checkownresult1 != null  and checkownresult1 != ''"> and checkownresult1 = #{checkownresult1}</if>
            <if test="checkownresult2 != null  and checkownresult2 != ''"> and checkownresult2 = #{checkownresult2}</if>
            <if test="checkownresult3 != null  and checkownresult3 != ''"> and checkownresult3 = #{checkownresult3}</if>
            <if test="checkownresult4 != null  and checkownresult4 != ''"> and checkownresult4 = #{checkownresult4}</if>
            <if test="checkownresult5 != null  and checkownresult5 != ''"> and checkownresult5 = #{checkownresult5}</if>
            <if test="checkownresult6 != null  and checkownresult6 != ''"> and checkownresult6 = #{checkownresult6}</if>
            <if test="checkownresulttime != null "> and checkownresulttime = #{checkownresulttime}</if>
        </where>
    </select>
    
    <select id="selectTdCheckByCheckId" parameterType="Long" resultMap="TdCheckResult">
        <include refid="selectTdCheckVo"/>
        where check_id = #{checkId}
    </select>
        
    <insert id="insertTdCheck" parameterType="TdCheck" useGeneratedKeys="true" keyProperty="checkId">
        insert into td_check
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="adduser != null">adduser,</if>
            <if test="depart != null">depart,</if>
            <if test="checkStartTime != null">check_start_time,</if>
            <if test="checkEndTime != null">check_end_time,</if>
            <if test="checkType != null">check_type,</if>
            <if test="checkContent != null">check_content,</if>
            <if test="checkResult != null">check_result,</if>
            <if test="address != null">address,</if>
            <if test="departreault != null">departreault,</if>
            <if test="area != null">area,</if>
            <if test="framework != null">framework,</if>
            <if test="checkState != null">check_state,</if>
            <if test="checkName != null">check_name,</if>
            <if test="checkAddress != null">check_address,</if>
            <if test="checkcontentry != null">checkcontentry,</if>
            <if test="checkcontentryjt != null">checkcontentryjt,</if>
            <if test="checkcontentrywj != null">checkcontentrywj,</if>
            <if test="checkcontentrywjjt != null">checkcontentrywjjt,</if>
            <if test="checkcontentrysb != null">checkcontentrysb,</if>
            <if test="checkcontentrysbjt != null">checkcontentrysbjt,</if>
            <if test="checkcontentryglzd != null">checkcontentryglzd,</if>
            <if test="checkcontentryglzdjt != null">checkcontentryglzdjt,</if>
            <if test="checkcontentryxmsj != null">checkcontentryxmsj,</if>
            <if test="checkcontentryxmsjjt != null">checkcontentryxmsjjt,</if>
            <if test="checkcontentryother != null">checkcontentryother,</if>
            <if test="checkcontentryxmsjotherjt != null">checkcontentryxmsjotherjt,</if>
            <if test="checkresult1 != null">checkresult1,</if>
            <if test="checkresult2 != null">checkresult2,</if>
            <if test="checkresult3 != null">checkresult3,</if>
            <if test="checkresult4 != null">checkresult4,</if>
            <if test="checkresult5 != null">checkresult5,</if>
            <if test="checkresult6 != null">checkresult6,</if>
            <if test="remark1 != null">remark1,</if>
            <if test="remark2 != null">remark2,</if>
            <if test="remark3 != null">remark3,</if>
            <if test="remark4 != null">remark4,</if>
            <if test="remark5 != null">remark5,</if>
            <if test="remark6 != null">remark6,</if>
            <if test="checkownresult1 != null">checkownresult1,</if>
            <if test="checkownresult2 != null">checkownresult2,</if>
            <if test="checkownresult3 != null">checkownresult3,</if>
            <if test="checkownresult4 != null">checkownresult4,</if>
            <if test="checkownresult5 != null">checkownresult5,</if>
            <if test="checkownresult6 != null">checkownresult6,</if>
            <if test="checkownresulttime != null">checkownresulttime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="adduser != null">#{adduser},</if>
            <if test="depart != null">#{depart},</if>
            <if test="checkStartTime != null">#{checkStartTime},</if>
            <if test="checkEndTime != null">#{checkEndTime},</if>
            <if test="checkType != null">#{checkType},</if>
            <if test="checkContent != null">#{checkContent},</if>
            <if test="checkResult != null">#{checkResult},</if>
            <if test="address != null">#{address},</if>
            <if test="departreault != null">#{departreault},</if>
            <if test="area != null">#{area},</if>
            <if test="framework != null">#{framework},</if>
            <if test="checkState != null">#{checkState},</if>
            <if test="checkName != null">#{checkName},</if>
            <if test="checkAddress != null">#{checkAddress},</if>
            <if test="checkcontentry != null">#{checkcontentry},</if>
            <if test="checkcontentryjt != null">#{checkcontentryjt},</if>
            <if test="checkcontentrywj != null">#{checkcontentrywj},</if>
            <if test="checkcontentrywjjt != null">#{checkcontentrywjjt},</if>
            <if test="checkcontentrysb != null">#{checkcontentrysb},</if>
            <if test="checkcontentrysbjt != null">#{checkcontentrysbjt},</if>
            <if test="checkcontentryglzd != null">#{checkcontentryglzd},</if>
            <if test="checkcontentryglzdjt != null">#{checkcontentryglzdjt},</if>
            <if test="checkcontentryxmsj != null">#{checkcontentryxmsj},</if>
            <if test="checkcontentryxmsjjt != null">#{checkcontentryxmsjjt},</if>
            <if test="checkcontentryother != null">#{checkcontentryother},</if>
            <if test="checkcontentryxmsjotherjt != null">#{checkcontentryxmsjotherjt},</if>
            <if test="checkresult1 != null">#{checkresult1},</if>
            <if test="checkresult2 != null">#{checkresult2},</if>
            <if test="checkresult3 != null">#{checkresult3},</if>
            <if test="checkresult4 != null">#{checkresult4},</if>
            <if test="checkresult5 != null">#{checkresult5},</if>
            <if test="checkresult6 != null">#{checkresult6},</if>
            <if test="remark1 != null">#{remark1},</if>
            <if test="remark2 != null">#{remark2},</if>
            <if test="remark3 != null">#{remark3},</if>
            <if test="remark4 != null">#{remark4},</if>
            <if test="remark5 != null">#{remark5},</if>
            <if test="remark6 != null">#{remark6},</if>
            <if test="checkownresult1 != null">#{checkownresult1},</if>
            <if test="checkownresult2 != null">#{checkownresult2},</if>
            <if test="checkownresult3 != null">#{checkownresult3},</if>
            <if test="checkownresult4 != null">#{checkownresult4},</if>
            <if test="checkownresult5 != null">#{checkownresult5},</if>
            <if test="checkownresult6 != null">#{checkownresult6},</if>
            <if test="checkownresulttime != null">#{checkownresulttime},</if>
         </trim>
    </insert>

    <update id="updateTdCheck" parameterType="TdCheck">
        update td_check
        <trim prefix="SET" suffixOverrides=",">
            <if test="adduser != null">adduser = #{adduser},</if>
            <if test="depart != null">depart = #{depart},</if>
            <if test="checkStartTime != null">check_start_time = #{checkStartTime},</if>
            <if test="checkEndTime != null">check_end_time = #{checkEndTime},</if>
            <if test="checkType != null">check_type = #{checkType},</if>
            <if test="checkContent != null">check_content = #{checkContent},</if>
            <if test="checkResult != null">check_result = #{checkResult},</if>
            <if test="address != null">address = #{address},</if>
            <if test="departreault != null">departreault = #{departreault},</if>
            <if test="area != null">area = #{area},</if>
            <if test="framework != null">framework = #{framework},</if>
            <if test="checkState != null">check_state = #{checkState},</if>
            <if test="checkName != null">check_name = #{checkName},</if>
            <if test="checkAddress != null">check_address = #{checkAddress},</if>
            <if test="checkcontentry != null">checkcontentry = #{checkcontentry},</if>
            <if test="checkcontentryjt != null">checkcontentryjt = #{checkcontentryjt},</if>
            <if test="checkcontentrywj != null">checkcontentrywj = #{checkcontentrywj},</if>
            <if test="checkcontentrywjjt != null">checkcontentrywjjt = #{checkcontentrywjjt},</if>
            <if test="checkcontentrysb != null">checkcontentrysb = #{checkcontentrysb},</if>
            <if test="checkcontentrysbjt != null">checkcontentrysbjt = #{checkcontentrysbjt},</if>
            <if test="checkcontentryglzd != null">checkcontentryglzd = #{checkcontentryglzd},</if>
            <if test="checkcontentryglzdjt != null">checkcontentryglzdjt = #{checkcontentryglzdjt},</if>
            <if test="checkcontentryxmsj != null">checkcontentryxmsj = #{checkcontentryxmsj},</if>
            <if test="checkcontentryxmsjjt != null">checkcontentryxmsjjt = #{checkcontentryxmsjjt},</if>
            <if test="checkcontentryother != null">checkcontentryother = #{checkcontentryother},</if>
            <if test="checkcontentryxmsjotherjt != null">checkcontentryxmsjotherjt = #{checkcontentryxmsjotherjt},</if>
            <if test="checkresult1 != null">checkresult1 = #{checkresult1},</if>
            <if test="checkresult2 != null">checkresult2 = #{checkresult2},</if>
            <if test="checkresult3 != null">checkresult3 = #{checkresult3},</if>
            <if test="checkresult4 != null">checkresult4 = #{checkresult4},</if>
            <if test="checkresult5 != null">checkresult5 = #{checkresult5},</if>
            <if test="checkresult6 != null">checkresult6 = #{checkresult6},</if>
            <if test="remark1 != null">remark1 = #{remark1},</if>
            <if test="remark2 != null">remark2 = #{remark2},</if>
            <if test="remark3 != null">remark3 = #{remark3},</if>
            <if test="remark4 != null">remark4 = #{remark4},</if>
            <if test="remark5 != null">remark5 = #{remark5},</if>
            <if test="remark6 != null">remark6 = #{remark6},</if>
            <if test="checkownresult1 != null">checkownresult1 = #{checkownresult1},</if>
            <if test="checkownresult2 != null">checkownresult2 = #{checkownresult2},</if>
            <if test="checkownresult3 != null">checkownresult3 = #{checkownresult3},</if>
            <if test="checkownresult4 != null">checkownresult4 = #{checkownresult4},</if>
            <if test="checkownresult5 != null">checkownresult5 = #{checkownresult5},</if>
            <if test="checkownresult6 != null">checkownresult6 = #{checkownresult6},</if>
            <if test="checkownresulttime != null">checkownresulttime = #{checkownresulttime},</if>
        </trim>
        where check_id = #{checkId}
    </update>

    <delete id="deleteTdCheckByCheckId" parameterType="Long">
        delete from td_check where check_id = #{checkId}
    </delete>

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

</mapper>