FsUserCoursePeriodMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.FsUserCoursePeriodMapper">
  6. <resultMap type="FsUserCoursePeriod" id="FsUserCoursePeriodResult">
  7. <result property="periodId" column="period_id" />
  8. <result property="periodName" column="period_name" />
  9. <result property="companyId" column="company_id" />
  10. <result property="courseId" column="course_id" />
  11. <result property="videoId" column="video_id" />
  12. <result property="trainingCampId" column="training_camp_id" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateTime" column="update_time" />
  15. <result property="courseStyle" column="course_style" />
  16. <result property="liveRoomStyle" column="live_room_style" />
  17. <result property="redPacketGrantMethod" column="red_packet_grant_method" />
  18. <result property="periodType" column="period_type" />
  19. <result property="periodStartingTime" column="period_starting_time" />
  20. <result property="periodEndTime" column="period_end_time" />
  21. </resultMap>
  22. <sql id="selectFsUserCoursePeriodVo">
  23. select period_id, period_name, company_id, course_id, video_id, training_camp_id, create_time, update_time, course_style, live_room_style, red_packet_grant_method, period_type, period_starting_time, period_end_time from fs_user_course_period
  24. </sql>
  25. <select id="selectFsUserCoursePeriodList" parameterType="FsUserCoursePeriod" resultMap="FsUserCoursePeriodResult">
  26. <include refid="selectFsUserCoursePeriodVo"/>
  27. <where>
  28. <if test="periodName != null and periodName != ''"> and period_name like concat('%', #{periodName}, '%')</if>
  29. <if test="companyId != null "> and company_id = #{companyId}</if>
  30. <if test="courseId != null "> and course_id = #{courseId}</if>
  31. <if test="videoId != null "> and video_id = #{videoId}</if>
  32. <if test="trainingCampId != null "> and training_camp_id = #{trainingCampId}</if>
  33. <if test="courseStyle != null and courseStyle != ''"> and course_style = #{courseStyle}</if>
  34. <if test="liveRoomStyle != null and liveRoomStyle != ''"> and live_room_style = #{liveRoomStyle}</if>
  35. <if test="redPacketGrantMethod != null "> and red_packet_grant_method = #{redPacketGrantMethod}</if>
  36. <if test="periodType != null "> and period_type = #{periodType}</if>
  37. <if test="periodStartingTime != null "> and period_starting_time = #{periodStartingTime}</if>
  38. <if test="periodEndTime != null "> and period_end_time = #{periodEndTime}</if>
  39. </where>
  40. </select>
  41. <select id="selectFsUserCoursePeriodPage" parameterType="FsUserCoursePeriod" resultType="FsUserCoursePeriodVO">
  42. SELECT
  43. period_id,
  44. period_name,
  45. fs_user_course_period.company_id,
  46. course_id,
  47. video_id,
  48. training_camp_id,
  49. fs_user_course_period.create_time,
  50. fs_user_course_period.update_time,
  51. course_style,
  52. live_room_style,
  53. red_packet_grant_method,
  54. period_type,
  55. period_starting_time,
  56. GROUP_CONCAT( company.company_name ) AS companyName
  57. FROM
  58. fs_user_course_period
  59. LEFT JOIN company ON fs_user_course_period.company_id = company.company_id
  60. <where>
  61. <if test="periodName != null and periodName != ''"> and period_name like concat('%', #{periodName}, '%')</if>
  62. <if test="companyIdList != null and companyIdList.size() > 0 ">
  63. and fs_user_course_period.company_id in
  64. <foreach item="companyId" index="index" collection="companyIdList"
  65. open="(" separator="," close=")">
  66. #{companyId}
  67. </foreach>
  68. </if>
  69. <if test="periodStartingTime != null "> and period_starting_time = #{periodStartingTime}</if>
  70. <if test="periodEndTime != null "> and period_end_time = #{periodEndTime}</if>
  71. </where>
  72. </select>
  73. <select id="selectFsUserCoursePeriodById" parameterType="Long" resultMap="FsUserCoursePeriodResult">
  74. <include refid="selectFsUserCoursePeriodVo"/>
  75. where period_id = #{periodId}
  76. </select>
  77. <insert id="insertFsUserCoursePeriod" parameterType="FsUserCoursePeriod">
  78. insert into fs_user_course_period
  79. <trim prefix="(" suffix=")" suffixOverrides=",">
  80. <if test="periodId != null">period_id,</if>
  81. <if test="periodName != null">period_name,</if>
  82. <if test="companyId != null">company_id,</if>
  83. <if test="courseId != null">course_id,</if>
  84. <if test="videoId != null">video_id,</if>
  85. <if test="trainingCampId != null">training_camp_id,</if>
  86. <if test="createTime != null">create_time,</if>
  87. <if test="updateTime != null">update_time,</if>
  88. <if test="courseStyle != null">course_style,</if>
  89. <if test="liveRoomStyle != null">live_room_style,</if>
  90. <if test="redPacketGrantMethod != null">red_packet_grant_method,</if>
  91. <if test="periodType != null">period_type,</if>
  92. <if test="periodStartingTime != null">period_starting_time,</if>
  93. <if test="periodEndTime != null">period_end_time,</if>
  94. </trim>
  95. <trim prefix="values (" suffix=")" suffixOverrides=",">
  96. <if test="periodId != null">#{periodId},</if>
  97. <if test="periodName != null">#{periodName},</if>
  98. <if test="companyId != null">#{companyId},</if>
  99. <if test="courseId != null">#{courseId},</if>
  100. <if test="videoId != null">#{videoId},</if>
  101. <if test="trainingCampId != null">#{trainingCampId},</if>
  102. <if test="createTime != null">#{createTime},</if>
  103. <if test="updateTime != null">#{updateTime},</if>
  104. <if test="courseStyle != null">#{courseStyle},</if>
  105. <if test="liveRoomStyle != null">#{liveRoomStyle},</if>
  106. <if test="redPacketGrantMethod != null">#{redPacketGrantMethod},</if>
  107. <if test="periodType != null">#{periodType},</if>
  108. <if test="periodStartingTime != null">#{periodStartingTime},</if>
  109. <if test="periodEndTime != null">#{periodEndTime},</if>
  110. </trim>
  111. </insert>
  112. <update id="updateFsUserCoursePeriod" parameterType="FsUserCoursePeriod">
  113. update fs_user_course_period
  114. <trim prefix="SET" suffixOverrides=",">
  115. <if test="periodName != null">period_name = #{periodName},</if>
  116. <if test="companyId != null">company_id = #{companyId},</if>
  117. <if test="courseId != null">course_id = #{courseId},</if>
  118. <if test="videoId != null">video_id = #{videoId},</if>
  119. <if test="trainingCampId != null">training_camp_id = #{trainingCampId},</if>
  120. <if test="createTime != null">create_time = #{createTime},</if>
  121. <if test="updateTime != null">update_time = #{updateTime},</if>
  122. <if test="courseStyle != null">course_style = #{courseStyle},</if>
  123. <if test="liveRoomStyle != null">live_room_style = #{liveRoomStyle},</if>
  124. <if test="redPacketGrantMethod != null">red_packet_grant_method = #{redPacketGrantMethod},</if>
  125. <if test="periodType != null">period_type = #{periodType},</if>
  126. <if test="periodStartingTime != null">period_starting_time = #{periodStartingTime},</if>
  127. <if test="periodEndTime != null">period_end_time = #{periodEndTime},</if>
  128. </trim>
  129. where period_id = #{periodId}
  130. </update>
  131. <delete id="deleteFsUserCoursePeriodById" parameterType="Long">
  132. delete from fs_user_course_period where period_id = #{periodId}
  133. </delete>
  134. <delete id="deleteFsUserCoursePeriodByIds" parameterType="String">
  135. delete from fs_user_course_period where period_id in
  136. <foreach item="periodId" collection="array" open="(" separator="," close=")">
  137. #{periodId}
  138. </foreach>
  139. </delete>
  140. </mapper>