<?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.TcNetworkSentimentMapper">
    
    <resultMap type="TcNetworkSentiment" id="TcNetworkSentimentResult">
        <result property="id"    column="id"    />
        <result property="areaId"    column="area_id"    />
        <result property="sentimentName"    column="sentiment_name"    />
        <result property="sentimentContent"    column="sentiment_content"    />
        <result property="depName"    column="dep_name"    />
        <result property="publishTime"    column="publish_time"    />
        <result property="sentimentState"    column="sentiment_state"    />
        <result property="mediaType"    column="media_type"    />
        <result property="eventType"    column="event_type"    />
        <result property="sentimentType"    column="sentiment_type"    />
        <result property="yuciType"    column="yuci_type"    />
        <result property="source"    column="source"    />
        <result property="isturn"    column="isturn"    />
        <result property="fileName"    column="file_name"    />
        <result property="fileUrl"    column="file_url"    />
        <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="sentimentReportType"    column="sentiment_report_type"    />
        <result property="reminder" column="reminder"/>
        <result property="isStatus"    column="is_status"    />

    </resultMap>

    <sql id="selectTcNetworkSentimentVo">
        select id, area_id, sentiment_name,is_status, reminder,sentiment_report_type,sentiment_content, dep_name, publish_time, sentiment_state, media_type, event_type, sentiment_type, yuci_type, source, isturn, file_name, file_url, create_id, create_by, create_time, update_id, update_by, update_time, remark from tc_network_sentiment
    </sql>

    <select id="selectTcNetworkSentimentList" parameterType="TcNetworkSentiment" resultMap="TcNetworkSentimentResult">
        <include refid="selectTcNetworkSentimentVo"/>
        <where>  
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="reminder != null "> and reminder = #{reminder}</if>
            <if test="sentimentReportType != null "> and sentiment_report_type = #{sentimentReportType}</if>
            <if test="sentimentName != null  and sentimentName != ''"> and sentiment_name like concat('%', #{sentimentName}, '%')</if>
            <if test="sentimentContent != null  and sentimentContent != ''"> and sentiment_content = #{sentimentContent}</if>
            <if test="depName != null  and depName != ''"> and dep_name like concat('%', #{depName}, '%')</if>
            <if test="publishTime != null "> and publish_time = #{publishTime}</if>
            <if test="sentimentState != null "> and sentiment_state = #{sentimentState}</if>
            <if test="mediaType != null "> and media_type = #{mediaType}</if>
            <if test="eventType != null "> and event_type = #{eventType}</if>
            <if test="sentimentType != null "> and sentiment_type = #{sentimentType}</if>
            <if test="yuciType != null "> and yuci_type = #{yuciType}</if>
            <if test="source != null "> and source = #{source}</if>
            <if test="isturn != null "> and isturn = #{isturn}</if>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="fileUrl != null  and fileUrl != ''"> and file_url = #{fileUrl}</if>
            <if test="createId != null "> and create_id = #{createId}</if>
            <if test="updateId != null "> and update_id = #{updateId}</if>
            <if test="isStatus != null "> and is_status = #{isStatus}</if>
        </where>
    </select>
    
    <select id="selectTcNetworkSentimentById" parameterType="Long" resultMap="TcNetworkSentimentResult">
        <include refid="selectTcNetworkSentimentVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTcNetworkSentiment" parameterType="TcNetworkSentiment" useGeneratedKeys="true" keyProperty="id">
        insert into tc_network_sentiment
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="areaId != null">area_id,</if>
            <if test="sentimentName != null">sentiment_name,</if>
            <if test="reminder != null">reminder,</if>
            <if test="sentimentReportType != null">sentiment_report_type,</if>
            <if test="sentimentContent != null">sentiment_content,</if>
            <if test="depName != null">dep_name,</if>
            <if test="publishTime != null">publish_time,</if>
            <if test="sentimentState != null">sentiment_state,</if>
            <if test="mediaType != null">media_type,</if>
            <if test="eventType != null">event_type,</if>
            <if test="sentimentType != null">sentiment_type,</if>
            <if test="yuciType != null">yuci_type,</if>
            <if test="source != null">source,</if>
            <if test="isturn != null">isturn,</if>
            <if test="fileName != null">file_name,</if>
            <if test="fileUrl != null">file_url,</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="sentimentName != null">#{sentimentName},</if>
            <if test="reminder != null">#{reminder},</if>
            <if test="sentimentReportType != null">#{sentimentReportType},</if>
            <if test="sentimentContent != null">#{sentimentContent},</if>
            <if test="depName != null">#{depName},</if>
            <if test="publishTime != null">#{publishTime},</if>
            <if test="sentimentState != null">#{sentimentState},</if>
            <if test="mediaType != null">#{mediaType},</if>
            <if test="eventType != null">#{eventType},</if>
            <if test="sentimentType != null">#{sentimentType},</if>
            <if test="yuciType != null">#{yuciType},</if>
            <if test="source != null">#{source},</if>
            <if test="isturn != null">#{isturn},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="fileUrl != null">#{fileUrl},</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="updateTcNetworkSentiment" parameterType="TcNetworkSentiment">
        update tc_network_sentiment
        <trim prefix="SET" suffixOverrides=",">
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="sentimentName != null">sentiment_name = #{sentimentName},</if>
            <if test="reminder != null">reminder = #{reminder},</if>
            <if test="sentimentContent != null">sentiment_content = #{sentimentContent},</if>
            <if test="sentimentReportType != null">sentiment_report_type = #{sentimentReportType},</if>
            <if test="depName != null">dep_name = #{depName},</if>
            <if test="publishTime != null">publish_time = #{publishTime},</if>
            <if test="sentimentState != null">sentiment_state = #{sentimentState},</if>
            <if test="mediaType != null">media_type = #{mediaType},</if>
            <if test="eventType != null">event_type = #{eventType},</if>
            <if test="sentimentType != null">sentiment_type = #{sentimentType},</if>
            <if test="yuciType != null">yuci_type = #{yuciType},</if>
            <if test="source != null">source = #{source},</if>
            <if test="isturn != null">isturn = #{isturn},</if>
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</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="deleteTcNetworkSentimentById" parameterType="Long">
        delete from tc_network_sentiment where id = #{id}
    </delete>

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