<?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.TcNetworkReportMapper">
    
    <resultMap type="TcNetworkReport" id="TcNetworkReportResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="jbMan"    column="jb_man"    />
        <result property="jbdx"    column="jbdx"    />
        <result property="jbbh"    column="jbbh"    />
        <result property="jbTime"    column="jb_time"    />
        <result property="longitude"    column="longitude"    />
        <result property="latitude"    column="latitude"    />
        <result property="address"    column="address"    />
        <result property="content"    column="content"    />
        <result property="state"    column="state"    />
        <result property="source"    column="source"    />
        <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="selectTcNetworkReportVo">
        select id, area_id, jb_man, jbdx, is_status,jbbh, jb_time, longitude, latitude, address, content, state, source, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_network_report
    </sql>

    <select id="selectTcNetworkReportList" parameterType="TcNetworkReport" resultMap="TcNetworkReportResult">
        <include refid="selectTcNetworkReportVo"/>
        <where>  
            <if test="jbMan != null  and jbMan != ''"> and jb_man = #{jbMan}</if>
            <if test="jbTime != null "> and jb_time = #{jbTime}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="source != null "> and source = #{source}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
        </where>
    </select>
    
    <select id="selectTcNetworkReportById" parameterType="Long" resultMap="TcNetworkReportResult">
        <include refid="selectTcNetworkReportVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcNetworkReport" parameterType="TcNetworkReport" useGeneratedKeys="true" keyProperty="id">
        insert into tc_network_report
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="jbMan != null">jb_man,</if>
            <if test="jbdx != null">jbdx,</if>
            <if test="jbbh != null">jbbh,</if>
            <if test="jbTime != null">jb_time,</if>
            <if test="longitude != null">longitude,</if>
            <if test="latitude != null">latitude,</if>
            <if test="address != null">address,</if>
            <if test="content != null">content,</if>
            <if test="state != null">state,</if>
            <if test="source != null">source,</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="jbMan != null">#{jbMan},</if>
            <if test="jbdx != null">#{jbdx},</if>
            <if test="jbbh != null">#{jbbh},</if>
            <if test="jbTime != null">#{jbTime},</if>
            <if test="longitude != null">#{longitude},</if>
            <if test="latitude != null">#{latitude},</if>
            <if test="address != null">#{address},</if>
            <if test="content != null">#{content},</if>
            <if test="state != null">#{state},</if>
            <if test="source != null">#{source},</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="updateTcNetworkReport" parameterType="TcNetworkReport">
        update tc_network_report
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="jbMan != null">jb_man = #{jbMan},</if>
            <if test="jbdx != null">jbdx = #{jbdx},</if>
            <if test="jbbh != null">jbbh = #{jbbh},</if>
            <if test="jbTime != null">jb_time = #{jbTime},</if>
            <if test="longitude != null">longitude = #{longitude},</if>
            <if test="latitude != null">latitude = #{latitude},</if>
            <if test="address != null">address = #{address},</if>
            <if test="content != null">content = #{content},</if>
            <if test="state != null">state = #{state},</if>
            <if test="source != null">source = #{source},</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="deleteTcNetworkReportById" parameterType="Long">
        delete from tc_network_report where id = #{id}
    </delete>

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