123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <!--
- 这个文件是自动生成的。
- 不要修改此文件。所有改动将在下次重新自动生成时丢失。
- -->
- <mapper namespace="com.ym.mec.biz.dal.dao.StudentRegistrationDao">
- <resultMap type="com.ym.mec.biz.dal.entity.StudentRegistration" id="StudentRegistration">
- <result column="id_" property="id"/>
- <result column="user_id_" property="userId"/>
- <result column="name_" property="name"/>
- <result column="music_group_id_" property="musicGroupId"/>
- <result column="current_grade_" property="currentGrade"/>
- <result column="current_class_" property="currentClass"/>
- <result column="subject_id_" property="subjectId"/>
- <result column="actual_subject_id_" property="actualSubjectId"/>
- <result column="is_allow_adjust_" property="isAllowAdjust"
- typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="kit_purchase_method_" property="kitPurchaseMethod"
- typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="remark_" property="remark"/>
- <result column="class_group_id_" property="classGroupId"/>
- <result column="create_time_" property="createTime"/>
- <result column="update_time_" property="updateTime"/>
- <result column="parents_name_" property="parentsName"/>
- <result column="parents_phone_" property="parentsPhone"/>
- <result column="parents_company_" property="parentsCompany"/>
- <result column="payment_status_" property="paymentStatus"
- typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="last_payment_date_" property="lastPaymentDate"/>
- <result column="next_payment_date_" property="nextPaymentDate"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="StudentRegistration">
- SELECT * FROM student_registration WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="StudentRegistration">
- SELECT *
- FROM student_registration
- ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration" useGeneratedKeys="true"
- keyColumn="id" keyProperty="id">
- INSERT INTO student_registration
- (parents_phone_,id_,user_id_,name_,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_)
- VALUES(#{parentsPhone},#{id},#{userId},#{name},#{musicGroupId},#{currentGrade},#{currentClass},#{subjectId},#{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{remark},now(),now(),#{parentsName},#{parentsCompany},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{lastPaymentDate},#{nextPaymentDate},#{subjectId})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration">
- UPDATE student_registration
- <set>
- <if test="parentsPhone != null">
- parents_phone_ = #{parentsPhone},
- </if>
- <if test="subjectId != null">
- subject_id_ = #{subjectId},
- </if>
- <if test="nextPaymentDate != null">
- next_payment_date_ = #{nextPaymentDate},
- </if>
- <if test="currentGrade != null">
- current_grade_ = #{currentGrade},
- </if>
- <if test="lastPaymentDate != null">
- last_payment_date_ = #{lastPaymentDate},
- </if>
- <if test="currentClass != null">
- current_class_ = #{currentClass},
- </if>
- <if test="isAllowAdjust != null">
- is_allow_adjust_ = #{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="kitPurchaseMethod != null">
- kit_purchase_method_ = #{kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="userId != null">
- user_id_ = #{userId},
- </if>
- <if test="name != null">
- name_ = #{name},
- </if>
- <if test="remark != null">
- remark_ = #{remark},
- </if>
- <if test="paymentStatus != null">
- payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="parentsName != null">
- parents_name_ = #{parentsName},
- </if>
- <if test="updateTime != null">
- update_time_ = #{updateTime},
- </if>
- <if test="parentsCompany != null">
- parents_company_ = #{parentsCompany},
- </if>
- <if test="musicGroupId != null">
- music_group_id_ = #{musicGroupId},
- </if>
- <if test="actualSubjectId != null">
- actual_subject_id_ = #{actualSubjectId},
- </if>
- </set>
- WHERE id_ = #{id}
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM student_registration WHERE id_ = #{id}
- </delete>
- <sql id="queryPageSql">
- <where>
- <if test="isAllowAdjust != null">
- AND is_allow_adjust_ = #{isAllowAdjust,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="subjectId != null">
- AND subject_id_ = #{subjectId}
- </if>
- </where>
- </sql>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="StudentRegistration" parameterType="map">
- SELECT * FROM student_registration ORDER BY id_
- <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*)
- FROM student_registration
- </select>
- <sql id="queryStudentDetailPageSql">
- <where>
- <if test="musicGroupId != null">
- sr.music_group_id_ = #{musicGroupId}
- </if>
- <if test="subjectId != null">
- sr.subject_id_ = #{subjectId}
- </if>
- <if test="isAllowAdjust != null">
- sr.is_allow_adjust_ = #{isAllowAdjust}
- </if>
- <if test="actualSubjectId != null">
- sr.actual_subject_id_ = #{actualSubjectId}
- </if>
- </where>
- </sql>
- <resultMap type="com.ym.mec.biz.dal.dto.StudentApplyDetailDto" id="studentApplyDetail">
- <result column="current_grade_" property="currentGrade"/>
- <result column="current_class_" property="currentClass"/>
- <result column="is_allow_adjust_" property="isAllowAdjust"
- typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="parents_name_" property="parentsName"/>
- <result column="parents_phone_" property="parentsPhone"/>
- <result column="subject_name_" property="subjectName"/>
- <result column="username_" property="studentName"/>
- <result column="actual_subject_name_" property="actualSubjectName"/>
- <result column="gender_" property="gender" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- </resultMap>
- <select id="queryStudentDetailPage" resultMap="studentApplyDetail">
- SELECT su.username_,sr.parents_name_,sr.current_class_,sr.current_grade_,
- su.gender_,sr.is_allow_adjust_, s.name_ subject_name_,ss.name_ actual_subject_name_,sr.parents_phone_
- FROM student_registration sr
- LEFT JOIN sys_user su ON sr.subject_id_ = su.id_
- LEFT JOIN `subject` s ON sr.subject_id_ = s.id_
- LEFT JOIN `subject` ss ON sr.actual_subject_id_ = s.id_
- <include refid="queryStudentDetailPageSql"/>
- <include refid="global.limit"/>
- </select>
- <select id="queryStudentDetailCount" resultType="java.lang.Integer">
- SELECT COUNT(sr.id_) FROM student_registration sr
- <include refid="queryStudentDetailPageSql"/>
- </select>
- <select id="countPayNum" resultType="java.lang.Integer">
- SELECT COUNT(DISTINCT user_id_) FROM student_registration
- WHERE music_group_id_ = #{musicGroupId} AND subject_id_ = #{subjectId} AND payment_status_ = 1
- </select>
- <resultMap id="queryFeeDetailMap" type="com.ym.mec.biz.dal.dto.StudentFeeDto">
- <result column="deposit_fee_" property="depositFee"/>
- <result column="course_fee_" property="courseFee"/>
- <result column="musical_fee_" property="musicalFee"/>
- <result column="total_amount_" property="totalAmount"/>
- </resultMap>
- <select id="queryFeeDetail" resultMap="queryFeeDetailMap">
- </select>
- <!-- 根据乐团和声部获取未分班的学生 -->
- <select id="getNoClassStuBySubjectId" resultMap="StudentRegistration">
- SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND actual_subject_id_ =
- #{actualSubjectId} AND class_group_id_ >=1
- </select>
- <!-- 根据乐团和声部获取未分班人数 -->
- <select id="getNoClassStuCountBySubjectId" resultType="java.lang.Integer">
- SELECT count(*) FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND actual_subject_id_ =
- #{actualSubjectId} AND class_group_id_ >=1
- </select>
- </mapper>
|