StudentRegistrationMapper.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.web.dal.dao.StudentRegistrationDao">
  8. <resultMap type="com.ym.mec.web.dal.entity.StudentRegistration" id="StudentRegistration">
  9. <result column="id_" property="id"/>
  10. <result column="user_id_" property="userId"/>
  11. <result column="music_group_id_" property="musicGroupId"/>
  12. <result column="current_grade_" property="currentGrade"/>
  13. <result column="current_class_" property="currentClass"/>
  14. <result column="subject_id_" property="subjectId"/>
  15. <result column="actual_subject_id_" property="actualSubjectId"/>
  16. <result column="is_allow_adjust_" property="isAllowAdjust" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  17. <result column="kit_purchase_method_" property="kitPurchaseMethod" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  18. <result column="remark_" property="remark"/>
  19. <result column="create_time_" property="createTime"/>
  20. <result column="update_time_" property="updateTime"/>
  21. <result column="parents_name_" property="parentsName"/>
  22. <result column="parents_phone_" property="parentsPhone"/>
  23. <result column="parents_company_" property="parentsCompany"/>
  24. <result column="payment_status_" property="paymentStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  25. <result column="last_payment_date_" property="lastPaymentDate"/>
  26. <result column="next_payment_date_" property="nextPaymentDate"/>
  27. </resultMap>
  28. <!-- 根据主键查询一条记录 -->
  29. <select id="get" resultMap="StudentRegistration">
  30. SELECT * FROM student_registration WHERE id_ = #{id}
  31. </select>
  32. <!-- 全查询 -->
  33. <select id="findAll" resultMap="StudentRegistration">
  34. SELECT * FROM student_registration ORDER BY id_
  35. </select>
  36. <!-- 向数据库增加一条记录 -->
  37. <insert id="insert" parameterType="com.ym.mec.web.dal.entity.StudentRegistration" useGeneratedKeys="true"
  38. keyColumn="id" keyProperty="id">
  39. INSERT INTO student_registration
  40. (parents_phone_,id_,user_id_,music_group_id_,current_grade_,current_class_,subject_id_,is_allow_adjust_,kit_purchase_method_,remark_,create_time_,update_time_,parents_name_,parents_company_,payment_status_,last_payment_date_,next_payment_date_,actual_subject_id_)
  41. VALUES(#{parentsPhone},#{id},#{userId},#{musicGroupId},#{currentGrade},#{currentClass},#{subjectId},#{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  42. #{remark},now(),now(),#{parentsName},#{parentsCompany},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{lastPaymentDate},#{nextPaymentDate},#{subjectId})
  43. </insert>
  44. <!-- 根据主键查询一条记录 -->
  45. <update id="update" parameterType="com.ym.mec.web.dal.entity.StudentRegistration">
  46. UPDATE student_registration
  47. <set>
  48. <if test="parentsPhone != null">
  49. parents_phone_ = #{parentsPhone},
  50. </if>
  51. <if test="subjectId != null">
  52. subject_id_ = #{subjectId},
  53. </if>
  54. <if test="nextPaymentDate != null">
  55. next_payment_date_ = #{nextPaymentDate},
  56. </if>
  57. <if test="currentGrade != null">
  58. current_grade_ = #{currentGrade},
  59. </if>
  60. <if test="lastPaymentDate != null">
  61. last_payment_date_ = #{lastPaymentDate},
  62. </if>
  63. <if test="currentClass != null">
  64. current_class_ = #{currentClass},
  65. </if>
  66. <if test="isAllowAdjust != null">
  67. is_allow_adjust_ = #{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  68. </if>
  69. <if test="kitPurchaseMethod != null">
  70. kit_purchase_method_ = #{kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  71. </if>
  72. <if test="userId != null">
  73. user_id_ = #{userId},
  74. </if>
  75. <if test="remark != null">
  76. remark_ = #{remark},
  77. </if>
  78. <if test="paymentStatus != null">
  79. payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  80. </if>
  81. <if test="parentsName != null">
  82. parents_name_ = #{parentsName},
  83. </if>
  84. <if test="updateTime != null">
  85. update_time_ = #{updateTime},
  86. </if>
  87. <if test="parentsCompany != null">
  88. parents_company_ = #{parentsCompany},
  89. </if>
  90. <if test="musicGroupId != null">
  91. music_group_id_ = #{musicGroupId},
  92. </if>
  93. <if test="actualSubjectId != null">
  94. actual_subject_id_ = #{actualSubjectId},
  95. </if>
  96. </set>
  97. WHERE id_ = #{id}
  98. </update>
  99. <!-- 根据主键删除一条记录 -->
  100. <delete id="delete">
  101. DELETE FROM student_registration WHERE id_ = #{id}
  102. </delete>
  103. <sql id="queryPageSql">
  104. <where>
  105. <if test="isAllowAdjust != null">
  106. AND is_allow_adjust_ = #{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  107. </if>
  108. <if test="subjectId != null">
  109. AND subject_id_ = #{subjectId}
  110. </if>
  111. </where>
  112. </sql>
  113. <!-- 分页查询 -->
  114. <select id="queryPage" resultMap="StudentRegistration" parameterType="map">
  115. SELECT * FROM student_registration ORDER BY id_
  116. <include refid="global.limit"/>
  117. </select>
  118. <!-- 查询当前表的总记录数 -->
  119. <select id="queryCount" resultType="int">
  120. SELECT COUNT(*) FROM student_registration
  121. </select>
  122. <sql id="queryStudentDetailPageSql">
  123. <where>
  124. <if test="musicGroupId != null">
  125. sr.music_group_id_ = #{musicGroupId}
  126. </if>
  127. <if test="subjectId != null">
  128. sr.subject_id_ = #{subjectId}
  129. </if>
  130. <if test="isAllowAdjust != null">
  131. sr.is_allow_adjust_ = #{isAllowAdjust}
  132. </if>
  133. <if test="actualSubjectId != null">
  134. sr.actual_subject_id_ = #{actualSubjectId}
  135. </if>
  136. </where>
  137. </sql>
  138. <resultMap type="com.ym.mec.web.dal.dto.StudentApplyDetailDto" id="studentApplyDetail">
  139. <result column="current_grade_" property="currentGrade"/>
  140. <result column="current_class_" property="currentClass"/>
  141. <result column="is_allow_adjust_" property="isAllowAdjust" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  142. <result column="parents_name_" property="parentsName"/>
  143. <result column="parents_phone_" property="parentsPhone"/>
  144. <result column="subject_name_" property="subjectName"/>
  145. <result column="username_" property="studentName"/>
  146. <result column="actual_subject_name_" property="actualSubjectName"/>
  147. <result column="gender_" property="gender" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  148. </resultMap>
  149. <select id="queryStudentDetailPage" resultMap="studentApplyDetail">
  150. SELECT su.username_,sr.parents_name_,sr.current_class_,sr.current_grade_,
  151. su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_ actual_subject_name_,sr.parents_phone_
  152. FROM student_registration sr
  153. LEFT JOIN sys_user su ON sr.subject_id_ = su.id_
  154. LEFT JOIN `subject` s ON sr.subject_id_ = s.id_
  155. LEFT JOIN `subject` ss ON sr.actual_subject_id_ = s.id_
  156. <include refid="queryStudentDetailPageSql"/>
  157. <include refid="global.limit"/>
  158. </select>
  159. <select id="queryStudentDetailCount" resultType="java.lang.Integer">
  160. SELECT COUNT(sr.id_) FROM student_registration sr
  161. <include refid="queryStudentDetailPageSql"/>
  162. </select>
  163. <select id="countPayNum" resultType="java.lang.Integer">
  164. SELECT COUNT(DISTINCT user_id_) FROM student_registration
  165. WHERE music_group_id_ = #{musicGroupId} AND subject_id_ = #{subjectId} AND payment_status_ = 1
  166. </select>
  167. <resultMap id="queryFeeDetailMap" type="com.ym.mec.web.dal.dto.StudentFeeDto">
  168. <result column="deposit_fee_" property="depositFee"/>
  169. <result column="course_fee_" property="courseFee"/>
  170. <result column="musical_fee_" property="musicalFee"/>
  171. <result column="total_amount_" property="totalAmount"/>
  172. </resultMap>
  173. <select id="queryFeeDetail" resultMap="queryFeeDetailMap">
  174. </select>
  175. </mapper>