<?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.xunmei.system.mapper.SysPhysicalDefenseConstructionMapper">

    <resultMap type="com.xunmei.system.domain.SysPhysicalDefenseConstruction" id="SysOrgPhysicalDefenseConstructionResult">
                <result property="id" column="id"/>
                <result property="standard" column="standard"/>
                <result property="dateOfCompliance" column="date_of_compliance"/>
                <result property="certificateEvidence" column="certificate_evidence"/>
                <result property="certificate" column="certificate"/>
                <result property="evidence" column="evidence"/>
                <result property="createTime" column="create_time"/>
                <result property="updateTime" column="update_time"/>
                <result property="createBy" column="create_by"/>
                <result property="updateBy" column="update_by"/>
                <result property="orgId" column="org_id"/>
    </resultMap>

    <sql id="selectSysOrgPhysicalDefenseConstructionVo">
        select id, standard, date_of_compliance, certificate_evidence, certificate, evidence, create_time, update_time, create_by, update_by, org_id
        from sys_org_physical_defense_construction
    </sql>

    <select id="selectSysOrgPhysicalDefenseConstructionList" parameterType="com.xunmei.system.domain.SysPhysicalDefenseConstruction"
            resultMap="SysOrgPhysicalDefenseConstructionResult">
        <include refid="selectSysOrgPhysicalDefenseConstructionVo"/>
        <where>
                        <if test="standard != null  and standard != ''">
                            and standard = #{standard}
                        </if>
                        <if test="dateOfCompliance != null ">
                            and date_of_compliance = #{dateOfCompliance}
                        </if>
                        <if test="certificateEvidence != null ">
                            and certificate_evidence = #{certificateEvidence}
                        </if>
                        <if test="certificate != null  and certificate != ''">
                            and certificate = #{certificate}
                        </if>
                        <if test="evidence != null  and evidence != ''">
                            and evidence = #{evidence}
                        </if>
                        <if test="orgId != null ">
                            and org_id = #{orgId}
                        </if>
        </where>
    </select>

    <select id="selectSysOrgPhysicalDefenseConstructionById" parameterType="Long"
            resultMap="SysOrgPhysicalDefenseConstructionResult">
            <include refid="selectSysOrgPhysicalDefenseConstructionVo"/>
            where id = #{id}
    </select>

    <insert id="insertSysOrgPhysicalDefenseConstruction" parameterType="com.xunmei.system.domain.SysPhysicalDefenseConstruction">
        insert into sys_org_physical_defense_construction
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="standard != null">standard,
                    </if>
                    <if test="dateOfCompliance != null">date_of_compliance,
                    </if>
                    <if test="certificateEvidence != null">certificate_evidence,
                    </if>
                    <if test="certificate != null">certificate,
                    </if>
                    <if test="evidence != null">evidence,
                    </if>
                    <if test="createTime != null">create_time,
                    </if>
                    <if test="updateTime != null">update_time,
                    </if>
                    <if test="createBy != null">create_by,
                    </if>
                    <if test="updateBy != null">update_by,
                    </if>
                    <if test="orgId != null">org_id,
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="standard != null">#{standard},
                    </if>
                    <if test="dateOfCompliance != null">#{dateOfCompliance},
                    </if>
                    <if test="certificateEvidence != null">#{certificateEvidence},
                    </if>
                    <if test="certificate != null">#{certificate},
                    </if>
                    <if test="evidence != null">#{evidence},
                    </if>
                    <if test="createTime != null">#{createTime},
                    </if>
                    <if test="updateTime != null">#{updateTime},
                    </if>
                    <if test="createBy != null">#{createBy},
                    </if>
                    <if test="updateBy != null">#{updateBy},
                    </if>
                    <if test="orgId != null">#{orgId},
                    </if>
        </trim>
    </insert>

    <update id="updateSysOrgPhysicalDefenseConstruction" parameterType="com.xunmei.system.domain.SysPhysicalDefenseConstruction">
        update sys_org_physical_defense_construction
        <trim prefix="SET" suffixOverrides=",">
                    <if test="standard != null">standard =
                        #{standard},
                    </if>
                    <if test="dateOfCompliance != null">date_of_compliance =
                        #{dateOfCompliance},
                    </if>
                    <if test="certificateEvidence != null">certificate_evidence =
                        #{certificateEvidence},
                    </if>
                    <if test="certificate != null">certificate =
                        #{certificate},
                    </if>
                    <if test="evidence != null">evidence =
                        #{evidence},
                    </if>
                    <if test="createTime != null">create_time =
                        #{createTime},
                    </if>
                    <if test="updateTime != null">update_time =
                        #{updateTime},
                    </if>
                    <if test="createBy != null">create_by =
                        #{createBy},
                    </if>
                    <if test="updateBy != null">update_by =
                        #{updateBy},
                    </if>
                    <if test="orgId != null">org_id =
                        #{orgId},
                    </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysOrgPhysicalDefenseConstructionById" parameterType="Long">
        delete
        from sys_org_physical_defense_construction where id = #{id}
    </delete>

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