<?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.project.mapper.TrsErrorUrlMapper">
    
    <resultMap type="TrsErrorUrl" id="TrsErrorUrlResult">
        <result property="id"    column="id"    />
        <result property="errorurl"    column="errorurl"    />
        <result property="msg"    column="msg"    />
        <result property="status"    column="status"    />
        <result property="tenant"    column="tenant"    />
        <result property="time"    column="time"    />
    </resultMap>

    <sql id="selectTrsErrorUrlVo">
        select id, errorurl, msg, status, tenant,time from trs_error_url
    </sql>

    <select id="selectTrsWordsListByErrorWord" parameterType="String" resultMap="TrsErrorUrlResult">
        <include refid="selectTrsErrorUrlVo"/>
        where errorurl = #{errorurl}
    </select>

    <select id="selectTrsErrorUrlList" parameterType="TrsErrorUrl" resultMap="TrsErrorUrlResult">
        <include refid="selectTrsErrorUrlVo"/>
        <where>  
            <if test="errorurl != null  and errorurl != ''"> and errorurl = #{errorurl}</if>
            <if test="msg != null  and msg != ''"> and msg = #{msg}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and time between #{params.beginTime} and #{params.endTime}</if>
        </where>
        order by id desc
    </select>
    
    <select id="selectTrsErrorUrlById" parameterType="Long" resultMap="TrsErrorUrlResult">
        <include refid="selectTrsErrorUrlVo"/>
        where id = #{id}
    </select>

    <insert id="insertTrsErrorUrl" parameterType="TrsErrorUrl" useGeneratedKeys="true" keyProperty="id">
        insert into trs_error_url
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="errorurl != null">errorurl,</if>
            <if test="msg != null">msg,</if>
            <if test="status != null">status,</if>
            <if test="tenant != null">tenant,</if>
            <if test="time != null">time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="errorurl != null">#{errorurl},</if>
            <if test="msg != null">#{msg},</if>
            <if test="status != null">#{status},</if>
            <if test="tenant != null">#{tenant},</if>
            <if test="time != null">#{time},</if>
         </trim>
    </insert>

    <update id="updateTrsErrorUrl" parameterType="TrsErrorUrl">
        update trs_error_url
        <trim prefix="SET" suffixOverrides=",">
            <if test="errorurl != null">errorurl = #{errorurl},</if>
            <if test="msg != null">msg = #{msg},</if>
            <if test="status != null">status = #{status},</if>
            <if test="tenant != null">tenant = #{tenant},</if>
            <if test="time != null">time = #{time},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTrsErrorUrlById" parameterType="Long">
        delete from trs_error_url where id = #{id}
    </delete>

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

</mapper>