TextbookWarehouseRecordMapper.xml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 t8.class_id = #{dto.classId}
  54. </if>
  55. <if test="dto.bookName != null and dto.bookName != ''">
  56. and t3.book_name like concat('%',#{dto.bookName}, '%')
  57. </if>
  58. <if test="dto.issn != null and dto.issn != ''">
  59. and t3.issn = #{dto.issn}
  60. </if>
  61. <if test="dto.specificationsModels != null and dto.specificationsModels != ''">
  62. and t3.specifications_models like concat('%',#{dto.specificationsModels}, '%')
  63. </if>
  64. <if test="dto.isTextbookPlan != null and dto.isTextbookPlan != ''">
  65. and t3.is_textbook_plan = #{dto.isTextbookPlan}
  66. </if>
  67. ORDER BY t1.create_date desc
  68. </select>
  69. <select id="getList" parameterType="com.xjrsoft.module.textbook.dto.TextbookWarehouseRecordExportDto" resultType="com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordPageVo">
  70. SELECT t1.id, t1.sort_code, t3.issn,t3.book_name,t3.publishing_house,t3.editor_in_chief,t4.group_name,
  71. 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
  72. LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
  73. LEFT JOIN textbook t3 ON t1.textbook_id = t3.id
  74. LEFT JOIN subject_group t4 ON t3.subject_group_id = t4.id
  75. LEFT JOIN base_course_subject t5 ON t3.course_subject_id = t5.id
  76. LEFT JOIN xjr_dictionary_detail t6 ON t3.textbook_type = t6.code AND t6.item_id = 1739209191193636865
  77. WHERE t1.delete_mark = 0
  78. <if test="dto.ids != null and dto.ids.size() > 0">
  79. and t1.id in <foreach item="id" index="index" collection="dto.ids" open="(" close=")"
  80. separator=",">
  81. #{id}
  82. </foreach>
  83. </if>
  84. ORDER BY t1.create_date desc
  85. </select>
  86. </mapper>