IndexBaseMonthDataMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.IndexBaseMonthDataDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.IndexBaseMonthData" id="IndexBaseMonthData">
  9. <result column="id_" property="id" />
  10. <result column="month_" property="month" />
  11. <result column="organ_id_" property="organId" />
  12. <result column="total_num_" property="totalNum" />
  13. <result column="activate_num_" property="activateNum" />
  14. <result column="percent_" property="percent" />
  15. <result column="data_type_" property="dataType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  16. <result column="create_time_" property="createTime" />
  17. <result column="update_time_" property="updateTime" />
  18. </resultMap>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="IndexBaseMonthData" >
  21. SELECT * FROM index_base_month_data WHERE id_ = #{id}
  22. </select>
  23. <!-- 全查询 -->
  24. <select id="findAll" resultMap="IndexBaseMonthData">
  25. SELECT * FROM index_base_month_data ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  29. <!--
  30. <selectKey resultClass="int" keyProperty="id" >
  31. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  32. </selectKey>
  33. -->
  34. INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
  35. VALUES(#{month},#{organId},#{totalNum},#{activateNum},#{percent},#{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
  36. </insert>
  37. <insert id="batchInsertWithDataType" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  38. INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
  39. VALUES
  40. <foreach collection="datas" item="data" separator=",">
  41. (#{data.month},#{data.organId},#{data.totalNum},#{data.activateNum},#{data.percent},
  42. #{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
  43. </foreach>
  44. </insert>
  45. <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  46. INSERT INTO index_base_month_data (month_,organ_id_,total_num_,activate_num_,percent_,data_type_,create_time_,update_time_)
  47. VALUES
  48. <foreach collection="datas" item="data" separator=",">
  49. (#{data.month},#{data.organId},#{data.totalNum},#{data.activateNum},#{data.percent},
  50. #{data.dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(),NOW())
  51. </foreach>
  52. </insert>
  53. <!-- 根据主键查询一条记录 -->
  54. <update id="update" parameterType="com.ym.mec.biz.dal.entity.IndexBaseMonthData">
  55. UPDATE index_base_month_data <set>
  56. <if test="organId != null">
  57. organ_id_ = #{organId},
  58. </if>
  59. <if test="id != null">
  60. id_ = #{id},
  61. </if>
  62. <if test="activateNum != null">
  63. activate_num_ = #{activateNum},
  64. </if>
  65. <if test="totalNum != null">
  66. total_num_ = #{totalNum},
  67. </if>
  68. <if test="percent != null">
  69. percent_ = #{percent},
  70. </if>
  71. <if test="month != null">
  72. month_ = #{month},
  73. </if>
  74. <if test="dataType != null">
  75. data_type_ = #{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  76. </if>
  77. update_time_ = NOW()
  78. </set> WHERE id_ = #{id}
  79. </update>
  80. <!-- 根据主键删除一条记录 -->
  81. <delete id="delete" >
  82. DELETE FROM index_base_month_data WHERE id_ = #{id}
  83. </delete>
  84. <delete id="deleteWithMonthAndType">
  85. DELETE FROM index_base_month_data
  86. WHERE DATE_FORMAT(month_, '%Y-%m-%d') IN
  87. <foreach collection="months" item="month" open="(" close=")" separator=",">
  88. #{month}
  89. </foreach>
  90. <if test="dataType!=null">
  91. AND data_type_=#{dataType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  92. </if>
  93. </delete>
  94. <!-- 分页查询 -->
  95. <select id="queryPage" resultMap="IndexBaseMonthData" parameterType="map">
  96. SELECT * FROM index_base_month_data ORDER BY id_ <include refid="global.limit"/>
  97. </select>
  98. <!-- 查询当前表的总记录数 -->
  99. <select id="queryCount" resultType="int">
  100. SELECT COUNT(*) FROM index_base_month_data
  101. </select>
  102. <select id="getIndexBaseData" resultMap="IndexBaseMonthData">
  103. SELECT
  104. month_,data_type_,SUM(total_num_) total_num_,SUM(activate_num_) activate_num_,SUM(percent_) percent_
  105. FROM index_base_month_data
  106. <where>
  107. <if test="dataTypes!=null and dataTypes.size()>0">
  108. AND data_type_ IN
  109. <foreach collection="dataTypes" item="dataType" open="(" close=")" separator=",">
  110. #{dataType}
  111. </foreach>
  112. </if>
  113. <if test="organIds!=null and organIds.size()>0">
  114. AND organ_id_ IN
  115. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  116. #{organId}
  117. </foreach>
  118. </if>
  119. <if test="startMonth!=null and startMonth!=''">
  120. AND DATE_FORMAT(month_, '%Y-%m')&gt;=#{startMonth}
  121. </if>
  122. <if test="endMonth!=null and endMonth!=''">
  123. AND DATE_FORMAT(month_, '%Y-%m')&lt;=#{endMonth}
  124. </if>
  125. </where>
  126. GROUP BY month_,data_type_
  127. </select>
  128. <select id="getStudentSignUpData" resultMap="IndexBaseMonthData">
  129. SELECT
  130. organ_id_,
  131. CONCAT(#{month}, '-01') month_,
  132. COUNT( id_ ) total_num_,
  133. COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activate_num_,
  134. TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent_
  135. FROM sys_user
  136. WHERE
  137. del_flag_=0
  138. AND organ_id_ IS NOT NULL
  139. AND user_type_ LIKE '%STUDENT%'
  140. AND DATE_FORMAT(create_time_, '%Y-%m')&lt;=#{month}
  141. GROUP BY organ_id_
  142. ORDER BY organ_id_;
  143. </select>
  144. <select id="getHomeworkData" resultMap="IndexBaseMonthData">
  145. SELECT
  146. su.organ_id_,
  147. CONCAT(#{month}, '-01') month_,
  148. <choose>
  149. <when test="type == 'submit'">
  150. SUM(sees.actual_exercises_num_) total_num_,
  151. SUM(sees.exercises_reply_num_) activate_num_,
  152. TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.actual_exercises_num_)*100, 2) percent_
  153. </when>
  154. <when test="type == 'comment'">
  155. SUM(sees.exercises_reply_num_) total_num_,
  156. SUM(sees.exercises_message_num_) activate_num_,
  157. TRUNCATE(SUM(sees.exercises_message_num_)/SUM(sees.exercises_reply_num_)*100, 2) percent_
  158. </when>
  159. <otherwise>
  160. SUM(sees.expect_exercises_num_) total_num_,
  161. SUM(sees.actual_exercises_num_) activate_num_,
  162. TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent_
  163. </otherwise>
  164. </choose>
  165. FROM student_extracurricular_exercises_situation_ sees
  166. LEFT JOIN sys_user su ON sees.student_id_=su.id_
  167. WHERE su.del_flag_=0
  168. AND su.organ_id_ IS NOT NULL
  169. AND YEAR(sees.monday_)=YEAR(CONCAT(#{month}, '-01'))
  170. AND MONTH(sees.monday_)=MONTH(CONCAT(#{month}, '-01'))
  171. GROUP BY su.organ_id_
  172. ORDER BY su.organ_id_
  173. </select>
  174. <select id="getSchoolData" resultMap="IndexBaseMonthData">
  175. SELECT
  176. organ_id_,
  177. CONCAT(#{month}, '-01') month_,
  178. COUNT( id_ ) total_num_,
  179. COUNT( id_ ) activate_num_,
  180. COUNT( id_ ) percent_
  181. FROM
  182. cooperation_organ
  183. WHERE
  184. del_flag_ = 0
  185. AND is_enable_ = 1
  186. AND organ_id_ IS NOT NULL
  187. <if test="month!=null and month!=''">
  188. AND DATE_FORMAT(create_time_, '%Y-%m') &lt;= #{month}
  189. </if>
  190. GROUP BY
  191. organ_id_
  192. ORDER BY
  193. organ_id_;
  194. </select>
  195. <select id="getMusicData" resultMap="IndexBaseMonthData">
  196. SELECT
  197. organ_id_,
  198. CONCAT(#{month}, '-01') month_,
  199. COUNT( id_ ) total_num_,
  200. COUNT( id_ ) activate_num_,
  201. COUNT( id_ ) percent_
  202. FROM
  203. music_group
  204. WHERE
  205. del_flag_ = 0
  206. AND status_ = 'PROGRESS'
  207. AND organ_id_ IS NOT NULL
  208. <if test="month!=null and month!=''">
  209. AND DATE_FORMAT(create_time_, '%Y-%m') &lt;= #{month}
  210. </if>
  211. GROUP BY
  212. organ_id_
  213. ORDER BY
  214. organ_id_;
  215. </select>
  216. <select id="getMusicStudentData" resultMap="IndexBaseMonthData">
  217. SELECT
  218. mg.organ_id_,
  219. CONCAT(#{month}, '-01') month_,
  220. COUNT( DISTINCT sr.user_id_ ) total_num_,
  221. COUNT( DISTINCT sr.user_id_ ) activate_num_,
  222. COUNT( DISTINCT sr.user_id_ ) percent_
  223. FROM student_registration sr
  224. LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_
  225. WHERE
  226. mg.del_flag_ = 0
  227. AND mg.organ_id_ IS NOT NULL
  228. AND mg.status_ = 'PROGRESS'
  229. <if test="type==null">
  230. AND sr.music_group_status_='NORMAL'
  231. </if>
  232. <if test="type!=null and type=='QUIT'">
  233. AND sr.music_group_status_='QUIT'
  234. AND DATE_FORMAT(sr.create_time_, '%Y-%m') &gt;= CONCAT(DATE_FORMAT(NOW(), '%Y'), '-01')
  235. </if>
  236. <if test="type!=null and type=='ADD'">
  237. AND sr.music_group_status_='NORMAL'
  238. AND DATE_FORMAT(sr.create_time_, '%Y-%m') &gt;= CONCAT(DATE_FORMAT(NOW(), '%Y'), '-01')
  239. </if>
  240. <if test="month!=null and month!=''">
  241. AND DATE_FORMAT(sr.create_time_, '%Y-%m') &lt;= #{month}
  242. </if>
  243. GROUP BY
  244. mg.organ_id_
  245. ORDER BY
  246. mg.organ_id_;
  247. </select>
  248. <select id="getTeacherData" resultMap="IndexBaseMonthData">
  249. SELECT
  250. t.organ_id_,
  251. CONCAT(#{month}, '-01') month_,
  252. COUNT( t.id_ ) total_num_,
  253. COUNT( t.id_ ) activate_num_,
  254. COUNT( t.id_ ) percent_
  255. FROM
  256. teacher t
  257. LEFT JOIN sys_user su ON su.id_ = t.id_
  258. WHERE
  259. su.del_flag_ = 0
  260. <if test="isDemission==null">
  261. AND su.lock_flag_ = 0
  262. </if>
  263. <if test="isDemission!=null">
  264. AND (su.lock_flag_ = 1 OR t.demission_date_ IS NOT NULL)
  265. </if>
  266. AND t.organ_id_ IS NOT NULL
  267. <if test="jobNature!=null">
  268. AND t.job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  269. </if>
  270. GROUP BY
  271. t.organ_id_
  272. ORDER BY
  273. t.organ_id_;
  274. </select>
  275. <select id="getGroupCourseData" resultMap="IndexBaseMonthData">
  276. SELECT
  277. m.organ_id_,
  278. CONCAT(#{month}, '-01') month_,
  279. COUNT( m.id_ ) total_num_,
  280. COUNT( m.id_ ) activate_num_,
  281. COUNT( m.id_ ) percent_
  282. FROM
  283. course_schedule m
  284. WHERE
  285. m.del_flag_ = 0
  286. AND (m.is_lock_ = 0 OR m.is_lock_ IS NULL)
  287. AND m.status_ = 'OVER'
  288. AND (m.new_course_id_ IS NULL OR m.new_course_id_=m.id_)
  289. AND m.organ_id_ IS NOT NULL
  290. <if test="groupType!=null">
  291. AND m.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  292. </if>
  293. <if test="month!=null and month!=''">
  294. AND DATE_FORMAT(m.class_date_, '%Y-%m') &lt;= #{month}
  295. </if>
  296. GROUP BY
  297. m.organ_id_
  298. ORDER BY
  299. m.organ_id_;
  300. </select>
  301. <select id="getOtherStudentData" resultMap="IndexBaseMonthData">
  302. SELECT
  303. su.organ_id_,
  304. CONCAT(#{month}, '-01') month_,
  305. COUNT( DISTINCT s.user_id_ ) total_num_,
  306. COUNT( DISTINCT s.user_id_ ) activate_num_,
  307. COUNT( DISTINCT s.user_id_ ) percent_
  308. FROM
  309. sys_user su
  310. LEFT JOIN course_schedule_student_payment s ON su.id_=s.user_id_
  311. LEFT JOIN course_schedule m ON s.course_schedule_id_=m.id_
  312. WHERE
  313. m.del_flag_ = 0
  314. AND (m.is_lock_ = 0 OR m.is_lock_ IS NULL)
  315. AND su.organ_id_ IS NOT NULL
  316. AND m.group_type_ IN ('VIP', 'PRACTICE')
  317. <if test="month!=null and month!=''">
  318. AND (DATE_FORMAT(m.create_time_, '%Y-%m') &lt;= #{month} OR YEAR(m.create_time_)=3000)
  319. </if>
  320. GROUP BY
  321. su.organ_id_
  322. ORDER BY
  323. su.organ_id_;
  324. </select>
  325. <select id="getStudentConversionData" resultMap="IndexBaseMonthData">
  326. SELECT
  327. cs.organ_id_,
  328. CONCAT( '2020-01', '-01' ) month_,
  329. COUNT( DISTINCT m.user_id_ ) total_num_,
  330. COUNT( DISTINCT m.user_id_ ) activate_num_,
  331. COUNT( DISTINCT m.user_id_ ) percent_
  332. FROM
  333. course_schedule_student_payment m
  334. LEFT JOIN course_schedule cs ON m.course_schedule_id_=cs.id_
  335. WHERE
  336. (cs.del_flag_ IS NULL OR cs.del_flag_=0)
  337. AND cs.organ_id_ IS NOT NULL
  338. AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
  339. AND m.group_type_ IN ('VIP', 'PRACTICE')
  340. AND m.user_id_ IN
  341. <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
  342. #{studentId}
  343. </foreach>
  344. GROUP BY
  345. cs.organ_id_
  346. ORDER BY
  347. cs.organ_id_;
  348. </select>
  349. <select id="getMusicGroupPreRegistrationStudentData" resultMap="IndexBaseMonthData">
  350. SELECT
  351. mg.organ_id_,
  352. CONCAT( #{month}, '-01' ) month_,
  353. COUNT( DISTINCT spr.user_id_ ) total_num_,
  354. COUNT( DISTINCT spr.user_id_ ) activate_num_,
  355. COUNT( DISTINCT spr.user_id_ ) percent_
  356. FROM
  357. student_pre_registration spr
  358. LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_
  359. WHERE
  360. mg.del_flag_ = 0
  361. AND mg.organ_id_ IS NOT NULL
  362. AND DATE_FORMAT( spr.create_time_, '%Y-%m' ) &lt;= #{month}
  363. GROUP BY
  364. mg.organ_id_
  365. ORDER BY
  366. mg.organ_id_;
  367. </select>
  368. <select id="getMusicGroupStudentFromPreData" resultMap="IndexBaseMonthData">
  369. SELECT
  370. mg.organ_id_,
  371. CONCAT( #{month}, '-01' ) month_,
  372. COUNT( DISTINCT sr.user_id_ ) total_num_,
  373. COUNT( DISTINCT sr.user_id_ ) activate_num_,
  374. COUNT( DISTINCT sr.user_id_ ) percent_
  375. FROM
  376. student_registration sr
  377. LEFT JOIN student_pre_registration spr ON sr.user_id_ = spr.user_id_ AND sr.music_group_id_ = spr.music_group_id_
  378. LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_
  379. WHERE
  380. mg.del_flag_ = 0
  381. AND mg.organ_id_ IS NOT NULL
  382. AND mg.status_ = 'PROGRESS'
  383. AND sr.music_group_status_ = 'NORMAL'
  384. <if test="paymentStatus!=null">
  385. AND sr.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  386. </if>
  387. AND DATE_FORMAT( sr.create_time_, '%Y-%m' ) &lt;= #{month}
  388. GROUP BY
  389. mg.organ_id_
  390. ORDER BY
  391. mg.organ_id_;
  392. </select>
  393. <select id="getMusicGroupStudentIdFromPre" resultType="int">
  394. SELECT
  395. sr.user_id_
  396. FROM
  397. student_registration sr
  398. LEFT JOIN student_pre_registration spr ON sr.user_id_ = spr.user_id_ AND sr.music_group_id_ = spr.music_group_id_
  399. LEFT JOIN music_group mg ON spr.music_group_id_ = mg.id_
  400. WHERE
  401. mg.del_flag_ = 0
  402. AND mg.organ_id_ IS NOT NULL
  403. AND mg.status_ = 'PROGRESS'
  404. <if test="paymentStatus!=null">
  405. AND sr.music_group_status_ = 'NORMAL'
  406. AND sr.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  407. </if>
  408. AND DATE_FORMAT( sr.create_time_, '%Y-%m' ) &lt;= #{month}
  409. </select>
  410. <select id="countLessThenThreeClassGroupNum" resultType="int">
  411. SELECT COUNT(t.id_) FROM (
  412. SELECT
  413. DISTINCT cg.id_
  414. FROM
  415. class_group cg
  416. LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
  417. LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
  418. WHERE
  419. cg.type_ = 'HIGH'
  420. AND mg.status_ = 'PROGRESS'
  421. AND cgsm.status_ = 'NORMAL'
  422. <if test="organIds!=null and organIds.size()>0">
  423. AND mg.organ_id_ IN
  424. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  425. #{organId}
  426. </foreach>
  427. </if>
  428. GROUP BY
  429. cg.id_
  430. HAVING
  431. COUNT( DISTINCT cgsm.user_id_ )&lt;3
  432. ) t
  433. </select>
  434. <select id="getLessThenThreeMusicGroup" resultType="java.lang.String">
  435. SELECT
  436. cg.music_group_id_
  437. FROM
  438. class_group cg
  439. LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
  440. LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
  441. WHERE
  442. cg.type_ = 'HIGH'
  443. AND mg.status_ = 'PROGRESS'
  444. AND cgsm.status_ = 'NORMAL'
  445. <if test="organIds!=null and organIds.size()>0">
  446. AND mg.organ_id_ IN
  447. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  448. #{organId}
  449. </foreach>
  450. </if>
  451. GROUP BY
  452. cg.id_
  453. HAVING
  454. COUNT( DISTINCT cgsm.user_id_ )&lt;3
  455. </select>
  456. <select id="countNoPaymentStudentNum" resultType="int">
  457. SELECT
  458. COUNT(DISTINCT mgpcd.user_id_)
  459. FROM
  460. music_group_payment_calender_detail mgpcd
  461. LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
  462. LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
  463. WHERE
  464. mg.status_ = 'PROGRESS'
  465. AND mgpc.payment_valid_end_date_ &lt; NOW()
  466. AND mgpcd.payment_status_ = 'NON_PAYMENT'
  467. <if test="organIds!=null and organIds.size()>0">
  468. AND mg.organ_id_ IN
  469. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  470. #{organId}
  471. </foreach>
  472. </if>
  473. </select>
  474. <select id="getNoPaymentMusicGroup" resultType="java.lang.String">
  475. SELECT
  476. DISTINCT mg.id_
  477. FROM
  478. music_group_payment_calender_detail mgpcd
  479. LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
  480. LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
  481. WHERE
  482. mg.status_ = 'PROGRESS'
  483. AND mgpc.payment_valid_end_date_ &lt; NOW()
  484. AND mgpcd.payment_status_ = 'NON_PAYMENT'
  485. <if test="organIds!=null and organIds.size()>0">
  486. AND mg.organ_id_ IN
  487. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  488. #{organId}
  489. </foreach>
  490. </if>
  491. </select>
  492. <select id="countApplyForQuitGroupNum" resultType="int">
  493. SELECT COUNT(mgq.id_) FROM music_group_quit mgq
  494. LEFT JOIN music_group mg ON mgq.music_group_id_=mg.id_
  495. WHERE mg.status_='PROGRESS'
  496. AND mgq.status_='PROCESSING'
  497. <if test="organIds!=null and organIds.size()>0">
  498. AND mg.organ_id_ IN
  499. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  500. #{organId}
  501. </foreach>
  502. </if>
  503. </select>
  504. <select id="countStudentAttendanceInfo" resultType="java.lang.Integer">
  505. SELECT
  506. COUNT( DISTINCT cssp.user_id_ )
  507. FROM
  508. course_schedule_student_payment cssp
  509. LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
  510. LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND sa.user_id_ = cssp.user_id_
  511. LEFT JOIN student_visit sv ON cssp.id_=sv.object_id_
  512. WHERE
  513. <if test="type!=null and type=='LEAVE'">
  514. (sa.status_ = 'LEAVE' AND sa.remark_ IS NOT NULL AND sv.id_ IS NULL)
  515. </if>
  516. <if test="type!=null and type=='TRUANT'">
  517. (sa.status_ = 'TRUANT' OR sa.id_ IS NULL)
  518. </if>
  519. <if test="organIds!=null and organIds.size()>0">
  520. AND cs.organ_id_ IN
  521. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  522. #{organId}
  523. </foreach>
  524. </if>
  525. </select>
  526. </mapper>