ClassGradeMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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.grade.mapper.ClassGradeMapper">
  6. <resultMap type="com.zhongzheng.modules.grade.domain.ClassGrade" id="ClassGradeResult">
  7. <result property="classId" column="class_id"/>
  8. <result property="classStatus" column="class_status"/>
  9. <result property="officialName" column="official_name"/>
  10. <result property="className" column="class_name"/>
  11. <result property="studentUpper" column="student_upper"/>
  12. <result property="learningTimeStart" column="learning_time_start"/>
  13. <result property="learningStatus" column="learning_status"/>
  14. <result property="status" column="status"/>
  15. <result property="classStartTime" column="class_start_time"/>
  16. <result property="classEndTime" column="class_end_time"/>
  17. <result property="examineId" column="examine_id"/>
  18. <result property="areasId" column="areas_id"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="sysUserId" column="sys_user_id"/>
  22. <result property="interfacePushId" column="interface_push_id"/>
  23. <result property="remark" column="remark"/>
  24. <result property="interfaceAccountId" column="interface_account_id"/>
  25. <result property="interfacePeriodId" column="interface_period_id"/>
  26. </resultMap>
  27. <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeVo" id="ClassGradeVoResult">
  28. <result property="classId" column="class_id"/>
  29. <result property="classStatus" column="class_status"/>
  30. <result property="officialName" column="official_name"/>
  31. <result property="className" column="class_name"/>
  32. <result property="studentUpper" column="student_upper"/>
  33. <result property="learningTimeStart" column="learning_time_start"/>
  34. <result property="learningStatus" column="learning_status"/>
  35. <result property="status" column="status"/>
  36. <result property="classStartTime" column="class_start_time"/>
  37. <result property="classEndTime" column="class_end_time"/>
  38. <result property="examineId" column="examine_id"/>
  39. <result property="areasId" column="areas_id"/>
  40. <result property="sysUserId" column="sys_user_id"/>
  41. <result property="interfacePushId" column="interface_push_id"/>
  42. <result property="remark" column="remark"/>
  43. <result property="interfaceAccountId" column="interface_account_id"/>
  44. <result property="interfacePeriodId" column="interface_period_id"/>
  45. <result property="interfaceAccountName" column="interface_account_name"/>
  46. <result property="interfacePeriodName" column="interface_period_name"/>
  47. <result property="interfacePushName" column="interface_push_name"/>
  48. <result property="studentNum" column="student_num"/>
  49. </resultMap>
  50. <resultMap type="com.zhongzheng.modules.goods.vo.GoodsVo" id="GoodsResultVo">
  51. <result property="goodsId" column="goods_id"/>
  52. <result property="year" column="year"/>
  53. <result property="supplyId" column="supply_id"/>
  54. <result property="goodsType" column="goods_type"/>
  55. <result property="educationTypeId" column="education_type_id"/>
  56. <result property="businessId" column="business_id"/>
  57. <result property="schoolId" column="school_id"/>
  58. <result property="majorId" column="major_id"/>
  59. <result property="goodsName" column="goods_name"/>
  60. <result property="standPrice" column="stand_price"/>
  61. <result property="lowestPrice" column="lowest_price"/>
  62. <result property="createTime" column="create_time"/>
  63. <result property="updateTime" column="update_time"/>
  64. <result property="status" column="status"/>
  65. <result property="validityStartTime" column="validity_start_time"/>
  66. <result property="validityEndTime" column="validity_end_time"/>
  67. <result property="studyStartTime" column="study_start_time"/>
  68. <result property="studyEndTime" column="study_end_time"/>
  69. <result property="certificateIds" column="certificate_ids"/>
  70. <result property="introduce" column="introduce"/>
  71. <result property="suitableObject" column="suitable_object"/>
  72. <result property="buyNote" column="buy_note"/>
  73. <result property="pcDetailHtml" column="pc_detail_html"/>
  74. <result property="mobileDetailHtml" column="mobile_detail_html"/>
  75. <result property="goodsStatus" column="goods_status"/>
  76. <result property="coverUrl" column="cover_url"/>
  77. <result property="classHours" column="class_hours"/>
  78. <result property="standPriceJson" column="stand_price_json"/>
  79. <result property="code" column="code"/>
  80. <result property="projectId" column="project_id"/>
  81. <result property="goodsAuditionConfig" column="goods_audition_config"/>
  82. <result property="goodsPhotographConfig" column="goods_photograph_config"/>
  83. <result property="goodsPlayConfig" column="goods_play_config"/>
  84. <result property="goodsExamConfig" column="goods_exam_config"/>
  85. <result property="supplyName" column="supply_name"/>
  86. <result property="educationName" column="education_name"/>
  87. <result property="projectName" column="project_name"/>
  88. <result property="businessName" column="business_name"/>
  89. <result property="schoolName" column="school_name"/>
  90. <result property="categoryName" column="category_name"/>
  91. <result property="handoutsId" column="handouts_id"/>
  92. <result property="templateType" column="template_type"/>
  93. </resultMap>
  94. <select id="queryList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeQueryBo" resultMap="ClassGradeVoResult">
  95. SELECT
  96. g.*,
  97. (SELECT name FROM class_grade_interface i where g.interface_push_id = i.id) as interface_push_name,
  98. (SELECT name FROM class_grade_interface i where g.interface_account_id = i.id) as interface_account_name,
  99. (SELECT name FROM class_grade_interface i where g.interface_period_id = i.id) as interface_period_name,
  100. (SELECT nick_name FROM sys_user u where g.sys_user_id = u.user_id) as nick_name,
  101. (SELECT area_name FROM apply_areas a where a.area_id = g.areas_id) as area_name,
  102. (SELECT area_name FROM apply_areas a where a.area_id = g.city_id) as city_name,
  103. (SELECT COUNT(a.id) FROM class_grade_user a where a.grade_id = g.class_id and a.status =1) as student_num
  104. FROM
  105. class_grade g
  106. where 1=1
  107. <if test="status != null and status.size()!=0 ">
  108. AND g.status in
  109. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  110. #{item}
  111. </foreach>
  112. </if>
  113. <if test="classId != null and classId !=0 ">
  114. AND g.class_id = #{classId}
  115. </if>
  116. <if test="className != null and className !='' ">
  117. AND g.class_name like concat('%', #{className}, '%')
  118. </if>
  119. <if test="classStartTime != null and classStartTime !=0 ">
  120. AND #{classStartTime} BETWEEN g.class_start_time and g.class_end_time or #{classEndTime} BETWEEN g.class_start_time and g.class_end_time
  121. </if>
  122. <if test="educationTypeId != null and educationTypeId !='' ">
  123. AND (
  124. SELECT
  125. COUNT(*)
  126. FROM
  127. class_grade_goods s
  128. LEFT JOIN goods d ON s.goods_id = d.goods_id
  129. WHERE
  130. 1 = 1
  131. AND g.class_id = s.grade_id
  132. AND d.education_type_id =#{educationTypeId}
  133. ) >0
  134. </if>
  135. <if test="businessId != null and businessId !='' ">
  136. AND (
  137. SELECT
  138. COUNT(*)
  139. FROM
  140. class_grade_goods s
  141. LEFT JOIN goods d ON s.goods_id = d.goods_id
  142. WHERE
  143. 1 = 1
  144. AND g.class_id = s.grade_id
  145. AND d.business_id =#{businessId}
  146. ) >0
  147. </if>
  148. <if test="schoolId != null and schoolId !='' ">
  149. AND (
  150. SELECT
  151. COUNT(*)
  152. FROM
  153. class_grade_goods s
  154. LEFT JOIN goods d ON s.goods_id = d.goods_id
  155. WHERE
  156. 1 = 1
  157. AND g.class_id = s.grade_id
  158. AND d.school_id =#{schoolId}
  159. ) >0
  160. </if>
  161. <if test="majorId != null and majorId !='' ">
  162. AND (
  163. SELECT
  164. COUNT(*)
  165. FROM
  166. class_grade_goods s
  167. LEFT JOIN goods d ON s.goods_id = d.goods_id
  168. WHERE
  169. 1 = 1
  170. AND g.class_id = s.grade_id
  171. AND d.major_id =#{majorId}
  172. ) >0
  173. </if>
  174. order by g.update_time desc
  175. </select>
  176. <select id="queryGoodsList" parameterType="Long" resultMap="GoodsResultVo">
  177. SELECT
  178. g.*,
  179. ps.supply_name,
  180. cet.education_name,
  181. cpt.project_name,
  182. cb.business_name,
  183. s.school_name,
  184. m.category_name,
  185. ot.type AS template_type
  186. FROM
  187. goods g
  188. LEFT JOIN pay_supply ps ON g.supply_id = ps.supply_id
  189. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  190. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  191. LEFT JOIN course_business cb ON g.business_id = cb.id
  192. LEFT JOIN school s ON s.id = g.school_id
  193. LEFT JOIN major m ON g.major_id = m.id
  194. LEFT JOIN order_input_template ot ON cb.template_status = ot.id
  195. LEFT JOIN class_grade_goods o ON o.goods_id = g.goods_id
  196. WHERE
  197. 1 = 1
  198. AND o.grade_id =#{classId}
  199. </select>
  200. </mapper>