TextbookMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.TextbookMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.textbook.dto.TextbookPageDto"
  7. resultType="com.xjrsoft.module.textbook.vo.TextbookPageVo">
  8. SELECT t1.id,t1.sort_code,t1.issn,t1.book_name,t1.publishing_house,t1.editor_in_chief,
  9. t1.subject_group_id,t2.group_name,t3.name AS semester_name,t4.name AS course_name,t7.name AS
  10. is_textbook_plan_cn,
  11. t5.name AS
  12. textbook_type_cn,t1.specifications_models,t1.appraisal_price,t1.price,t1.discount,t1.subtotal,t1.stock,
  13. (SELECT GROUP_CONCAT(c2.name) FROM textbook_class_relation c1
  14. LEFT JOIN base_class c2 ON c1.class_id = c2.id
  15. WHERE c1.textbook_id = t1.id) AS use_class,
  16. t6.name AS use_grade,t1.version FROM textbook t1
  17. LEFT JOIN subject_group t2 ON t1.subject_group_id = t2.id
  18. LEFT JOIN base_semester t3 ON t1.base_semester_id = t3.id
  19. LEFT JOIN base_course_subject t4 ON t1.course_subject_id = t4.id
  20. LEFT JOIN xjr_dictionary_detail t5 ON t1.textbook_type = t5.code AND t5.item_id = 1739209191193636865
  21. LEFT JOIN base_grade t6 ON t1.grade_id = t6.id
  22. LEFT JOIN xjr_dictionary_detail t7 ON t1.is_textbook_plan = t7.code AND t7.item_id = 1737360269850038273
  23. WHERE t1.delete_mark = 0
  24. <if test="dto.textbookType != null and dto.textbookType != ''">
  25. and t1.textbook_type = #{dto.textbookType}
  26. </if>
  27. <if test="dto.baseSemesterId != null">
  28. and t1.base_semester_id = #{dto.baseSemesterId}
  29. </if>
  30. <if test="dto.subjectGroupId != null">
  31. and t1.subject_group_id = #{dto.subjectGroupId}
  32. </if>
  33. <if test="dto.courseSubjectId != null">
  34. and t1.course_subject_id = #{dto.courseSubjectId}
  35. </if>
  36. <if test="dto.bookName != null and dto.bookName != ''">
  37. and t1.book_name like concat('%',#{dto.bookName}, '%')
  38. </if>
  39. <if test="dto.isTextbookPlan != null and dto.isTextbookPlan != ''">
  40. and t1.is_textbook_plan = #{dto.isTextbookPlan}
  41. </if>
  42. <if test="dto.issn != null and dto.issn != ''">
  43. and t1.issn like concat('%', #{dto.issn}, '%')
  44. </if>
  45. <if test="dto.editorInChief != null and dto.editorInChief != ''">
  46. and t1.editor_in_chief like concat('%', #{dto.editorInChief}, '%')
  47. </if>
  48. <if test="dto.publishingHouse != null and dto.publishingHouse != ''">
  49. and t1.publishing_house like concat('%', #{dto.publishingHouse}, '%')
  50. </if>
  51. </select>
  52. <select id="subscriptionList" resultType="com.xjrsoft.module.textbook.vo.TextbookSubscriptionRecordVo">
  53. SELECT t2.create_date,
  54. t4.name AS applicant_user,
  55. t3.issn,
  56. t3.book_name,
  57. t3.publishing_house,
  58. t3.editor_in_chief,
  59. t3.appraisal_price,
  60. t5.name AS is_textbook_plan_cn,
  61. t6.name AS course_name,
  62. t3.student_subscription_number,
  63. t3.teacher_subscription_number,
  64. t3.teacher_reference_number,
  65. t7.name AS is_support_resources_cn,
  66. t3.version,
  67. t3.class_ids
  68. FROM textbook_subscription_record t1
  69. LEFT JOIN wf_textbook_subscription t2 ON t1.wf_textbook_subscription_id = t2.id
  70. LEFT JOIN wf_textbook_subscription_item t3 ON t3.wf_textbook_subscription_id = t2.id
  71. LEFT JOIN xjr_user t4 ON t2.applicant_user_id = t4.id
  72. LEFT JOIN xjr_dictionary_detail t5
  73. ON t3.is_textbook_plan = t5.code AND t5.item_id = 1737360269850038273
  74. LEFT JOIN base_course_subject t6 ON t3.course_subject_id = t6.id
  75. LEFT JOIN xjr_dictionary_detail t7
  76. ON t3.is_support_resources = t7.code AND t7.item_id = 1737360269850038273
  77. WHERE t1.delete_mark = 0
  78. AND t1.textbook_id = #{id}
  79. </select>
  80. <select id="getClassInfo" resultType="com.xjrsoft.module.textbook.vo.TextbookSubscriptionClassVo">
  81. SELECT NAME FROM base_class WHERE id IN
  82. <foreach item="classId" index="index" collection="ids" open="(" close=")" separator=",">
  83. #{classId}
  84. </foreach>
  85. </select>
  86. <select id="getInfoByissn" resultType="com.xjrsoft.module.textbook.vo.TextbookVo">
  87. SELECT *
  88. FROM textbook
  89. WHERE delete_mark = 0
  90. AND issn = #{issn}
  91. order by create_date desc limit 0,1
  92. </select>
  93. <select id="warehouseList" resultType="com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordListVo">
  94. SELECT t1.create_date AS warehouse_date, t2.name AS warehouse_user, t1.warehouse_number, t1.source
  95. FROM textbook_warehouse_record t1
  96. LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
  97. WHERE t1.delete_mark = 0
  98. AND t1.textbook_id = #{id}
  99. order by t1.sort_code
  100. </select>
  101. <select id="issueList" resultType="com.xjrsoft.module.textbook.vo.TextbookIssueRecordListVo">
  102. SELECT t1.create_date AS issue_date, t2.name AS issue_user, t1.issue_number, t6.name AS issue_mode, t1.remark
  103. FROM textbook_issue_record t1
  104. LEFT JOIN xjr_user t2 ON t1.create_user_id = t2.id
  105. LEFT JOIN wf_textbook_claim_item t3 ON t1.data_item_id = t3.id
  106. LEFT JOIN wf_textbook_recede_item t4 ON t3.textbook_id = t4.textbook_id
  107. LEFT JOIN wf_textbook_recede t5 ON t5.id = t4.wf_textbook_recede_id
  108. LEFT JOIN xjr_dictionary_detail t6 ON t6.code = t1.issue_mode AND t6.item_id = 1739821685805215745
  109. WHERE t1.delete_mark = 0
  110. AND t3.textbook_id = #{id}
  111. ORDER BY t1.sort_code;
  112. </select>
  113. <select id="claimList" resultType="com.xjrsoft.module.textbook.vo.WfTextbookClaimListVo">
  114. SELECT t2.name AS semester_name,
  115. t5.name AS claim_identity,
  116. t3.name AS class_name,
  117. t5.name,
  118. t5.user_name,
  119. t4.create_date
  120. FROM wf_textbook_claim t1
  121. LEFT JOIN base_semester t2 ON t1.base_semester_id = t2.id
  122. LEFT JOIN base_class t3 ON t1.class_id = t3.id
  123. LEFT JOIN textbook_issue_record t4 ON t4.wf_textbook_claim_id = t1.id
  124. LEFT JOIN xjr_user t5 ON t4.receive_user_id = t5.id
  125. LEFT JOIN xjr_user_role_relation t6 ON t5.id = t6.user_id
  126. LEFT JOIN xjr_role t7 ON t6.role_id = t7.id
  127. LEFT JOIN wf_textbook_claim_item t8 ON t8.wf_textbook_claim_id = t1.id
  128. where t1.delete_mark = 0
  129. and t8.delete_mark = 0
  130. and t8.textbook_id = #{id}
  131. and t1.status = 1
  132. </select>
  133. <select id="getClassRelation" resultType="com.xjrsoft.module.textbook.entity.TextbookClassRelation">
  134. SELECT *
  135. FROM textbook_class_relation
  136. WHERE delete_mark = 0
  137. AND textbook_id = #{id}
  138. </select>
  139. </mapper>