CompanyVoiceRoboticMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. </resultMap>
  27. <sql id="selectCompanyVoiceRoboticVo">
  28. select id, name, task_name, task_id, add_type, robot, dialog_id, mode, multiplier, auto_recall, recall_times, cid_group_id, week_day1, start_time1, end_time1, week_day2, start_time2, end_time2, create_time, create_user from company_voice_robotic
  29. </sql>
  30. <select id="selectCompanyVoiceRoboticList" parameterType="CompanyVoiceRobotic" resultMap="CompanyVoiceRoboticResult">
  31. <include refid="selectCompanyVoiceRoboticVo"/>
  32. <where>
  33. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  34. <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
  35. <if test="taskId != null "> and task_id = #{taskId}</if>
  36. <if test="robot != null "> and robot = #{robot}</if>
  37. <if test="dialogId != null "> and dialog_id = #{dialogId}</if>
  38. <if test="mode != null "> and mode = #{mode}</if>
  39. <if test="addType != null "> and add_type = #{addType}</if>
  40. <if test="multiplier != null "> and multiplier = #{multiplier}</if>
  41. <if test="autoRecall != null "> and auto_recall = #{autoRecall}</if>
  42. <if test="recallTimes != null "> and recall_times = #{recallTimes}</if>
  43. <if test="cidGroupId != null "> and cid_group_id = #{cidGroupId}</if>
  44. <if test="weekDay1 != null and weekDay1 != ''"> and week_day1 = #{weekDay1}</if>
  45. <if test="startTime1 != null and startTime1 != ''"> and start_time1 = #{startTime1}</if>
  46. <if test="endTime1 != null and endTime1 != ''"> and end_time1 = #{endTime1}</if>
  47. <if test="weekDay2 != null and weekDay2 != ''"> and week_day2 = #{weekDay2}</if>
  48. <if test="startTime2 != null and startTime2 != ''"> and start_time2 = #{startTime2}</if>
  49. <if test="endTime2 != null and endTime2 != ''"> and end_time2 = #{endTime2}</if>
  50. <if test="createUser != null "> and create_user = #{createUser}</if>
  51. </where>
  52. order by id desc
  53. </select>
  54. <select id="selectCompanyVoiceRoboticListCompany" parameterType="CompanyVoiceRobotic" resultMap="CompanyVoiceRoboticResult">
  55. select a.* from company_voice_robotic a
  56. inner join company_user u on a.create_user = u.user_id
  57. inner join company_dept d on u.dept_id = d.dept_id
  58. <where>
  59. a.del_flag = 0
  60. <if test="taskType != null "> and a.task_type = #{taskType} </if>
  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. order by a.id desc
  86. </select>
  87. <select id="selectCompanyVoiceRoboticById" parameterType="Long" resultMap="CompanyVoiceRoboticResult">
  88. <include refid="selectCompanyVoiceRoboticVo"/>
  89. where id = #{id}
  90. </select>
  91. <select id="qwUserList" resultType="com.fs.company.vo.CompanyVoiceRoboticQwUserListVo">
  92. select a.id, a.wx_nick_name, a.wx_no, b.nick_name as companyUserName from company_wx_account a
  93. inner join company_user b on a.company_user_id = b.user_id
  94. </select>
  95. <select id="qwUserListCompany" resultType="com.fs.company.vo.CompanyVoiceRoboticQwUserListVo">
  96. select a.id, a.wx_nick_name, a.wx_no, u.nick_name as companyUserName
  97. from company_wx_account a
  98. inner join company_user u on a.company_user_id = u.user_id
  99. inner join company_dept d on u.dept_id = d.dept_id
  100. <where>
  101. <if test="params != null">${params.dataScope}</if>
  102. </where>
  103. </select>
  104. <insert id="insertCompanyVoiceRobotic" parameterType="CompanyVoiceRobotic" useGeneratedKeys="true" keyProperty="id">
  105. insert into company_voice_robotic
  106. <trim prefix="(" suffix=")" suffixOverrides=",">
  107. <if test="name != null">name,</if>
  108. <if test="taskName != null">task_name,</if>
  109. <if test="addType != null">add_type,</if>
  110. <if test="taskId != null">task_id,</if>
  111. <if test="robot != null">robot,</if>
  112. <if test="dialogId != null">dialog_id,</if>
  113. <if test="mode != null">mode,</if>
  114. <if test="multiplier != null">multiplier,</if>
  115. <if test="autoRecall != null">auto_recall,</if>
  116. <if test="recallTimes != null">recall_times,</if>
  117. <if test="cidGroupId != null">cid_group_id,</if>
  118. <if test="weekDay1 != null">week_day1,</if>
  119. <if test="startTime1 != null">start_time1,</if>
  120. <if test="endTime1 != null">end_time1,</if>
  121. <if test="weekDay2 != null">week_day2,</if>
  122. <if test="startTime2 != null">start_time2,</if>
  123. <if test="endTime2 != null">end_time2,</if>
  124. <if test="createTime != null">create_time,</if>
  125. <if test="createUser != null">create_user,</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. </trim>
  148. </insert>
  149. <update id="updateCompanyVoiceRobotic" parameterType="CompanyVoiceRobotic">
  150. update company_voice_robotic
  151. <trim prefix="SET" suffixOverrides=",">
  152. <if test="name != null">name = #{name},</if>
  153. <if test="taskName != null">task_name = #{taskName},</if>
  154. <if test="taskId != null">task_id = #{taskId},</if>
  155. <if test="addType != null">add_type = #{addType},</if>
  156. <if test="robot != null">robot = #{robot},</if>
  157. <if test="dialogId != null">dialog_id = #{dialogId},</if>
  158. <if test="mode != null">mode = #{mode},</if>
  159. <if test="multiplier != null">multiplier = #{multiplier},</if>
  160. <if test="autoRecall != null">auto_recall = #{autoRecall},</if>
  161. <if test="recallTimes != null">recall_times = #{recallTimes},</if>
  162. <if test="cidGroupId != null">cid_group_id = #{cidGroupId},</if>
  163. <if test="weekDay1 != null">week_day1 = #{weekDay1},</if>
  164. <if test="startTime1 != null">start_time1 = #{startTime1},</if>
  165. <if test="endTime1 != null">end_time1 = #{endTime1},</if>
  166. <if test="weekDay2 != null">week_day2 = #{weekDay2},</if>
  167. <if test="startTime2 != null">start_time2 = #{startTime2},</if>
  168. <if test="endTime2 != null">end_time2 = #{endTime2},</if>
  169. <if test="createTime != null">create_time = #{createTime},</if>
  170. <if test="createUser != null">create_user = #{createUser},</if>
  171. </trim>
  172. where id = #{id}
  173. </update>
  174. <delete id="deleteCompanyVoiceRoboticById" parameterType="Long">
  175. delete from company_voice_robotic where id = #{id}
  176. </delete>
  177. <delete id="deleteCompanyVoiceRoboticByIds" parameterType="String">
  178. delete from company_voice_robotic where id in
  179. <foreach item="id" collection="array" open="(" separator="," close=")">
  180. #{id}
  181. </foreach>
  182. </delete>
  183. <update id="updateDelFlag">
  184. update company_voice_robotic set del_flag = #{delFlag} where id = #{id}
  185. </update>
  186. <select id="getDictDataList" resultType="com.fs.company.vo.DictVO">
  187. SELECT dict_type,dict_label,dict_value FROM `sys_dict_data` where dict_type = #{dictType}
  188. </select>
  189. <update id="finishAddWxRobotic" >
  190. update company_voice_robotic
  191. set run_task_flow = CASE
  192. WHEN run_task_flow is null or run_task_flow = '' THEN
  193. 'addWx'
  194. ELSE
  195. CONCAT(run_task_flow,',','addWx')
  196. END
  197. where id in
  198. <foreach item="id" collection="collect" open="(" separator="," close=")">
  199. #{id}
  200. </foreach>
  201. </update>
  202. <update id="finishRobotic" parameterType="java.lang.Long">
  203. update company_voice_robotic set task_status = 3 where id = #{id} and task_flow = run_task_flow
  204. </update>
  205. <select id="selectSceneTaskByCompanyIdAndType" resultType="CompanyVoiceRobotic">
  206. select * from company_voice_robotic where company_id = #{companyId}
  207. and scene_type = #{sceneType}
  208. and task_status = 1
  209. and del_flag = 0
  210. order by create_time desc
  211. </select>
  212. </mapper>