<?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.cc.mapper.CcCustDialogAsrMapper">
    
    <resultMap type="CcCustDialogAsr" id="CcCustDialogAsrResult">
        <result property="id"    column="id"    />
        <result property="uuid"    column="uuid"    />
        <result property="extnum"    column="extnum"    />
        <result property="phoneNum"    column="phone_num"    />
        <result property="callType"    column="call_type"    />
        <result property="userId"    column="user_id"    />
        <result property="userLoginName"    column="user_login_name"    />
        <result property="userRealName"    column="user_real_name"    />
        <result property="createTime"    column="create_time"    />
        <result property="dialog"    column="dialog"    />
    </resultMap>

    <sql id="selectCcCustDialogAsrVo">
        select id, uuid, extnum, phone_num, call_type, user_id, user_login_name, user_real_name, create_time, dialog from cc_cust_dialog_asr
    </sql>

    <select id="selectCcCustDialogAsrList" parameterType="CcCustDialogAsr" resultMap="CcCustDialogAsrResult">
        <include refid="selectCcCustDialogAsrVo"/>
        <where>  
            <if test="uuid != null  and uuid != ''"> and uuid = #{uuid}</if>
            <if test="extnum != null  and extnum != ''"> and extnum = #{extnum}</if>
            <if test="phoneNum != null  and phoneNum != ''"> and phone_num = #{phoneNum}</if>
            <if test="callType != null "> and call_type = #{callType}</if>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="userLoginName != null  and userLoginName != ''"> and user_login_name like concat('%', #{userLoginName}, '%')</if>
            <if test="userRealName != null  and userRealName != ''"> and user_real_name like concat('%', #{userRealName}, '%')</if>
            <if test="dialog != null  and dialog != ''"> and dialog = #{dialog}</if>
        </where>
    </select>
    
    <select id="selectCcCustDialogAsrById" parameterType="Long" resultMap="CcCustDialogAsrResult">
        <include refid="selectCcCustDialogAsrVo"/>
        where id = #{id}
    </select>

    <insert id="insertCcCustDialogAsr" parameterType="CcCustDialogAsr">
        insert into cc_cust_dialog_asr
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="uuid != null and uuid != ''">uuid,</if>
            <if test="extnum != null and extnum != ''">extnum,</if>
            <if test="phoneNum != null and phoneNum != ''">phone_num,</if>
            <if test="callType != null">call_type,</if>
            <if test="userId != null">user_id,</if>
            <if test="userLoginName != null">user_login_name,</if>
            <if test="userRealName != null">user_real_name,</if>
            <if test="createTime != null">create_time,</if>
            <if test="dialog != null">dialog,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="uuid != null and uuid != ''">#{uuid},</if>
            <if test="extnum != null and extnum != ''">#{extnum},</if>
            <if test="phoneNum != null and phoneNum != ''">#{phoneNum},</if>
            <if test="callType != null">#{callType},</if>
            <if test="userId != null">#{userId},</if>
            <if test="userLoginName != null">#{userLoginName},</if>
            <if test="userRealName != null">#{userRealName},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="dialog != null">#{dialog},</if>
         </trim>
    </insert>

    <update id="updateCcCustDialogAsr" parameterType="CcCustDialogAsr">
        update cc_cust_dialog_asr
        <trim prefix="SET" suffixOverrides=",">
            <if test="uuid != null and uuid != ''">uuid = #{uuid},</if>
            <if test="extnum != null and extnum != ''">extnum = #{extnum},</if>
            <if test="phoneNum != null and phoneNum != ''">phone_num = #{phoneNum},</if>
            <if test="callType != null">call_type = #{callType},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="userLoginName != null">user_login_name = #{userLoginName},</if>
            <if test="userRealName != null">user_real_name = #{userRealName},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="dialog != null">dialog = #{dialog},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCcCustDialogAsrById" parameterType="Long">
        delete from cc_cust_dialog_asr where id = #{id}
    </delete>

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

</mapper>