ConversationDetailMapper.xml 4.77 KB
<?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="cn.com.glsx.dj.mindworkplate.mapper.ConversationDetailMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.ConversationDetail">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="batch_id" property="batchId" jdbcType="INTEGER"/>
        <result column="role" property="role" jdbcType="VARCHAR"/>
        <result column="system_time" property="systemTime" jdbcType="VARCHAR"/>
        <result column="recordings_id" property="recordingsId" jdbcType="INTEGER"/>
        <result column="offset" property="offset" jdbcType="BIGINT"/>
        <result column="duration" property="duration" jdbcType="BIGINT"/>
        <result column="merged_offset" property="mergedOffset" jdbcType="BIGINT"/>
        <result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
        <result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
        <result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
        <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
        <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
    </resultMap>
    <resultMap id="ResultMapWithBLOBs" type="cn.com.glsx.dj.mindworkplate.model.ConversationDetail"
               extends="BaseResultMap">
        <!--
          WARNING - @mbg.generated
        -->
        <result column="content" property="content" jdbcType="LONGVARCHAR"/>
    </resultMap>
    <resultMap id="cdDtoResultMap" type="cn.com.glsx.dj.mindworkplate.dto.ConversationDetailDTO"
               extends="BaseResultMap">
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, batch_id, role, system_time, recordings_id, offset, duration, merged_offset, created_by, created_date,
        updated_by, updated_date, deleted_flag
    </sql>

    <select id="page" parameterType="cn.com.glsx.dj.mindworkplate.dto.ConversationDetailRequestDTO" resultMap="cdDtoResultMap">
        select * from inspection_conversation_detail cd
        <where>
            cd.deleted_flag = 'N'
            and cd.batch_id = #{batchId}
            <if test="offset != null">
                and cd.offset = #{offset}
            </if>
            <if test="duration != null">
                and cd.duration = #{duration}
            </if>
            <if test="content != null and content != ''">
                and cd.content like concat('%', #{content}, '%')
            </if>
            <if test="role != null and role != ''">
                and cd.role = #{role}
            </if>
        </where>
        order by cd.system_time asc
    </select>
  <update id="updateBatchId">
    update inspection_conversation_detail
    set batch_id = #{batch.id}
    where recordings_id in
    <foreach collection="recordingIds" item="item" open="(" separator="," close=")">
      #{item}
    </foreach>
    and system_time &gt;= #{batch.startTime} and system_time &lt;= #{batch.endTime}
  </update>

    <select id="listByBatchId" resultMap="BaseResultMap">
        select cd.*
        from inspection_conversation_detail cd
        where cd.deleted_flag = 'N'
        and cd.batch_id = #{batchId}
        order by cd.id asc
    </select>

    <select id="getConversionDetailByBadgeId" resultType="cn.com.glsx.dj.mindworkplate.dto.DefenceIdRequestDTO$Detail">
        select content,
               merged_offset as `time`,
               role,
               merged_offset as mergedOffset
        from inspection_conversation_detail
        where deleted_flag = 'N'
          and batch_id = #{id}
        order by system_time
    </select>

  <select id="conversationDetailById" parameterType="cn.com.glsx.dj.mindworkplate.dto.ConversationDetailRequestDTO" resultMap="cdDtoResultMap">
    select cd.*,ca.id as conversationDetailAppealId from inspection_conversation_detail cd
    left join inspection_conversation_detail_appeal ca on cd.id=ca.conversation_detail_id
    where
      cd.deleted_flag = 'N'
      and cd.batch_id = #{batchId}
    order by cd.system_time asc
  </select>

  <select id="conversationDetailByBatchIds" parameterType="cn.com.glsx.dj.mindworkplate.dto.ConversationDetailRequestDTO" resultMap="cdDtoResultMap">
    select cd.*,ca.id as conversationDetailAppealId from inspection_conversation_detail cd
    left join inspection_conversation_detail_appeal ca on cd.id=ca.conversation_detail_id
    where
    cd.deleted_flag = 'N'
    and cd.batch_id in
    <foreach collection="batchIds" item="item" open="(" separator="," close=")">
      #{item}
    </foreach>
    order by cd.system_time asc
  </select>
</mapper>