UserNoteMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.zhongzheng.modules.user.mapper.UserNoteMapper">
  6. <resultMap type="com.zhongzheng.modules.user.domain.UserNote" id="UserNoteResult">
  7. <result property="noteId" column="note_id"/>
  8. <result property="noteText" column="note_text"/>
  9. <result property="noteDate" column="note_date"/>
  10. <result property="courseId" column="course_id"/>
  11. <result property="sectionId" column="section_id"/>
  12. <result property="goodsId" column="goods_id"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="moduleId" column="module_id"/>
  16. <result property="chapterId" column="chapter_id"/>
  17. <result property="gradeId" column="grade_id"/>
  18. </resultMap>
  19. <resultMap type="com.zhongzheng.modules.user.vo.UserNoteVo" id="UserNoteVo">
  20. <result property="noteId" column="note_id"/>
  21. <result property="noteText" column="note_text"/>
  22. <result property="noteDate" column="note_date"/>
  23. <result property="courseId" column="course_id"/>
  24. <result property="sectionId" column="section_id"/>
  25. <result property="goodsId" column="goods_id"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="moduleId" column="module_id"/>
  28. <result property="chapterId" column="chapter_id"/>
  29. <result property="gradeId" column="grade_id"/>
  30. <result property="sectionName" column="section_name"/>
  31. <result property="recordingUrl" column="recording_url"/>
  32. </resultMap>
  33. <resultMap type="com.zhongzheng.modules.user.vo.UserDateNoteVo" id="UserDateNoteVo">
  34. <result property="dateNote" column="date_note"/>
  35. </resultMap>
  36. <select id="listDate" parameterType="com.zhongzheng.modules.user.bo.UserNoteQueryBo" resultMap="UserDateNoteVo">
  37. SELECT
  38. DISTINCT un.note_date as date_note
  39. FROM
  40. user_note un
  41. WHERE 1=1
  42. AND un.status = 1
  43. <if test="goodsId != null and goodsId !='' ">
  44. AND un.goods_id=#{goodsId}
  45. </if>
  46. <!-- <if test="moduleId != null and moduleId !='' ">-->
  47. <!-- AND un.module_id=#{moduleId}-->
  48. <!-- </if>-->
  49. <!-- <if test="courseId != null and courseId !='' ">-->
  50. <!-- AND un.course_id =#{courseId}-->
  51. <!-- </if>-->
  52. <!-- <if test="sectionId != null and sectionId !='' ">-->
  53. <!-- AND un.section_id =#{sectionId}-->
  54. <!-- </if>-->
  55. <!-- <if test="chapterId != null and chapterId !='' ">-->
  56. <!-- AND un.chapter_id =#{chapterId}-->
  57. <!-- </if>-->
  58. <if test="gradeId != null and gradeId !='' ">
  59. AND un.grade_id =#{gradeId}
  60. </if>
  61. <if test="userId != null and userId !='' ">
  62. AND un.user_id =#{userId}
  63. </if>
  64. order by un.note_date desc
  65. </select>
  66. <select id="listDateSon" parameterType="com.zhongzheng.modules.user.bo.UserNoteQueryBo" resultMap="UserNoteVo">
  67. SELECT
  68. un.*,
  69. (SELECT cs.`name` FROM course_section cs where cs.section_id = un.section_id) as section_name,
  70. (SELECT cs.recording_url FROM course_section cs where cs.section_id = un.section_id) as recording_url
  71. FROM
  72. user_note un
  73. WHERE 1=1
  74. AND un.status = 1
  75. <if test="goodsId != null and goodsId !='' ">
  76. AND un.goods_id=#{goodsId}
  77. </if>
  78. <!-- <if test="moduleId != null and moduleId !='' ">-->
  79. <!-- AND un.module_id=#{moduleId}-->
  80. <!-- </if>-->
  81. <!-- <if test="courseId != null and courseId !='' ">-->
  82. <!-- AND un.course_id =#{courseId}-->
  83. <!-- </if>-->
  84. <!-- <if test="sectionId != null and sectionId !='' ">-->
  85. <!-- AND un.section_id =#{sectionId}-->
  86. <!-- </if>-->
  87. <!-- <if test="chapterId != null and chapterId !='' ">-->
  88. <!-- AND un.chapter_id =#{chapterId}-->
  89. <!-- </if>-->
  90. <if test="gradeId != null and gradeId !='' ">
  91. AND un.grade_id =#{gradeId}
  92. </if>
  93. <if test="userId != null and userId !='' ">
  94. AND un.user_id =#{userId}
  95. </if>
  96. <if test="noteDate != null and noteDate !='' ">
  97. AND un.note_date =#{noteDate}
  98. </if>
  99. order by un.note_date desc
  100. </select>
  101. </mapper>