<?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.zongzhi.mapper.TcDengbaoSystemMapper">
    
    <resultMap type="TcDengbaoSystem" id="TcDengbaoSystemResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="steamName"    column="steam_name"    />
        <result property="beianNum"    column="beian_num"    />
        <result property="safetyLevel"    column="safety_level"    />
        <result property="unitName"    column="unit_name"    />
        <result property="yewuType"    column="yewu_type"    />
        <result property="servicesArea"    column="services_area"    />
        <result property="servicesObj"    column="services_obj"    />
        <result property="coverageArea"    column="coverage_area"    />
        <result property="networkNature"    column="network_nature"    />
        <result property="systemSitutation"    column="system_situtation"    />
        <result property="useTime"    column="use_time"    />
        <result property="isRate"    column="is_rate"    />
        <result property="rankTime"    column="rank_time"    />
        <result property="reviewCase"    column="review_case"    />
        <result property="isParent"    column="is_parent"    />
        <result property="rankReport"    column="rank_report"    />
        <result property="systemState"    column="system_state"    />
        <result property="createId"    column="create_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateId"    column="update_id"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="isStatus"    column="is_status"    />
    </resultMap>

    <sql id="selectTcDengbaoSystemVo">
        select id, area_id, steam_name, beian_num, safety_level, unit_name, yewu_type, services_area, services_obj, coverage_area, network_nature, system_situtation, use_time, is_rate, rank_time, review_case, is_parent, rank_report, system_state, create_id, create_by, create_time, update_id, update_by, update_time, remark,is_status from tc_dengbao_system
    </sql>

    <select id="selectTcDengbaoSystemList" parameterType="TcDengbaoSystem" resultMap="TcDengbaoSystemResult">
        <include refid="selectTcDengbaoSystemVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="steamName != null  and steamName != ''"> and steam_name like concat('%', #{steamName}, '%')</if>
            <if test="beianNum != null  and beianNum != ''"> and beian_num = #{beianNum}</if>
            <if test="safetyLevel != null  and safetyLevel != ''"> and safety_level = #{safetyLevel}</if>
            <if test="unitName != null  and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
            <if test="yewuType != null  and yewuType != ''"> and yewu_type = #{yewuType}</if>
            <if test="servicesArea != null  and servicesArea != ''"> and services_area = #{servicesArea}</if>
            <if test="servicesObj != null  and servicesObj != ''"> and services_obj = #{servicesObj}</if>
            <if test="coverageArea != null  and coverageArea != ''"> and coverage_area = #{coverageArea}</if>
            <if test="networkNature != null  and networkNature != ''"> and network_nature = #{networkNature}</if>
            <if test="systemSitutation != null  and systemSitutation != ''"> and system_situtation = #{systemSitutation}</if>
            <if test="useTime != null "> and use_time = #{useTime}</if>
            <if test="isRate != null  and isRate != ''"> and is_rate = #{isRate}</if>
            <if test="rankTime != null "> and rank_time = #{rankTime}</if>
            <if test="reviewCase != null  and reviewCase != ''"> and review_case = #{reviewCase}</if>
            <if test="isParent != null  and isParent != ''"> and is_parent = #{isParent}</if>
            <if test="rankReport != null  and rankReport != ''"> and rank_report = #{rankReport}</if>
            <if test="systemState != null "> and system_state = #{systemState}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
        </where>
    </select>
    
    <select id="selectTcDengbaoSystemById" parameterType="Long" resultMap="TcDengbaoSystemResult">
        <include refid="selectTcDengbaoSystemVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcDengbaoSystem" parameterType="TcDengbaoSystem" useGeneratedKeys="true" keyProperty="id">
        insert into tc_dengbao_system
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="steamName != null">steam_name,</if>
            <if test="beianNum != null">beian_num,</if>
            <if test="safetyLevel != null">safety_level,</if>
            <if test="unitName != null">unit_name,</if>
            <if test="yewuType != null">yewu_type,</if>
            <if test="servicesArea != null">services_area,</if>
            <if test="servicesObj != null">services_obj,</if>
            <if test="coverageArea != null">coverage_area,</if>
            <if test="networkNature != null">network_nature,</if>
            <if test="systemSitutation != null">system_situtation,</if>
            <if test="useTime != null">use_time,</if>
            <if test="isRate != null">is_rate,</if>
            <if test="rankTime != null">rank_time,</if>
            <if test="reviewCase != null">review_case,</if>
            <if test="isParent != null">is_parent,</if>
            <if test="rankReport != null">rank_report,</if>
            <if test="systemState != null">system_state,</if>
            <if test="createId != null">create_id,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateId != null">update_id,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="isStatus != null">is_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="areaId != null">#{areaId},</if>
            <if test="steamName != null">#{steamName},</if>
            <if test="beianNum != null">#{beianNum},</if>
            <if test="safetyLevel != null">#{safetyLevel},</if>
            <if test="unitName != null">#{unitName},</if>
            <if test="yewuType != null">#{yewuType},</if>
            <if test="servicesArea != null">#{servicesArea},</if>
            <if test="servicesObj != null">#{servicesObj},</if>
            <if test="coverageArea != null">#{coverageArea},</if>
            <if test="networkNature != null">#{networkNature},</if>
            <if test="systemSitutation != null">#{systemSitutation},</if>
            <if test="useTime != null">#{useTime},</if>
            <if test="isRate != null">#{isRate},</if>
            <if test="rankTime != null">#{rankTime},</if>
            <if test="reviewCase != null">#{reviewCase},</if>
            <if test="isParent != null">#{isParent},</if>
            <if test="rankReport != null">#{rankReport},</if>
            <if test="systemState != null">#{systemState},</if>
            <if test="createId != null">#{createId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateId != null">#{updateId},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="isStatus != null">#{isStatus},</if>
         </trim>
    </insert>

    <update id="updateTcDengbaoSystem" parameterType="TcDengbaoSystem">
        update tc_dengbao_system
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="steamName != null">steam_name = #{steamName},</if>
            <if test="beianNum != null">beian_num = #{beianNum},</if>
            <if test="safetyLevel != null">safety_level = #{safetyLevel},</if>
            <if test="unitName != null">unit_name = #{unitName},</if>
            <if test="yewuType != null">yewu_type = #{yewuType},</if>
            <if test="servicesArea != null">services_area = #{servicesArea},</if>
            <if test="servicesObj != null">services_obj = #{servicesObj},</if>
            <if test="coverageArea != null">coverage_area = #{coverageArea},</if>
            <if test="networkNature != null">network_nature = #{networkNature},</if>
            <if test="systemSitutation != null">system_situtation = #{systemSitutation},</if>
            <if test="useTime != null">use_time = #{useTime},</if>
            <if test="isRate != null">is_rate = #{isRate},</if>
            <if test="rankTime != null">rank_time = #{rankTime},</if>
            <if test="reviewCase != null">review_case = #{reviewCase},</if>
            <if test="isParent != null">is_parent = #{isParent},</if>
            <if test="rankReport != null">rank_report = #{rankReport},</if>
            <if test="systemState != null">system_state = #{systemState},</if>
            <if test="createId != null">create_id = #{createId},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateId != null">update_id = #{updateId},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="isStatus != null">is_status=#{isStatus},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcDengbaoSystemById" parameterType="Long">
        delete from tc_dengbao_system where id = #{id}
    </delete>

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