ExamNoteMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.exam.mapper.ExamNoteMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamNote" id="ExamNoteResult">
  7. <result property="fileId" column="file_id"/>
  8. <result property="categoryId" column="category_id"/>
  9. <result property="name" column="name"/>
  10. <result property="teacherIds" column="teacher_ids"/>
  11. <result property="price" column="price"/>
  12. <result property="coverUrl" column="cover_url"/>
  13. <result property="introduction" column="introduction"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="updateTime" column="update_time"/>
  16. <result property="status" column="status"/>
  17. <result property="fileUrls" column="file_urls"/>
  18. <result property="sort" column="sort"/>
  19. <result property="categoryName" column="category_name"/>
  20. </resultMap>
  21. <select id="selectExamNoteList" parameterType="com.zhongzheng.modules.exam.bo.ExamNoteQueryBo" resultMap="ExamNoteResult">
  22. SELECT en.*,mc.category_name from exam_note en LEFT JOIN major_category mc on en.category_id = mc.category_id
  23. <if test="status != null and status.size()!=0 ">
  24. WHERE en.status in
  25. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  26. #{item}
  27. </foreach>
  28. </if>
  29. <if test="name != null and name != ''">
  30. AND en.name like concat('%', #{name}, '%')
  31. </if>
  32. <if test="categoryId != null and categoryId != ''">
  33. AND en.category_id = #{categoryId}
  34. </if>
  35. </select>
  36. <select id="queryRecommendList" parameterType="com.zhongzheng.modules.exam.bo.ExamNoteQueryBo" resultMap="ExamNoteResult">
  37. SELECT
  38. file_id,name,cover_url,price
  39. FROM
  40. exam_note
  41. WHERE
  42. STATUS = 1
  43. <if test="fileId != null and fileId != ''">
  44. AND file_id != #{fileId}
  45. </if>
  46. ORDER BY
  47. RAND()
  48. LIMIT 4
  49. </select>
  50. </mapper>