FsCourseLinkMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.course.mapper.FsCourseLinkMapper">
  6. <resultMap type="FsCourseLink" id="FsCourseLinkResult">
  7. <result property="linkId" column="link_id" />
  8. <result property="link" column="link" />
  9. <result property="realLink" column="real_link" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateTime" column="update_time" />
  12. <result property="companyId" column="company_id" />
  13. <result property="companyUserId" column="company_user_id" />
  14. <result property="qwUserId" column="qw_user_id" />
  15. <result property="videoId" column="video_id" />
  16. <result property="corpId" column="corp_id" />
  17. <result property="courseId" column="course_id" />
  18. <result property="qwExternalId" column="qw_external_id" />
  19. <result property="linkType" column="link_type" />
  20. <result property="isRoom" column="is_room" />
  21. <result property="chatId" column="chat_id" />
  22. </resultMap>
  23. <sql id="selectFsCourseLinkVo">
  24. select link_id,chat_id, is_room,link, real_link,link_type, create_time, update_time, company_id, company_user_id, qw_user_id, video_id, corp_id, course_id ,qw_external_id from fs_course_link
  25. </sql>
  26. <select id="selectFsCourseLinkList" parameterType="FsCourseLink" resultMap="FsCourseLinkResult">
  27. <include refid="selectFsCourseLinkVo"/>
  28. <where>
  29. <if test="link != null and link != ''"> and link = #{link}</if>
  30. <if test="realLink != null and realLink != ''"> and real_link = #{realLink}</if>
  31. <if test="companyId != null "> and company_id = #{companyId}</if>
  32. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  33. <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
  34. <if test="videoId != null "> and video_id = #{videoId}</if>
  35. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  36. <if test="courseId != null and courseId != ''"> and course_id = #{courseId}</if>
  37. <if test="linkType != null "> and link_type = #{linkType}</if>
  38. <if test="qwExternalId != null and qwExternalId != ''"> and qw_external_id = #{qwExternalId}</if>
  39. </where>
  40. </select>
  41. <select id="selectFsCourseLinkByLinkId" parameterType="Long" resultMap="FsCourseLinkResult">
  42. <include refid="selectFsCourseLinkVo"/>
  43. where link_id = #{linkId}
  44. </select>
  45. <select id="selectFsCourseLinkListByQwUserId" resultType="com.fs.course.dto.FsCourseLinkDTO">
  46. select l.link_id,l.real_link,l.create_time,l.update_time,l.company_id,l.company_user_id,l.qw_user_id,l.video_id,l.corp_id,l.course_id,l.qw_external_id,l.link_type,l.chat_id,l.is_room,l.u_no,
  47. c.img_url courseUrl,c.course_name courseName,c.title
  48. from fs_course_link l left join fs_user_course c on c.course_id=l.course_id where create_time &gt;= CURDATE() AND create_time &lt; CURDATE() + INTERVAL 1 DAY
  49. and l.qw_user_id = #{qwUserId} and l.qw_external_id = #{qwExternalId}
  50. </select>
  51. <select id="selectLinkByCourseIdAndExIdAndQwUserId" resultType="FsCourseLink">
  52. select l.link_id,l.real_link,l.create_time,l.update_time,l.company_id,l.company_user_id,l.qw_user_id,l.video_id,l.corp_id,l.course_id,l.qw_external_id,l.link_type,l.chat_id,l.is_room,l.u_no from fs_course_link l where l.course_id=#{courseId} and l.qw_external_id=#{qwExternalContactId} and l.qw_user_id=#{qwUserId} and l.video_id = #{videoId}
  53. </select>
  54. <insert id="insertFsCourseLink" parameterType="FsCourseLink" useGeneratedKeys="true" keyProperty="linkId">
  55. insert into fs_course_link
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="link != null">link,</if>
  58. <if test="realLink != null">real_link,</if>
  59. <if test="createTime != null">create_time,</if>
  60. <if test="updateTime != null">update_time,</if>
  61. <if test="companyId != null">company_id,</if>
  62. <if test="companyUserId != null">company_user_id,</if>
  63. <if test="qwUserId != null">qw_user_id,</if>
  64. <if test="videoId != null">video_id,</if>
  65. <if test="corpId != null">corp_id,</if>
  66. <if test="courseId != null">course_id,</if>
  67. <if test="qwExternalId != null">qw_external_id,</if>
  68. <if test="linkType != null">link_type,</if>
  69. <if test="isRoom != null">is_room,</if>
  70. <if test="chatId != null">chat_id,</if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="link != null">#{link},</if>
  74. <if test="realLink != null">#{realLink},</if>
  75. <if test="createTime != null">#{createTime},</if>
  76. <if test="updateTime != null">#{updateTime},</if>
  77. <if test="companyId != null">#{companyId},</if>
  78. <if test="companyUserId != null">#{companyUserId},</if>
  79. <if test="qwUserId != null">#{qwUserId},</if>
  80. <if test="videoId != null">#{videoId},</if>
  81. <if test="corpId != null">#{corpId},</if>
  82. <if test="courseId != null">#{courseId},</if>
  83. <if test="qwExternalId != null">#{qwExternalId},</if>
  84. <if test="linkType != null">#{linkType},</if>
  85. <if test="isRoom != null">#{isRoom},</if>
  86. <if test="chatId != null">#{chatId},</if>
  87. </trim>
  88. </insert>
  89. <!-- <insert id="insertFsCourseLinkBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="linkId">-->
  90. <!-- INSERT INTO fs_course_link-->
  91. <!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
  92. <!-- <if test="courseLinks != null and courseLinks.size() &gt; 0">-->
  93. <!-- &lt;!&ndash; 假设所有日志对象的字段一致 &ndash;&gt;-->
  94. <!-- &lt;!&ndash; 动态生成列列表,基于第一个日志对象 &ndash;&gt;-->
  95. <!-- <foreach collection="courseLinks" item="item" index="index" open="" close="" separator="">-->
  96. <!-- <if test="index == 0">-->
  97. <!-- <if test="item.link != null">link,</if>-->
  98. <!-- <if test="item.realLink != null">real_link,</if>-->
  99. <!-- <if test="item.createTime != null">create_time,</if>-->
  100. <!-- <if test="item.updateTime != null">update_time,</if>-->
  101. <!-- <if test="item.companyId != null">company_id,</if>-->
  102. <!-- <if test="item.companyUserId != null">company_user_id,</if>-->
  103. <!-- <if test="item.qwUserId != null">qw_user_id,</if>-->
  104. <!-- <if test="item.videoId != null">video_id,</if>-->
  105. <!-- <if test="item.corpId != null">corp_id,</if>-->
  106. <!-- <if test="item.courseId != null">course_id,</if>-->
  107. <!-- <if test="item.qwExternalId != null">qw_external_id,</if>-->
  108. <!-- <if test="item.linkType != null">link_type,</if>-->
  109. <!-- <if test="item.isRoom != null">is_room,</if>-->
  110. <!-- </if>-->
  111. <!-- </foreach>-->
  112. <!-- </if>-->
  113. <!-- </trim>-->
  114. <!-- <trim prefix="VALUES">-->
  115. <!-- <foreach collection="courseLinks" item="item" separator=",">-->
  116. <!-- (<trim suffixOverrides=",">-->
  117. <!-- <if test="item.link != null">#{item.link},</if>-->
  118. <!-- <if test="item.realLink != null">#{item.realLink},</if>-->
  119. <!-- <if test="item.createTime != null">#{item.createTime},</if>-->
  120. <!-- <if test="item.updateTime != null">#{item.updateTime},</if>-->
  121. <!-- <if test="item.companyId != null">#{item.companyId},</if>-->
  122. <!-- <if test="item.companyUserId != null">#{item.companyUserId},</if>-->
  123. <!-- <if test="item.qwUserId != null">#{item.qwUserId},</if>-->
  124. <!-- <if test="item.videoId != null">#{item.videoId},</if>-->
  125. <!-- <if test="item.corpId != null">#{item.corpId},</if>-->
  126. <!-- <if test="item.courseId != null">#{item.courseId},</if>-->
  127. <!-- <if test="item.qwExternalId != null">#{item.qwExternalId},</if>-->
  128. <!-- <if test="item.linkType != null">#{item.linkType},</if>-->
  129. <!-- <if test="item.isRoom != null">#{item.isRoom},</if>-->
  130. <!-- </trim>)-->
  131. <!-- </foreach>-->
  132. <!-- </trim>-->
  133. <!-- </insert>-->
  134. <insert id="insertFsCourseLinkBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="linkId">
  135. INSERT INTO fs_course_link
  136. (
  137. link, real_link, create_time, update_time,
  138. company_id, company_user_id, qw_user_id, video_id,
  139. corp_id, course_id, qw_external_id, link_type,
  140. is_room,chat_id
  141. )
  142. VALUES
  143. <foreach collection="courseLinks" item="item" separator=",">
  144. (
  145. #{item.link,jdbcType=VARCHAR},
  146. #{item.realLink,jdbcType=VARCHAR},
  147. #{item.createTime,jdbcType=TIMESTAMP},
  148. #{item.updateTime,jdbcType=TIMESTAMP},
  149. #{item.companyId,jdbcType=BIGINT},
  150. #{item.companyUserId,jdbcType=BIGINT},
  151. #{item.qwUserId,jdbcType=VARCHAR},
  152. #{item.videoId,jdbcType=BIGINT},
  153. #{item.corpId,jdbcType=VARCHAR},
  154. #{item.courseId,jdbcType=BIGINT},
  155. #{item.qwExternalId,jdbcType=BIGINT},
  156. #{item.linkType,jdbcType=BIGINT},
  157. #{item.isRoom,jdbcType=VARCHAR},
  158. #{item.chatId,jdbcType=VARCHAR}
  159. )
  160. </foreach>
  161. </insert>
  162. <update id="updateFsCourseLink" parameterType="FsCourseLink">
  163. update fs_course_link
  164. <trim prefix="SET" suffixOverrides=",">
  165. <if test="link != null">link = #{link},</if>
  166. <if test="realLink != null">real_link = #{realLink},</if>
  167. <if test="createTime != null">create_time = #{createTime},</if>
  168. <if test="updateTime != null">update_time = #{updateTime},</if>
  169. <if test="companyId != null">company_id = #{companyId},</if>
  170. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  171. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  172. <if test="videoId != null">video_id = #{videoId},</if>
  173. <if test="corpId != null">corp_id = #{corpId},</if>
  174. <if test="courseId != null">course_id = #{courseId},</if>
  175. <if test="qwExternalId != null">qw_external_id = #{qwExternalId},</if>
  176. <if test="linkType != null">link_type = #{linkType},</if>
  177. <if test="isRoom != null">is_room = #{isRoom},</if>
  178. <if test="chatId != null">chat_id = #{chatId},</if>
  179. </trim>
  180. where link_id = #{linkId}
  181. </update>
  182. <delete id="deleteFsCourseLinkByLinkId" parameterType="Long">
  183. delete from fs_course_link where link_id = #{linkId}
  184. </delete>
  185. <delete id="deleteFsCourseLinkByLinkIds" parameterType="String">
  186. delete from fs_course_link where link_id in
  187. <foreach item="linkId" collection="array" open="(" separator="," close=")">
  188. #{linkId}
  189. </foreach>
  190. </delete>
  191. </mapper>