TextbookWarehouseRecordMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.xjrsoft.module.textbook.mapper.TextbookWarehouseRecordMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.textbook.dto.TextbookWarehouseRecordPageDto" resultType="com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordPageVo">
  7. SELECT t1.id,
  8. t1.sort_code,
  9. t1.price,
  10. t1.discount,
  11. t3.issn,
  12. t3.book_name,
  13. t3.publishing_house,
  14. t3.editor_in_chief,
  15. t4.group_name,
  16. t5.name AS course_name,
  17. t6.name AS textbook_type_cn,
  18. t3.specifications_models,
  19. t1.create_date,
  20. t2.name AS warehouse_user,
  21. t1.warehouse_number,
  22. t9.name as baseSemesterIdCn,
  23. (SELECT GROUP_CONCAT(c2.name)
  24. FROM textbook_class_relation c1
  25. LEFT JOIN base_class c2 ON c1.class_id = c2.id
  26. WHERE c1.textbook_id = t1.textbook_id) AS use_class,
  27. t7.name AS use_grade
  28. FROM textbook_warehouse_record t1
  29. LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
  30. LEFT JOIN textbook t3 ON t1.textbook_id = t3.id
  31. LEFT JOIN subject_group t4 ON t3.subject_group_id = t4.id
  32. LEFT JOIN base_course_subject t5 ON t3.course_subject_id = t5.id
  33. LEFT JOIN xjr_dictionary_detail t6 ON t3.textbook_type = t6.code AND t6.item_id = 1739209191193636865
  34. LEFT JOIN base_grade t7 ON t3.grade_id = t7.id
  35. LEFT JOIN base_semester t9 ON t9.id = t3.base_semester_id
  36. WHERE t1.delete_mark = 0
  37. <if test="dto.textbookType != null and dto.textbookType != ''">
  38. and t3.textbook_type = #{dto.textbookType}
  39. </if>
  40. <if test="dto.baseSemesterId != null">
  41. and t3.base_semester_id = #{dto.baseSemesterId}
  42. </if>
  43. <if test="dto.publishingHouse != null">
  44. and t3.publishing_house = like concat('%',#{dto.publishingHouse}, '%')
  45. </if>
  46. <if test="dto.subjectGroupId != null">
  47. and t3.subject_group_id = #{dto.subjectGroupId}
  48. </if>
  49. <if test="dto.courseSubjectId != null">
  50. and t3.course_subject_id = #{dto.courseSubjectId}
  51. </if>
  52. <if test="dto.classId != null">
  53. and t1.textbook_id in (
  54. SELECT textbook_id
  55. FROM textbook_class_relation
  56. WHERE class_id = #{dto.classId}
  57. )
  58. </if>
  59. <if test="dto.bookName != null and dto.bookName != ''">
  60. and t3.book_name like concat('%',#{dto.bookName}, '%')
  61. </if>
  62. <if test="dto.issn != null and dto.issn != ''">
  63. and t3.issn = #{dto.issn}
  64. </if>
  65. <if test="dto.specificationsModels != null and dto.specificationsModels != ''">
  66. and t3.specifications_models like concat('%',#{dto.specificationsModels}, '%')
  67. </if>
  68. <if test="dto.isTextbookPlan != null and dto.isTextbookPlan != ''">
  69. and t3.is_textbook_plan = #{dto.isTextbookPlan}
  70. </if>
  71. ORDER BY t1.create_date desc
  72. </select>
  73. <select id="getList" parameterType="com.xjrsoft.module.textbook.dto.TextbookWarehouseRecordExportDto" resultType="com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordPageVo">
  74. SELECT t1.id, t1.sort_code, t3.issn,t3.book_name,t3.publishing_house,t3.editor_in_chief,t4.group_name,
  75. t5.name AS course_name,t6.name AS textbook_type_cn,t3.specifications_models,t1.create_date,t2.name AS warehouse_user,t1.warehouse_number FROM textbook_warehouse_record t1
  76. LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
  77. LEFT JOIN textbook t3 ON t1.textbook_id = t3.id
  78. LEFT JOIN subject_group t4 ON t3.subject_group_id = t4.id
  79. LEFT JOIN base_course_subject t5 ON t3.course_subject_id = t5.id
  80. LEFT JOIN xjr_dictionary_detail t6 ON t3.textbook_type = t6.code AND t6.item_id = 1739209191193636865
  81. WHERE t1.delete_mark = 0
  82. <if test="dto.ids != null and dto.ids.size() > 0">
  83. and t1.id in <foreach item="id" index="index" collection="dto.ids" open="(" close=")"
  84. separator=",">
  85. #{id}
  86. </foreach>
  87. </if>
  88. ORDER BY t1.create_date desc
  89. </select>
  90. </mapper>