UserTextbookEnrollRelationMapper.xml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. <mapper namespace="com.qxgmat.data.relation.UserTextbookEnrollRelationMapper">
  4. <resultMap id="IdMap" type="com.qxgmat.data.dao.entity.UserTextbookEnroll">
  5. <!--
  6. WARNING - @mbg.generated
  7. -->
  8. <id column="id" jdbcType="INTEGER" property="id" />
  9. </resultMap>
  10. <resultMap id="NumberMap" type="com.qxgmat.data.relation.entity.TextbookEnrollNumberRelation">
  11. <!--
  12. WARNING - @mbg.generated
  13. -->
  14. <id column="month" jdbcType="TIMESTAMP" property="month" />
  15. <id column="number" jdbcType="INTEGER" property="number" />
  16. </resultMap>
  17. <sql id="Id_Column_List">
  18. <!--
  19. WARNING - @mbg.generated
  20. -->
  21. ute.`id`
  22. </sql>
  23. <!--
  24. 统计报名人数
  25. -->
  26. <select id="groupByMonth" resultMap="NumberMap">
  27. select
  28. count(ute.`id`) as `number`, ute.`month` as `month`
  29. from `user_textbook_enrool` ute
  30. where 1
  31. <if test="startTime != null">
  32. and ute.`month` &gt; #{startTime,jdbcType=VARCHAR}
  33. </if>
  34. <if test="endTime != null">
  35. and ute.`month` &lt; #{endTime,jdbcType=VARCHAR}
  36. </if>
  37. </select>
  38. </mapper>