CompanyVoiceRoboticMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.company.mapper.CompanyVoiceRoboticMapper">
  6. <resultMap type="CompanyVoiceRobotic" id="CompanyVoiceRoboticResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="taskName" column="task_name" />
  10. <result property="taskId" column="task_id" />
  11. <result property="robot" column="robot" />
  12. <result property="dialogId" column="dialog_id" />
  13. <result property="mode" column="mode" />
  14. <result property="addType" column="add_type" />
  15. <result property="multiplier" column="multiplier" />
  16. <result property="autoRecall" column="auto_recall" />
  17. <result property="recallTimes" column="recall_times" />
  18. <result property="cidGroupId" column="cid_group_id" />
  19. <result property="weekDay1" column="week_day1" />
  20. <result property="startTime1" column="start_time1" />
  21. <result property="endTime1" column="end_time1" />
  22. <result property="weekDay2" column="week_day2" />
  23. <result property="startTime2" column="start_time2" />
  24. <result property="endTime2" column="end_time2" />
  25. <result property="createTime" column="create_time" />
  26. <result property="companyAiWorkflowId" column="company_ai_workflow_id" />
  27. </resultMap>
  28. <sql id="selectCompanyVoiceRoboticVo">
  29. select * from company_voice_robotic
  30. </sql>
  31. <select id="selectCompanyVoiceRoboticList" parameterType="CompanyVoiceRobotic" resultMap="CompanyVoiceRoboticResult">
  32. <include refid="selectCompanyVoiceRoboticVo"/>
  33. <where>
  34. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  35. <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
  36. <if test="taskId != null "> and task_id = #{taskId}</if>
  37. <if test="robot != null "> and robot = #{robot}</if>
  38. <if test="dialogId != null "> and dialog_id = #{dialogId}</if>
  39. <if test="mode != null "> and mode = #{mode}</if>
  40. <if test="addType != null "> and add_type = #{addType}</if>
  41. <if test="multiplier != null "> and multiplier = #{multiplier}</if>
  42. <if test="autoRecall != null "> and auto_recall = #{autoRecall}</if>
  43. <if test="recallTimes != null "> and recall_times = #{recallTimes}</if>
  44. <if test="cidGroupId != null "> and cid_group_id = #{cidGroupId}</if>
  45. <if test="weekDay1 != null and weekDay1 != ''"> and week_day1 = #{weekDay1}</if>
  46. <if test="startTime1 != null and startTime1 != ''"> and start_time1 = #{startTime1}</if>
  47. <if test="endTime1 != null and endTime1 != ''"> and end_time1 = #{endTime1}</if>
  48. <if test="weekDay2 != null and weekDay2 != ''"> and week_day2 = #{weekDay2}</if>
  49. <if test="startTime2 != null and startTime2 != ''"> and start_time2 = #{startTime2}</if>
  50. <if test="endTime2 != null and endTime2 != ''"> and end_time2 = #{endTime2}</if>
  51. <if test="createUser != null "> and create_user = #{createUser}</if>
  52. <if test="companyAiWorkflowId != null "> and company_ai_workflow_id = #{companyAiWorkflowId}</if>
  53. </where>
  54. order by id desc
  55. </select>
  56. <select id="selectCompanyVoiceRoboticListCompany" parameterType="CompanyVoiceRobotic" resultMap="CompanyVoiceRoboticResult">
  57. select a.* from company_voice_robotic a
  58. inner join company_user u on a.create_user = u.user_id
  59. inner join company_dept d on u.dept_id = d.dept_id
  60. <where>
  61. <if test="companyId != null"> and a.company_id = #{companyId}</if>
  62. <if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
  63. <if test="taskName != null and taskName != ''"> and a.task_name like concat('%', #{taskName}, '%')</if>
  64. <if test="taskId != null "> and a.task_id = #{taskId}</if>
  65. <if test="robot != null "> and a.robot = #{robot}</if>
  66. <if test="dialogId != null "> and a.dialog_id = #{dialogId}</if>
  67. <if test="mode != null "> and a.mode = #{mode}</if>
  68. <if test="addType != null "> and a.add_type = #{addType}</if>
  69. <if test="multiplier != null "> and a.multiplier = #{multiplier}</if>
  70. <if test="autoRecall != null "> and a.auto_recall = #{autoRecall}</if>
  71. <if test="recallTimes != null "> and a.recall_times = #{recallTimes}</if>
  72. <if test="cidGroupId != null "> and a.cid_group_id = #{cidGroupId}</if>
  73. <if test="weekDay1 != null and weekDay1 != ''"> and a.week_day1 = #{weekDay1}</if>
  74. <if test="startTime1 != null and startTime1 != ''"> and a.start_time1 = #{startTime1}</if>
  75. <if test="endTime1 != null and endTime1 != ''"> and a.end_time1 = #{endTime1}</if>
  76. <if test="weekDay2 != null and weekDay2 != ''"> and a.week_day2 = #{weekDay2}</if>
  77. <if test="startTime2 != null and startTime2 != ''"> and a.start_time2 = #{startTime2}</if>
  78. <if test="endTime2 != null and endTime2 != ''"> and a.end_time2 = #{endTime2}</if>
  79. <if test="createUser != null "> and a.create_user = #{createUser}</if>
  80. <if test="companyAiWorkflowId != null "> and a.company_ai_workflow_id = #{companyAiWorkflowId}</if>
  81. <if test="params != null">
  82. ${params.dataScope}
  83. </if>
  84. </where>
  85. </select>
  86. <select id="selectCompanyVoiceRoboticById" parameterType="Long" resultMap="CompanyVoiceRoboticResult">
  87. <include refid="selectCompanyVoiceRoboticVo"/>
  88. where id = #{id}
  89. </select>
  90. <select id="qwUserList" resultType="com.fs.company.vo.CompanyVoiceRoboticQwUserListVo">
  91. select a.id, a.wx_nick_name, a.wx_no, b.nick_name as companyUserName from company_wx_account a
  92. inner join company_user b on a.company_user_id = b.user_id
  93. </select>
  94. <select id="qwUserListCompany" resultType="com.fs.company.vo.CompanyVoiceRoboticQwUserListVo">
  95. select a.id, a.wx_nick_name, a.wx_no, u.nick_name as companyUserName
  96. from company_wx_account a
  97. inner join company_user u on a.company_user_id = u.user_id
  98. inner join company_dept d on u.dept_id = d.dept_id
  99. <where>
  100. <if test="params != null">${params.dataScope}</if>
  101. </where>
  102. </select>
  103. <insert id="insertCompanyVoiceRobotic" parameterType="CompanyVoiceRobotic" useGeneratedKeys="true" keyProperty="id">
  104. insert into company_voice_robotic
  105. <trim prefix="(" suffix=")" suffixOverrides=",">
  106. <if test="name != null">name,</if>
  107. <if test="taskName != null">task_name,</if>
  108. <if test="addType != null">add_type,</if>
  109. <if test="taskId != null">task_id,</if>
  110. <if test="robot != null">robot,</if>
  111. <if test="dialogId != null">dialog_id,</if>
  112. <if test="mode != null">mode,</if>
  113. <if test="multiplier != null">multiplier,</if>
  114. <if test="autoRecall != null">auto_recall,</if>
  115. <if test="recallTimes != null">recall_times,</if>
  116. <if test="cidGroupId != null">cid_group_id,</if>
  117. <if test="weekDay1 != null">week_day1,</if>
  118. <if test="startTime1 != null">start_time1,</if>
  119. <if test="endTime1 != null">end_time1,</if>
  120. <if test="weekDay2 != null">week_day2,</if>
  121. <if test="startTime2 != null">start_time2,</if>
  122. <if test="endTime2 != null">end_time2,</if>
  123. <if test="createTime != null">create_time,</if>
  124. <if test="createUser != null">create_user,</if>
  125. <if test="companyAiWorkflowId != null">company_ai_workflow_id,</if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="name != null">#{name},</if>
  129. <if test="taskName != null">#{taskName},</if>
  130. <if test="addType != null">#{addType},</if>
  131. <if test="taskId != null">#{taskId},</if>
  132. <if test="robot != null">#{robot},</if>
  133. <if test="dialogId != null">#{dialogId},</if>
  134. <if test="mode != null">#{mode},</if>
  135. <if test="multiplier != null">#{multiplier},</if>
  136. <if test="autoRecall != null">#{autoRecall},</if>
  137. <if test="recallTimes != null">#{recallTimes},</if>
  138. <if test="cidGroupId != null">#{cidGroupId},</if>
  139. <if test="weekDay1 != null">#{weekDay1},</if>
  140. <if test="startTime1 != null">#{startTime1},</if>
  141. <if test="endTime1 != null">#{endTime1},</if>
  142. <if test="weekDay2 != null">#{weekDay2},</if>
  143. <if test="startTime2 != null">#{startTime2},</if>
  144. <if test="endTime2 != null">#{endTime2},</if>
  145. <if test="createTime != null">#{createTime},</if>
  146. <if test="createUser != null">#{createUser},</if>
  147. <if test="companyAiWorkflowId != null">#{companyAiWorkflowId},</if>
  148. </trim>
  149. </insert>
  150. <update id="updateCompanyVoiceRobotic" parameterType="CompanyVoiceRobotic">
  151. update company_voice_robotic
  152. <trim prefix="SET" suffixOverrides=",">
  153. <if test="name != null">name = #{name},</if>
  154. <if test="taskName != null">task_name = #{taskName},</if>
  155. <if test="taskId != null">task_id = #{taskId},</if>
  156. <if test="addType != null">add_type = #{addType},</if>
  157. <if test="robot != null">robot = #{robot},</if>
  158. <if test="dialogId != null">dialog_id = #{dialogId},</if>
  159. <if test="mode != null">mode = #{mode},</if>
  160. <if test="multiplier != null">multiplier = #{multiplier},</if>
  161. <if test="autoRecall != null">auto_recall = #{autoRecall},</if>
  162. <if test="recallTimes != null">recall_times = #{recallTimes},</if>
  163. <if test="cidGroupId != null">cid_group_id = #{cidGroupId},</if>
  164. <if test="weekDay1 != null">week_day1 = #{weekDay1},</if>
  165. <if test="startTime1 != null">start_time1 = #{startTime1},</if>
  166. <if test="endTime1 != null">end_time1 = #{endTime1},</if>
  167. <if test="weekDay2 != null">week_day2 = #{weekDay2},</if>
  168. <if test="startTime2 != null">start_time2 = #{startTime2},</if>
  169. <if test="endTime2 != null">end_time2 = #{endTime2},</if>
  170. <if test="createTime != null">create_time = #{createTime},</if>
  171. <if test="createUser != null">create_user = #{createUser},</if>
  172. <if test="companyAiWorkflowId != null">company_ai_workflow_id = #{companyAiWorkflowId},</if>
  173. </trim>
  174. where id = #{id}
  175. </update>
  176. <delete id="deleteCompanyVoiceRoboticById" parameterType="Long">
  177. delete from company_voice_robotic where id = #{id}
  178. </delete>
  179. <delete id="deleteCompanyVoiceRoboticByIds" parameterType="String">
  180. delete from company_voice_robotic where id in
  181. <foreach item="id" collection="array" open="(" separator="," close=")">
  182. #{id}
  183. </foreach>
  184. </delete>
  185. <update id="finishRobotic" parameterType="java.lang.Long">
  186. update company_voice_robotic set task_status = 3 where id = #{id} and task_flow = run_task_flow
  187. </update>
  188. <update id="finishAddWxRobotic" >
  189. update company_voice_robotic
  190. set run_task_flow = CASE
  191. WHEN run_task_flow is null or run_task_flow = '' THEN
  192. 'addWx'
  193. ELSE
  194. CONCAT(run_task_flow,',','addWx')
  195. END
  196. where id in
  197. <foreach item="id" collection="collect" open="(" separator="," close=")">
  198. #{id}
  199. </foreach>
  200. </update>
  201. </mapper>