FsCourseLinkMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. <insert id="insertFsCourseLink" parameterType="FsCourseLink" useGeneratedKeys="true" keyProperty="linkId">
  46. insert into fs_course_link
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="link != null">link,</if>
  49. <if test="realLink != null">real_link,</if>
  50. <if test="createTime != null">create_time,</if>
  51. <if test="updateTime != null">update_time,</if>
  52. <if test="companyId != null">company_id,</if>
  53. <if test="companyUserId != null">company_user_id,</if>
  54. <if test="qwUserId != null">qw_user_id,</if>
  55. <if test="videoId != null">video_id,</if>
  56. <if test="corpId != null">corp_id,</if>
  57. <if test="courseId != null">course_id,</if>
  58. <if test="qwExternalId != null">qw_external_id,</if>
  59. <if test="linkType != null">link_type,</if>
  60. <if test="isRoom != null">is_room,</if>
  61. <if test="chatId != null">chat_id,</if>
  62. </trim>
  63. <trim prefix="values (" suffix=")" suffixOverrides=",">
  64. <if test="link != null">#{link},</if>
  65. <if test="realLink != null">#{realLink},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. <if test="companyId != null">#{companyId},</if>
  69. <if test="companyUserId != null">#{companyUserId},</if>
  70. <if test="qwUserId != null">#{qwUserId},</if>
  71. <if test="videoId != null">#{videoId},</if>
  72. <if test="corpId != null">#{corpId},</if>
  73. <if test="courseId != null">#{courseId},</if>
  74. <if test="qwExternalId != null">#{qwExternalId},</if>
  75. <if test="linkType != null">#{linkType},</if>
  76. <if test="isRoom != null">#{isRoom},</if>
  77. <if test="chatId != null">#{chatId},</if>
  78. </trim>
  79. </insert>
  80. <!-- <insert id="insertFsCourseLinkBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="linkId">-->
  81. <!-- INSERT INTO fs_course_link-->
  82. <!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
  83. <!-- <if test="courseLinks != null and courseLinks.size() &gt; 0">-->
  84. <!-- &lt;!&ndash; 假设所有日志对象的字段一致 &ndash;&gt;-->
  85. <!-- &lt;!&ndash; 动态生成列列表,基于第一个日志对象 &ndash;&gt;-->
  86. <!-- <foreach collection="courseLinks" item="item" index="index" open="" close="" separator="">-->
  87. <!-- <if test="index == 0">-->
  88. <!-- <if test="item.link != null">link,</if>-->
  89. <!-- <if test="item.realLink != null">real_link,</if>-->
  90. <!-- <if test="item.createTime != null">create_time,</if>-->
  91. <!-- <if test="item.updateTime != null">update_time,</if>-->
  92. <!-- <if test="item.companyId != null">company_id,</if>-->
  93. <!-- <if test="item.companyUserId != null">company_user_id,</if>-->
  94. <!-- <if test="item.qwUserId != null">qw_user_id,</if>-->
  95. <!-- <if test="item.videoId != null">video_id,</if>-->
  96. <!-- <if test="item.corpId != null">corp_id,</if>-->
  97. <!-- <if test="item.courseId != null">course_id,</if>-->
  98. <!-- <if test="item.qwExternalId != null">qw_external_id,</if>-->
  99. <!-- <if test="item.linkType != null">link_type,</if>-->
  100. <!-- <if test="item.isRoom != null">is_room,</if>-->
  101. <!-- </if>-->
  102. <!-- </foreach>-->
  103. <!-- </if>-->
  104. <!-- </trim>-->
  105. <!-- <trim prefix="VALUES">-->
  106. <!-- <foreach collection="courseLinks" item="item" separator=",">-->
  107. <!-- (<trim suffixOverrides=",">-->
  108. <!-- <if test="item.link != null">#{item.link},</if>-->
  109. <!-- <if test="item.realLink != null">#{item.realLink},</if>-->
  110. <!-- <if test="item.createTime != null">#{item.createTime},</if>-->
  111. <!-- <if test="item.updateTime != null">#{item.updateTime},</if>-->
  112. <!-- <if test="item.companyId != null">#{item.companyId},</if>-->
  113. <!-- <if test="item.companyUserId != null">#{item.companyUserId},</if>-->
  114. <!-- <if test="item.qwUserId != null">#{item.qwUserId},</if>-->
  115. <!-- <if test="item.videoId != null">#{item.videoId},</if>-->
  116. <!-- <if test="item.corpId != null">#{item.corpId},</if>-->
  117. <!-- <if test="item.courseId != null">#{item.courseId},</if>-->
  118. <!-- <if test="item.qwExternalId != null">#{item.qwExternalId},</if>-->
  119. <!-- <if test="item.linkType != null">#{item.linkType},</if>-->
  120. <!-- <if test="item.isRoom != null">#{item.isRoom},</if>-->
  121. <!-- </trim>)-->
  122. <!-- </foreach>-->
  123. <!-- </trim>-->
  124. <!-- </insert>-->
  125. <insert id="insertFsCourseLinkBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="linkId">
  126. INSERT INTO fs_course_link
  127. (
  128. link, real_link, create_time, update_time,
  129. company_id, company_user_id, qw_user_id, video_id,
  130. corp_id, course_id, qw_external_id, link_type,
  131. is_room
  132. )
  133. VALUES
  134. <foreach collection="courseLinks" item="item" separator=",">
  135. (
  136. #{item.link,jdbcType=VARCHAR},
  137. #{item.realLink,jdbcType=VARCHAR},
  138. #{item.createTime,jdbcType=TIMESTAMP},
  139. #{item.updateTime,jdbcType=TIMESTAMP},
  140. #{item.companyId,jdbcType=BIGINT},
  141. #{item.companyUserId,jdbcType=BIGINT},
  142. #{item.qwUserId,jdbcType=VARCHAR},
  143. #{item.videoId,jdbcType=BIGINT},
  144. #{item.corpId,jdbcType=VARCHAR},
  145. #{item.courseId,jdbcType=BIGINT},
  146. #{item.qwExternalId,jdbcType=BIGINT},
  147. #{item.linkType,jdbcType=BIGINT},
  148. #{item.isRoom,jdbcType=VARCHAR}
  149. )
  150. </foreach>
  151. </insert>
  152. <update id="updateFsCourseLink" parameterType="FsCourseLink">
  153. update fs_course_link
  154. <trim prefix="SET" suffixOverrides=",">
  155. <if test="link != null">link = #{link},</if>
  156. <if test="realLink != null">real_link = #{realLink},</if>
  157. <if test="createTime != null">create_time = #{createTime},</if>
  158. <if test="updateTime != null">update_time = #{updateTime},</if>
  159. <if test="companyId != null">company_id = #{companyId},</if>
  160. <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
  161. <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
  162. <if test="videoId != null">video_id = #{videoId},</if>
  163. <if test="corpId != null">corp_id = #{corpId},</if>
  164. <if test="courseId != null">course_id = #{courseId},</if>
  165. <if test="qwExternalId != null">qw_external_id = #{qwExternalId},</if>
  166. <if test="linkType != null">link_type = #{linkType},</if>
  167. <if test="isRoom != null">is_room = #{isRoom},</if>
  168. <if test="chatId != null">chat_id = #{chatId},</if>
  169. </trim>
  170. where link_id = #{linkId}
  171. </update>
  172. <delete id="deleteFsCourseLinkByLinkId" parameterType="Long">
  173. delete from fs_course_link where link_id = #{linkId}
  174. </delete>
  175. <delete id="deleteFsCourseLinkByLinkIds" parameterType="String">
  176. delete from fs_course_link where link_id in
  177. <foreach item="linkId" collection="array" open="(" separator="," close=")">
  178. #{linkId}
  179. </foreach>
  180. </delete>
  181. </mapper>