<?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.smartor.mapper.IvrTaskVisitResultMapper"> 
 | 
  
 | 
    <resultMap type="com.smartor.domain.IvrTaskVisitResult" id="IvrTaskVisitResultResult"> 
 | 
        <result property="id" column="id"/> 
 | 
        <result property="sendname" column="sendname"/> 
 | 
        <result property="phone" column="phone"/> 
 | 
        <result property="sex" column="sex"/> 
 | 
        <result property="age" column="age"/> 
 | 
        <result property="sfzh" column="sfzh"/> 
 | 
        <result property="type" column="type"/> 
 | 
        <result property="taskid" column="taskid"/> 
 | 
        <result property="templateid" column="templateid"/> 
 | 
        <result property="templatename" column="templatename"/> 
 | 
        <result property="senddate" column="senddate"/> 
 | 
        <result property="userid" column="userid"/> 
 | 
        <result property="username" column="username"/> 
 | 
        <result property="delFlag" column="del_flag"/> 
 | 
        <result property="updateBy" column="update_by"/> 
 | 
        <result property="updateTime" column="update_time"/> 
 | 
        <result property="createBy" column="create_by"/> 
 | 
        <result property="createTime" column="create_time"/> 
 | 
        <result property="question" column="question"/> 
 | 
        <result property="patientAnswer" column="patient_answer"/> 
 | 
        <result property="optionResult" column="option_result"/> 
 | 
        <result property="guid" column="guid"/> 
 | 
        <result property="orgid" column="orgid"/> 
 | 
    </resultMap> 
 | 
  
 | 
    <sql id="selectIvrTaskVisitResultVo"> 
 | 
        select id, 
 | 
               sendname, 
 | 
               phone, 
 | 
               sex, 
 | 
               age, 
 | 
               sfzh, 
 | 
               type, 
 | 
               guid, 
 | 
               taskid, 
 | 
               templateid, 
 | 
               templatename, 
 | 
               senddate, 
 | 
               userid, 
 | 
               username, 
 | 
               orgid, 
 | 
               del_flag, 
 | 
               update_by, 
 | 
               update_time, 
 | 
               create_by, 
 | 
               create_time, 
 | 
               question, 
 | 
               patient_answer, 
 | 
               option_result 
 | 
        from ivr_task_visit_result 
 | 
    </sql> 
 | 
  
 | 
    <select id="selectIvrTaskVisitResultList" parameterType="com.smartor.domain.IvrTaskVisitResult" 
 | 
            resultMap="IvrTaskVisitResultResult"> 
 | 
        <include refid="selectIvrTaskVisitResultVo"/> 
 | 
        <where> 
 | 
            <if test="sendname != null  and sendname != ''">and sendname like concat('%', #{sendname}, '%')</if> 
 | 
            <if test="phone != null  and phone != ''">and phone = #{phone}</if> 
 | 
            <if test="sex != null  and sex != ''">and sex = #{sex}</if> 
 | 
            <if test="age != null ">and age = #{age}</if> 
 | 
            <if test="sfzh != null  and sfzh != ''">and sfzh = #{sfzh}</if> 
 | 
            <if test="type != null  and type != ''">and type = #{type}</if> 
 | 
            <if test="taskid != null ">and taskid = #{taskid}</if> 
 | 
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if> 
 | 
            <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename}, 
 | 
                '%') 
 | 
            </if> 
 | 
            <if test="senddate != null ">and senddate = #{senddate}</if> 
 | 
            <if test="userid != null  and userid != ''">and userid = #{userid}</if> 
 | 
            <if test="username != null  and username != ''">and username like concat('%', #{username}, '%')</if> 
 | 
            <if test="question != null  and question != ''">and question = #{question}</if> 
 | 
            <if test="patientAnswer != null  and patientAnswer != ''">and patient_answer = #{patientAnswer}</if> 
 | 
            <if test="optionResult != null  and optionResult != ''">and option_result = #{optionResult}</if> 
 | 
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
    <select id="selectIvrTaskVisitResultById" parameterType="Long" resultMap="IvrTaskVisitResultResult"> 
 | 
        <include refid="selectIvrTaskVisitResultVo"/> 
 | 
        where id = #{id} 
 | 
    </select> 
 | 
  
 | 
    <insert id="insertIvrTaskVisitResult" parameterType="com.smartor.domain.IvrTaskVisitResult" useGeneratedKeys="true" 
 | 
            keyProperty="id"> 
 | 
        insert into ivr_task_visit_result 
 | 
        <trim prefix="(" suffix=")" suffixOverrides=","> 
 | 
            <if test="sendname != null">sendname,</if> 
 | 
            <if test="phone != null">phone,</if> 
 | 
            <if test="sex != null">sex,</if> 
 | 
            <if test="age != null">age,</if> 
 | 
            <if test="sfzh != null">sfzh,</if> 
 | 
            <if test="type != null">type,</if> 
 | 
            <if test="taskid != null">taskid,</if> 
 | 
            <if test="templateid != null">templateid,</if> 
 | 
            <if test="templatename != null">templatename,</if> 
 | 
            <if test="senddate != null">senddate,</if> 
 | 
            <if test="userid != null">userid,</if> 
 | 
            <if test="username != null">username,</if> 
 | 
            <if test="delFlag != null and delFlag != ''">del_flag,</if> 
 | 
            <if test="updateBy != null">update_by,</if> 
 | 
            <if test="updateTime != null">update_time,</if> 
 | 
            <if test="createBy != null">create_by,</if> 
 | 
            <if test="createTime != null">create_time,</if> 
 | 
            <if test="question != null">question,</if> 
 | 
            <if test="patientAnswer != null">patient_answer,</if> 
 | 
            <if test="optionResult != null">option_result,</if> 
 | 
            <if test="guid != null">guid,</if> 
 | 
            <if test="orgid != null">orgid,</if> 
 | 
        </trim> 
 | 
        <trim prefix="values (" suffix=")" suffixOverrides=","> 
 | 
            <if test="sendname != null">#{sendname},</if> 
 | 
            <if test="phone != null">#{phone},</if> 
 | 
            <if test="sex != null">#{sex},</if> 
 | 
            <if test="age != null">#{age},</if> 
 | 
            <if test="sfzh != null">#{sfzh},</if> 
 | 
            <if test="type != null">#{type},</if> 
 | 
            <if test="taskid != null">#{taskid},</if> 
 | 
            <if test="templateid != null">#{templateid},</if> 
 | 
            <if test="templatename != null">#{templatename},</if> 
 | 
            <if test="senddate != null">#{senddate},</if> 
 | 
            <if test="userid != null">#{userid},</if> 
 | 
            <if test="username != null">#{username},</if> 
 | 
            <if test="delFlag != null and delFlag != ''">#{delFlag},</if> 
 | 
            <if test="updateBy != null">#{updateBy},</if> 
 | 
            <if test="updateTime != null">#{updateTime},</if> 
 | 
            <if test="createBy != null">#{createBy},</if> 
 | 
            <if test="createTime != null">#{createTime},</if> 
 | 
            <if test="question != null">#{question},</if> 
 | 
            <if test="patientAnswer != null">#{patientAnswer},</if> 
 | 
            <if test="optionResult != null">#{optionResult},</if> 
 | 
            <if test="guid != null">#{guid},</if> 
 | 
            <if test="orgid != null">#{orgid},</if> 
 | 
        </trim> 
 | 
    </insert> 
 | 
  
 | 
    <update id="updateIvrTaskVisitResult" parameterType="com.smartor.domain.IvrTaskVisitResult"> 
 | 
        update ivr_task_visit_result 
 | 
        <trim prefix="SET" suffixOverrides=","> 
 | 
            <if test="sendname != null">sendname = #{sendname},</if> 
 | 
            <if test="phone != null">phone = #{phone},</if> 
 | 
            <if test="sex != null">sex = #{sex},</if> 
 | 
            <if test="age != null">age = #{age},</if> 
 | 
            <if test="sfzh != null">sfzh = #{sfzh},</if> 
 | 
            <if test="type != null">type = #{type},</if> 
 | 
            <if test="taskid != null">taskid = #{taskid},</if> 
 | 
            <if test="templateid != null">templateid = #{templateid},</if> 
 | 
            <if test="templatename != null">templatename = #{templatename},</if> 
 | 
            <if test="senddate != null">senddate = #{senddate},</if> 
 | 
            <if test="userid != null">userid = #{userid},</if> 
 | 
            <if test="username != null">username = #{username},</if> 
 | 
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> 
 | 
            <if test="updateBy != null">update_by = #{updateBy},</if> 
 | 
            <if test="updateTime != null">update_time = #{updateTime},</if> 
 | 
            <if test="createBy != null">create_by = #{createBy},</if> 
 | 
            <if test="createTime != null">create_time = #{createTime},</if> 
 | 
            <if test="question != null">question = #{question},</if> 
 | 
            <if test="patientAnswer != null">patient_answer = #{patientAnswer},</if> 
 | 
            <if test="optionResult != null">option_result = #{optionResult},</if> 
 | 
            <if test="guid != null">guid = #{guid},</if> 
 | 
            <if test="orgid != null">orgid = #{orgid},</if> 
 | 
        </trim> 
 | 
        where id = #{id} 
 | 
    </update> 
 | 
  
 | 
    <delete id="deleteIvrTaskVisitResultById" parameterType="Long"> 
 | 
        update ivr_task_visit_result 
 | 
        set del_flag =1 
 | 
        where id = #{id} 
 | 
    </delete> 
 | 
    <update id="deleteIvrTaskVisitResultByIds" parameterType="Long"> 
 | 
        update ivr_task_single 
 | 
        <trim prefix="SET" suffixOverrides=","> 
 | 
            del_flag =1 
 | 
        </trim> 
 | 
        where id in 
 | 
        <foreach item="id" collection="array" open="(" separator="," close=")"> 
 | 
            #{id} 
 | 
        </foreach> 
 | 
    </update> 
 | 
  
 | 
</mapper> 
 |