QwSopTempVoiceMapper.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.sop.mapper.QwSopTempVoiceMapper">
  6. <resultMap type="QwSopTempVoice" id="QwSopTempVoiceResult">
  7. <result property="id" column="id" />
  8. <result property="companyUserId" column="company_user_id" />
  9. <result property="tempId" column="temp_id" />
  10. <result property="ruleId" column="rule_id" />
  11. <result property="contentId" column="content_id" />
  12. <result property="voiceTxt" column="voice_txt" />
  13. <result property="voiceUrl" column="voice_url" />
  14. <result property="userVoiceUrl" column="user_voice_url" />
  15. <result property="recordType" column="record_type" />
  16. <result property="createTime" column="create_time" />
  17. </resultMap>
  18. <sql id="selectQwSopTempVoiceVo">
  19. select id,company_user_id, temp_id, rule_id, content_id, voice_txt, voice_url, create_time from qw_sop_temp_voice
  20. </sql>
  21. <select id="selectQwSopTempVoiceList" parameterType="QwSopTempVoice" resultMap="QwSopTempVoiceResult">
  22. <include refid="selectQwSopTempVoiceVo"/>
  23. <where>
  24. <if test="tempId != null and tempId != ''"> and temp_id = #{tempId}</if>
  25. <if test="ruleId != null "> and rule_id = #{ruleId}</if>
  26. <if test="contentId != null "> and content_id = #{contentId}</if>
  27. <if test="voiceTxt != null and voiceTxt != ''"> and voice_txt = #{voiceTxt}</if>
  28. <if test="voiceUrl != null and voiceUrl != ''"> and voice_url = #{voiceUrl}</if>
  29. </where>
  30. </select>
  31. <select id="selectQwSopTempVoiceById" parameterType="Long" resultMap="QwSopTempVoiceResult">
  32. select id,company_user_id,duration, temp_id, rule_id, content_id, voice_txt, voice_url,user_voice_url,record_type, create_time from qw_sop_temp_voice
  33. where id = #{id}
  34. </select>
  35. <select id="listVoice" resultType="com.fs.sop.domain.QwSopTempVoice">
  36. select * from qw_sop_temp_voice where temp_id = #{tempId} and company_user_id in
  37. <foreach collection="salesIds" item="item" separator="," open="(" close=")">#{item}</foreach>
  38. </select>
  39. <select id="getVoice" resultType="com.fs.sop.domain.QwSopTempVoice">
  40. select a.* from qw_sop_temp_voice a
  41. where a.company_user_id = #{companyUserId}
  42. and a.company_id = #{companyId}
  43. and a.temp_id = #{tempId}
  44. and a.rule_id = #{rulesId}
  45. </select>
  46. <select id="listVoiceTemp" resultType="com.fs.sop.domain.QwSopTempVoice">
  47. select * from qw_sop_temp_voice a where a.temp_id = #{tempId} and a.day_id =#{dayId}
  48. </select>
  49. <select id="getVoiceByText" resultType="com.fs.sop.domain.QwSopTempVoice">
  50. select a.* from qw_sop_temp_voice a
  51. where a.company_user_id = #{companyUserId}
  52. and a.voice_txt in <foreach collection="textList" item="txt" open="(" close=")" separator=",">#{txt}</foreach>
  53. </select>
  54. <select id="selectAllByUserIds" resultType="com.fs.sop.domain.QwSopTempVoice">
  55. select * from qw_sop_temp_voice a
  56. where a.company_user_id in <foreach collection="userIdList" open="(" separator="," close=")" item="item">#{item}</foreach>
  57. </select>
  58. <select id="selectQwSopTempVoiceByIdAndText" resultType="com.fs.sop.domain.QwSopTempVoice">
  59. select id,company_user_id companyUserId,voice_txt voiceTxt from qw_sop_temp_voice where id = #{id}
  60. and voice_txt = #{voiceTxt} and record_type in (0,1) limit 1
  61. </select>
  62. <select id="selectQwSopTempVoiceByIdAndUserVoiceUrl" resultType="com.fs.sop.domain.QwSopTempVoice">
  63. select id,company_user_id companyUserId from qw_sop_temp_voice where id = #{id} and record_type in (0,1,2) limit 1
  64. </select>
  65. <select id="selectQwSopTempVoiceNewList" resultType="com.fs.sop.domain.QwSopTempVoice">
  66. select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
  67. user_voice_url userVoiceUrl from qw_sop_temp_voice
  68. <where>
  69. <if test="companyUserId != null"> and company_user_id = #{companyUserId}</if>
  70. <if test="recordType != null"> and record_type = #{recordType}</if>
  71. </where>
  72. order by update_time desc,id desc
  73. </select>
  74. <select id="selectQwSopTempVoiceByQwUserIds" resultMap="QwSopTempVoiceResult">
  75. select * from qw_sop_temp_voice where record_type = 0 and qw_user_id in
  76. <foreach item="qwUserId" collection="ids" open="(" separator="," close=")">
  77. #{qwUserId}
  78. </foreach>
  79. </select>
  80. <select id="selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt" resultType="com.fs.sop.domain.QwSopTempVoice">
  81. select qw_user_id qwUserId,voice_url voiceUrl,voice_txt voiceTxt,user_voice_url userVoiceUrl,company_user_id companyUserId,
  82. record_type recordType,duration from qw_sop_temp_voice where company_user_id = #{companyUserId} and voice_txt = #{voiceTxt}
  83. </select>
  84. <select id="selectQwSopTempVoiceByCompanyUserIdAndQwUserId" resultType="com.fs.sop.domain.QwSopTempVoice">
  85. select id,company_user_id companyUserId,voice_url voiceUrl,voice_txt voiceTxt,duration
  86. from qw_sop_temp_voice
  87. where company_user_id = #{companyUserId} and qw_user_id = #{qwUserId}
  88. and voice_url is not null
  89. limit 1
  90. </select>
  91. <select id="selectQwSopTempVoiceListLimit" resultType="com.fs.sop.domain.QwSopTempVoice">
  92. select id,voice_txt voiceTxt,company_user_id companyUserId,voice_url voiceUrl,duration,record_type recordType,
  93. user_voice_url userVoiceUrl from qw_sop_temp_voice
  94. where record_type = #{recordType} and company_user_id is not null
  95. order by date_format(create_time,'%y%m%d') desc,company_user_id desc limit 10
  96. </select>
  97. <insert id="insertQwSopTempVoice" parameterType="QwSopTempVoice" useGeneratedKeys="true" keyProperty="id">
  98. insert into qw_sop_temp_voice
  99. <trim prefix="(" suffix=")" suffixOverrides=",">
  100. <if test="companyUserId != null">company_user_id,</if>
  101. <if test="qwUserId != null">qw_user_id,</if>
  102. <if test="companyId != null">company_id,</if>
  103. <if test="tempId != null">temp_id,</if>
  104. <if test="ruleId != null">rule_id,</if>
  105. <if test="contentId != null">content_id,</if>
  106. <if test="voiceTxt != null">voice_txt,</if>
  107. <if test="voiceUrl != null">voice_url,</if>
  108. <if test="userVoiceUrl != null">user_voice_url,</if>
  109. <if test="createTime != null">create_time,</if>
  110. <if test="duration != null">duration,</if>
  111. <if test="recordType != null">record_type,</if>
  112. </trim>
  113. <trim prefix="values (" suffix=")" suffixOverrides=",">
  114. <if test="companyUserId != null">#{companyUserId},</if>
  115. <if test="qwUserId != null">#{qwUserId},</if>
  116. <if test="companyId != null">#{companyId},</if>
  117. <if test="tempId != null">#{tempId},</if>
  118. <if test="ruleId != null">#{ruleId},</if>
  119. <if test="contentId != null">#{contentId},</if>
  120. <if test="voiceTxt != null">#{voiceTxt},</if>
  121. <if test="voiceUrl != null">#{voiceUrl},</if>
  122. <if test="userVoiceUrl != null">#{userVoiceUrl},</if>
  123. <if test="createTime != null">#{createTime},</if>
  124. <if test="duration != null">#{duration},</if>
  125. <if test="recordType != null">#{recordType},</if>
  126. </trim>
  127. </insert>
  128. <insert id="insertBatch">
  129. INSERT INTO qw_sop_temp_voice (temp_id, company_user_id, day_id, company_id, content_id, rule_id, voice_txt, voice_url,record_type, duration)
  130. VALUES
  131. <foreach collection="list" item="item" separator=",">
  132. (#{item.tempId}, #{item.companyUserId}, #{item.dayId}, #{item.companyId}, #{item.contentId}, #{item.ruleId}, #{item.voiceTxt}, #{item.voiceUrl}, #{item.recordType},#{item.duration})
  133. </foreach>
  134. </insert>
  135. <update id="updateQwSopTempVoice" parameterType="QwSopTempVoice">
  136. update qw_sop_temp_voice
  137. <trim prefix="SET" suffixOverrides=",">
  138. <if test="tempId != null">temp_id = #{tempId},</if>
  139. <if test="ruleId != null">rule_id = #{ruleId},</if>
  140. <if test="contentId != null">content_id = #{contentId},</if>
  141. <if test="voiceTxt != null">voice_txt = #{voiceTxt},</if>
  142. <if test="voiceUrl != null">voice_url = #{voiceUrl},</if>
  143. <if test="userVoiceUrl != null">user_voice_url = #{userVoiceUrl},</if>
  144. <if test="recordType != null">record_type = #{recordType},</if>
  145. <if test="createTime != null">create_time = #{createTime},</if>
  146. <if test="duration != null">duration = #{duration},</if>
  147. </trim>
  148. where id = #{id}
  149. </update>
  150. <delete id="deleteQwSopTempVoiceById" parameterType="Long">
  151. delete from qw_sop_temp_voice where id = #{id}
  152. </delete>
  153. <delete id="deleteQwSopTempVoiceByIds" parameterType="String">
  154. delete from qw_sop_temp_voice where id in
  155. <foreach item="id" collection="array" open="(" separator="," close=")">
  156. #{id}
  157. </foreach>
  158. </delete>
  159. <delete id="remove">
  160. delete from qw_sop_temp_voice a where a.temp_id = #{tempId} and a.day_id =#{dayId}
  161. </delete>
  162. </mapper>