CompanyVoiceRoboticCalleesMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.CompanyVoiceRoboticCalleesMapper">
  6. <resultMap type="CompanyVoiceRoboticCallees" id="CompanyVoiceRoboticCalleesResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="userName" column="user_name" />
  10. <result property="phone" column="phone" />
  11. <result property="roboticId" column="robotic_id" />
  12. <result property="params" column="params" />
  13. </resultMap>
  14. <sql id="selectCompanyVoiceRoboticCalleesVo">
  15. select * from company_voice_robotic_callees
  16. </sql>
  17. <select id="selectCompanyVoiceRoboticCalleesList" parameterType="CompanyVoiceRoboticCallees" resultType="CompanyVoiceRoboticCallees">
  18. <include refid="selectCompanyVoiceRoboticCalleesVo"/>
  19. <where>
  20. <if test="userId != null "> and user_id = #{userId}</if>
  21. <if test="userName != null and userName != ''"> and user_name = #{userName}</if>
  22. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  23. <if test="roboticId != null "> and robotic_id = #{roboticId}</if>
  24. <if test="params != null and params != ''"> and params = #{params}</if>
  25. </where>
  26. </select>
  27. <select id="selectCompanyVoiceRoboticCalleesById" parameterType="Long" resultMap="CompanyVoiceRoboticCalleesResult">
  28. <include refid="selectCompanyVoiceRoboticCalleesVo"/>
  29. where id = #{id}
  30. </select>
  31. <select id="selectByRoboticId" resultType="com.fs.company.domain.CompanyVoiceRoboticCallees">
  32. select * from company_voice_robotic_callees where robotic_id = #{id}
  33. </select>
  34. <insert id="insertCompanyVoiceRoboticCallees" parameterType="CompanyVoiceRoboticCallees" useGeneratedKeys="true" keyProperty="id">
  35. insert into company_voice_robotic_callees
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="userId != null">user_id,</if>
  38. <if test="userName != null">user_name,</if>
  39. <if test="phone != null">phone,</if>
  40. <if test="roboticId != null">robotic_id,</if>
  41. <if test="params != null">params,</if>
  42. </trim>
  43. <trim prefix="values (" suffix=")" suffixOverrides=",">
  44. <if test="userId != null">#{userId},</if>
  45. <if test="userName != null">#{userName},</if>
  46. <if test="phone != null">#{phone},</if>
  47. <if test="roboticId != null">#{roboticId},</if>
  48. <if test="params != null">#{params},</if>
  49. </trim>
  50. </insert>
  51. <insert id="insertCompanyVoiceRoboticCalleesList" keyProperty="id">
  52. insert into company_voice_robotic_callees (user_id, user_name, phone, robotic_id, params) values
  53. <foreach collection="list" item="item" index="index" separator=",">
  54. (#{item.userId},#{item.userName},#{item.phone},#{item.roboticId},#{item.params})
  55. </foreach>
  56. </insert>
  57. <update id="updateCompanyVoiceRoboticCallees" parameterType="CompanyVoiceRoboticCallees">
  58. update company_voice_robotic_callees
  59. <trim prefix="SET" suffixOverrides=",">
  60. <if test="userId != null">user_id = #{userId},</if>
  61. <if test="userName != null">user_name = #{userName},</if>
  62. <if test="phone != null">phone = #{phone},</if>
  63. <if test="roboticId != null">robotic_id = #{roboticId},</if>
  64. <if test="params != null">params = #{params},</if>
  65. <if test="uuid != null">uuid = #{uuid},</if>
  66. <if test="result != null">result = #{result},</if>
  67. </trim>
  68. where id = #{id}
  69. </update>
  70. <delete id="deleteCompanyVoiceRoboticCalleesById" parameterType="Long">
  71. delete from company_voice_robotic_callees where id = #{id}
  72. </delete>
  73. <delete id="deleteCompanyVoiceRoboticCalleesByIds" parameterType="String">
  74. delete from company_voice_robotic_callees where id in
  75. <foreach item="id" collection="array" open="(" separator="," close=")">
  76. #{id}
  77. </foreach>
  78. </delete>
  79. <delete id="deleteByRoboticId">
  80. delete from company_voice_robotic_callees where robotic_id = #{id}
  81. </delete>
  82. <select id="countByRoboticIdNotUuid" resultType="long">
  83. select count(*) from company_voice_robotic_callees where robotic_id = #{roboticId} and result = 0
  84. </select>
  85. <select id="selectDataByCalleesId" resultType="CompanyVoiceRoboticCallees" >
  86. select * from company_voice_robotic_callees where id = #{calleesId}
  87. </select>
  88. <select id="getCalleesByUserIdAndTaskId" resultType="CompanyVoiceRoboticCallees" >
  89. select * from company_voice_robotic_callees where user_id = #{userId} and robotic_id = #{taskId}
  90. </select>
  91. <select id="selectCalleesListByRoboticIdsAndUserIds" resultType="CompanyVoiceRoboticCallees">
  92. select * from company_voice_robotic_callees
  93. where
  94. robotic_id in
  95. <foreach item="id" collection="taskIds" open="(" separator="," close=")">
  96. #{id}
  97. </foreach>
  98. and user_id in
  99. <foreach item="id" collection="userIds" open="(" separator="," close=")">
  100. #{id}
  101. </foreach>
  102. </select>
  103. <select id="getRoboticIsDoneByRoboticIdAndTaskFlow" resultType="java.lang.Integer">
  104. SELECT count(*) FROM company_voice_robotic_callees where robotic_id = #{roboticId} and (FIND_IN_SET(#{taskFlow},run_task_flow) =0 or FIND_IN_SET(#{taskFlow},run_task_flow) is null)
  105. </select>
  106. </mapper>