FsUserCourseCountMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.store.mapper.FsUserCourseCountMapper">
  6. <resultMap type="FsUserCourseCount" id="FsUserCourseCountResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="watchCourseCount" column="watch_course_count" />
  10. <result property="missCourseCount" column="miss_course_count" />
  11. <result property="missCourseStatus" column="miss_course_status" />
  12. <result property="missCourseDays" column="miss_course_days" />
  13. <result property="courseIds" column="course_idss" />
  14. <result property="partCourseCount" column="part_course_count" />
  15. <result property="lastWatchDate" column="last_watch_date" />
  16. <result property="status" column="status" />
  17. <result property="stopWatchDays" column="stop_watch_days" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="createBy" column="create_by" />
  21. <result property="updateBy" column="update_by" />
  22. <result property="completeWatchDate" column="complete_watch_date" />
  23. <result property="completeWatchCount" column="complete_watch_count" />
  24. <result property="watchTimes" column="watch_times" />
  25. </resultMap>
  26. <sql id="selectFsUserCourseCountVo">
  27. select id, user_id, watch_course_count, miss_course_count, miss_course_status, miss_course_days, course_ids, part_course_count, last_watch_date, status, stop_watch_days, create_time, update_time, create_by, update_by, complete_watch_date, complete_watch_count, watch_times from fs_user_course_count
  28. </sql>
  29. <select id="selectFsUserCourseCountList" parameterType="FsUserCourseCount" resultMap="FsUserCourseCountResult">
  30. <include refid="selectFsUserCourseCountVo"/>
  31. <where>
  32. <if test="userId != null "> and user_id = #{userId}</if>
  33. <if test="watchCourseCount != null "> and watch_course_count = #{watchCourseCount}</if>
  34. <if test="missCourseCount != null "> and miss_course_count = #{missCourseCount}</if>
  35. <if test="missCourseStatus != null "> and miss_course_status = #{missCourseStatus}</if>
  36. <if test="missCourseDays != null "> and miss_course_days = #{missCourseDays}</if>
  37. <if test="courseIds != null "> and course_ids = #{courseIds}</if>
  38. <if test="partCourseCount != null and partCourseCount != ''"> and part_course_count = #{partCourseCount}</if>
  39. <if test="lastWatchDate != null "> and last_watch_date = #{lastWatchDate}</if>
  40. <if test="status != null "> and status = #{status}</if>
  41. <if test="stopWatchDays != null "> and stop_watch_days = #{stopWatchDays}</if>
  42. <if test="completeWatchDate != null "> and complete_watch_date = #{completeWatchDate}</if>
  43. <if test="completeWatchCount != null "> and complete_watch_count = #{completeWatchCount}</if>
  44. <if test="watchTimes != null "> and watch_times = #{watchTimes}</if>
  45. </where>
  46. </select>
  47. <select id="selectFsUserCourseCountById" parameterType="Long" resultMap="FsUserCourseCountResult">
  48. <include refid="selectFsUserCourseCountVo"/>
  49. where id = #{id}
  50. </select>
  51. <select id="findByUserId" resultType="com.fs.store.domain.FsUserCourseCount">
  52. select * from fs_user_course_count where user_id = ${userId} limit 1
  53. </select>
  54. <insert id="insertFsUserCourseCount" parameterType="FsUserCourseCount">
  55. insert into fs_user_course_count
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="id != null">id,</if>
  58. <if test="userId != null">user_id,</if>
  59. <if test="watchCourseCount != null">watch_course_count,</if>
  60. <if test="missCourseCount != null">miss_course_count,</if>
  61. <if test="missCourseStatus != null">miss_course_status,</if>
  62. <if test="missCourseDays != null">miss_course_days,</if>
  63. <if test="courseIds != null">course_ids,</if>
  64. <if test="partCourseCount != null">part_course_count,</if>
  65. <if test="lastWatchDate != null">last_watch_date,</if>
  66. <if test="status != null">status,</if>
  67. <if test="stopWatchDays != null">stop_watch_days,</if>
  68. <if test="createTime != null">create_time,</if>
  69. <if test="updateTime != null">update_time,</if>
  70. <if test="createBy != null">create_by,</if>
  71. <if test="updateBy != null">update_by,</if>
  72. <if test="completeWatchDate != null">complete_watch_date,</if>
  73. <if test="completeWatchCount != null">complete_watch_count,</if>
  74. <if test="watchTimes != null">watch_times,</if>
  75. </trim>
  76. <trim prefix="values (" suffix=")" suffixOverrides=",">
  77. <if test="id != null">#{id},</if>
  78. <if test="userId != null">#{userId},</if>
  79. <if test="watchCourseCount != null">#{watchCourseCount},</if>
  80. <if test="missCourseCount != null">#{missCourseCount},</if>
  81. <if test="missCourseStatus != null">#{missCourseStatus},</if>
  82. <if test="missCourseDays != null">#{missCourseDays},</if>
  83. <if test="courseIds != null">#{courseIds},</if>
  84. <if test="partCourseCount != null">#{partCourseCount},</if>
  85. <if test="lastWatchDate != null">#{lastWatchDate},</if>
  86. <if test="status != null">#{status},</if>
  87. <if test="stopWatchDays != null">#{stopWatchDays},</if>
  88. <if test="createTime != null">#{createTime},</if>
  89. <if test="updateTime != null">#{updateTime},</if>
  90. <if test="createBy != null">#{createBy},</if>
  91. <if test="updateBy != null">#{updateBy},</if>
  92. <if test="completeWatchDate != null">#{completeWatchDate},</if>
  93. <if test="completeWatchCount != null">#{completeWatchCount},</if>
  94. <if test="watchTimes != null">#{watchTimes},</if>
  95. </trim>
  96. </insert>
  97. <update id="updateFsUserCourseCount" parameterType="FsUserCourseCount">
  98. update fs_user_course_count
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="userId != null">user_id = #{userId},</if>
  101. <if test="watchCourseCount != null">watch_course_count = #{watchCourseCount},</if>
  102. <if test="missCourseCount != null">miss_course_count = #{missCourseCount},</if>
  103. <if test="missCourseStatus != null">miss_course_status = #{missCourseStatus},</if>
  104. <if test="missCourseDays != null">miss_course_days = #{missCourseDays},</if>
  105. <if test="courseIds != null">course_ids = #{courseIds},</if>
  106. <if test="partCourseCount != null">part_course_count = #{partCourseCount},</if>
  107. <if test="lastWatchDate != null">last_watch_date = #{lastWatchDate},</if>
  108. <if test="status != null">status = #{status},</if>
  109. <if test="stopWatchDays != null">stop_watch_days = #{stopWatchDays},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="updateTime != null">update_time = #{updateTime},</if>
  112. <if test="createBy != null">create_by = #{createBy},</if>
  113. <if test="updateBy != null">update_by = #{updateBy},</if>
  114. <if test="completeWatchDate != null">complete_watch_date = #{completeWatchDate},</if>
  115. <if test="completeWatchCount != null">complete_watch_count = #{completeWatchCount},</if>
  116. <if test="watchTimes != null">watch_times = #{watchTimes},</if>
  117. </trim>
  118. where id = #{id}
  119. </update>
  120. <delete id="deleteFsUserCourseCountById" parameterType="Long">
  121. delete from fs_user_course_count where id = #{id}
  122. </delete>
  123. <delete id="deleteFsUserCourseCountByIds" parameterType="String">
  124. delete from fs_user_course_count where id in
  125. <foreach item="id" collection="array" open="(" separator="," close=")">
  126. #{id}
  127. </foreach>
  128. </delete>
  129. </mapper>