<?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.TcNetworkEvaluateMapper">
    
    <resultMap type="TcNetworkEvaluate" id="TcNetworkEvaluateResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="articleId"    column="article_id"    />
        <result property="articleType"    column="article_type"    />
        <result property="appraiserId"    column="appraiser_id"    />
        <result property="appraiserName"    column="appraiser_name"    />
        <result property="articleTitle"    column="article_title"    />
        <result property="articleContent"    column="article_content"    />
        <result property="articleSource"    column="article_source"    />
        <result property="articleUrl"    column="article_url"    />
        <result property="pjContent"    column="pj_content"    />
        <result property="pjTime"    column="pj_time"    />
        <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="appraiserType"    column="appraiser_type"    />
    </resultMap>

    <sql id="selectTcNetworkEvaluateVo">
        select id, area_id, article_id, article_type, appraiser_type,appraiser_id, appraiser_name, article_title, article_content, article_source, article_url, pj_content, pj_time, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_network_evaluate
    </sql>

    <select id="selectTcNetworkEvaluateList" parameterType="TcNetworkEvaluate" resultMap="TcNetworkEvaluateResult">
        <include refid="selectTcNetworkEvaluateVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="articleId != null "> and article_id = #{articleId}</if>
            <if test="articleType != null "> and article_type = #{articleType}</if>
            <if test="appraiserId != null "> and appraiser_id = #{appraiserId}</if>
            <if test="appraiserName != null  and appraiserName != ''"> and appraiser_name like concat('%', #{appraiserName}, '%')</if>
            <if test="articleTitle != null  and articleTitle != ''"> and article_title = #{articleTitle}</if>
            <if test="articleContent != null  and articleContent != ''"> and article_content = #{articleContent}</if>
            <if test="articleSource != null  and articleSource != ''"> and article_source = #{articleSource}</if>
            <if test="articleUrl != null  and articleUrl != ''"> and article_url = #{articleUrl}</if>
            <if test="pjContent != null  and pjContent != ''"> and pj_content = #{pjContent}</if>
            <if test="pjTime != null "> and pj_time = #{pjTime}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
            <if test="appraiserType != null "> and appraiser_type = #{appraiserType}</if>
        </where>
    </select>
    
    <select id="selectTcNetworkEvaluateById" parameterType="Long" resultMap="TcNetworkEvaluateResult">
        <include refid="selectTcNetworkEvaluateVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcNetworkEvaluate" parameterType="TcNetworkEvaluate" useGeneratedKeys="true" keyProperty="id">
        insert into tc_network_evaluate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="articleId != null">article_id,</if>
            <if test="articleType != null">article_type,</if>
            <if test="appraiserId != null">appraiser_id,</if>
            <if test="appraiserName != null">appraiser_name,</if>
            <if test="articleTitle != null">article_title,</if>
            <if test="articleContent != null">article_content,</if>
            <if test="articleSource != null">article_source,</if>
            <if test="articleUrl != null">article_url,</if>
            <if test="pjContent != null">pj_content,</if>
            <if test="pjTime != null">pj_time,</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="appraiserType != null">appraiser_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="areaId != null">#{areaId},</if>
            <if test="articleId != null">#{articleId},</if>
            <if test="articleType != null">#{articleType},</if>
            <if test="appraiserId != null">#{appraiserId},</if>
            <if test="appraiserName != null">#{appraiserName},</if>
            <if test="articleTitle != null">#{articleTitle},</if>
            <if test="articleContent != null">#{articleContent},</if>
            <if test="articleSource != null">#{articleSource},</if>
            <if test="articleUrl != null">#{articleUrl},</if>
            <if test="pjContent != null">#{pjContent},</if>
            <if test="pjTime != null">#{pjTime},</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="appraiserType != null">#{appraiserType},</if>
         </trim>
    </insert>

    <update id="updateTcNetworkEvaluate" parameterType="TcNetworkEvaluate">
        update tc_network_evaluate
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="articleId != null">article_id = #{articleId},</if>
            <if test="articleType != null">article_type = #{articleType},</if>
            <if test="appraiserId != null">appraiser_id = #{appraiserId},</if>
            <if test="appraiserName != null">appraiser_name = #{appraiserName},</if>
            <if test="articleTitle != null">article_title = #{articleTitle},</if>
            <if test="articleContent != null">article_content = #{articleContent},</if>
            <if test="articleSource != null">article_source = #{articleSource},</if>
            <if test="articleUrl != null">article_url = #{articleUrl},</if>
            <if test="pjContent != null">pj_content = #{pjContent},</if>
            <if test="pjTime != null">pj_time = #{pjTime},</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="appraiserType != null">appraiser_type = #{appraiserType},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTcNetworkEvaluateById" parameterType="Long">
        delete from tc_network_evaluate where id = #{id}
    </delete>

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