IndexMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.IndexDao">
  8. <select id="getStudentSignUpData" resultType="com.ym.mec.biz.dal.entity.IndexBaseMonthData">
  9. SELECT
  10. DATE_FORMAT( create_time_, '%Y-%m' ) month,
  11. COUNT( id_ ) totalNum,
  12. COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END) activateNum,
  13. TRUNCATE(COUNT(CASE WHEN password_ IS NOT NULL THEN id_ ELSE NULL END)/COUNT( id_ )*100, 2) percent
  14. FROM
  15. sys_user
  16. WHERE
  17. del_flag_=0
  18. AND user_type_ LIKE '%STUDENT%'
  19. <if test="organIds!=null and organIds.size()>0">
  20. AND organ_id_ IN
  21. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  22. #{organIds}
  23. </foreach>
  24. </if>
  25. <if test="startMonth!=null and startMonth!=''">
  26. AND DATE_FORMAT(create_time_, '%Y-%m')&gt;=#{startMonth}
  27. </if>
  28. <if test="endMonth!=null and endMonth!=''">
  29. AND DATE_FORMAT(create_time_, '%Y-%m')&lt;=#{endMonth}
  30. </if>
  31. GROUP BY month
  32. ORDER BY month;
  33. </select>
  34. <select id="getHomeworkDate" resultType="com.ym.mec.biz.dal.entity.IndexBaseMonthData">
  35. SELECT
  36. DATE_FORMAT(sees.monday_, '%Y-%m') month,
  37. <choose>
  38. <when test="type == 'submit'">
  39. SUM(sees.expect_exercises_num_) totalNum,
  40. SUM(sees.exercises_reply_num_) activateNum,
  41. TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
  42. </when>
  43. <when test="type == 'comment'">
  44. SUM(sees.expect_exercises_num_) totalNum,
  45. SUM(sees.exercises_reply_num_) activateNum,
  46. TRUNCATE(SUM(sees.exercises_reply_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
  47. </when>
  48. <otherwise>
  49. SUM(sees.expect_exercises_num_) totalNum,
  50. SUM(sees.actual_exercises_num_) activateNum,
  51. TRUNCATE(SUM(sees.actual_exercises_num_)/SUM(sees.expect_exercises_num_)*100, 2) percent
  52. </otherwise>
  53. </choose>
  54. FROM student_extracurricular_exercises_situation_ sees
  55. LEFT JOIN sys_user su ON sees.student_id_=su.id_
  56. WHERE su.del_flag_=0
  57. <if test="organIds!=null and organIds.size()>0">
  58. AND su.organ_id_ IN
  59. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  60. #{organIds}
  61. </foreach>
  62. </if>
  63. <if test="startMonth!=null and startMonth!=''">
  64. AND DATE_FORMAT(sees.monday_, '%Y-%m')&gt;=#{startMonth}
  65. </if>
  66. <if test="endMonth!=null and endMonth!=''">
  67. AND DATE_FORMAT(sees.monday_, '%Y-%m')&lt;=#{endMonth}
  68. </if>
  69. GROUP BY month
  70. ORDER BY month
  71. </select>
  72. </mapper>