|
@@ -23,6 +23,12 @@
|
|
|
<result column="is_registered_" property="isRegistered" />
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.dto.StudentPreRegistrationDto" id="StudentPreRegistrationDto" extends="StudentPreRegistration">
|
|
|
+ <result column="subject_first_name_" property="subjectFirstName" />
|
|
|
+ <result column="subject_second_name_" property="subjectSecondName" />
|
|
|
+ <result column="is_registered_" property="isRegistered" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="StudentPreRegistration" >
|
|
|
SELECT * FROM student_pre_registration WHERE id_ = #{id}
|
|
@@ -94,23 +100,26 @@
|
|
|
</delete>
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="StudentPreRegistration" parameterType="map">
|
|
|
- SELECT spr.*,case when sr.id_ is null then false else true end is_registered_ FROM student_pre_registration spr left join student_registration sr on spr.music_group_id_ = sr.music_group_id_ and spr.user_id_ = sr.user_id_
|
|
|
+ <select id="queryListForPage" resultMap="StudentPreRegistrationDto" parameterType="map">
|
|
|
+ SELECT spr.*,case when sr.id_ is null then false else true end is_registered_,s1.name_ subject_first_name_,s2.name_ subject_second_name_ FROM student_pre_registration spr
|
|
|
+ left join subject s1 on s1.id_ = spr.subject_first_
|
|
|
+ left join subject s2 on s2.id_ = spr.subject_second_
|
|
|
+ left join student_registration sr on spr.music_group_id_ = sr.music_group_id_ and spr.user_id_ = sr.user_id_
|
|
|
<where>
|
|
|
<if test="musicGroupId != null">
|
|
|
- and spr.music_group_id_ = #{musicGroupId},
|
|
|
+ and spr.music_group_id_ = #{musicGroupId}
|
|
|
</if>
|
|
|
<if test="isAllowAdjust != null">
|
|
|
- and spr.is_allow_adjust_ = #{isAllowAdjust},
|
|
|
+ and spr.is_allow_adjust_ = #{isAllowAdjust}
|
|
|
</if>
|
|
|
<if test="subjectId != null">
|
|
|
- and (spr.subject_first_ = #{subjectId} or spr.subject_second_ = #{subjectId}),
|
|
|
+ and (spr.subject_first_ = #{subjectId} or spr.subject_second_ = #{subjectId})
|
|
|
</if>
|
|
|
<if test="name != null">
|
|
|
- and (spr.phone_ like concat('%',#{name},'%') or spr.user_name_ like concat('%',#{name},'%') or spr.user_id_ like concat('%',#{name},'%')),
|
|
|
+ and (spr.phone_ like concat('%',#{name},'%') or spr.user_name_ like concat('%',#{name},'%') or spr.user_id_ like concat('%',#{name},'%'))
|
|
|
</if>
|
|
|
<if test="isAllowAdjust != null">
|
|
|
- and spr.is_allow_adjust_ = #{isAllowAdjust},
|
|
|
+ and spr.is_allow_adjust_ = #{isAllowAdjust}
|
|
|
</if>
|
|
|
</where>
|
|
|
ORDER BY spr.id_ <include refid="global.limit"/>
|
|
@@ -121,19 +130,19 @@
|
|
|
SELECT COUNT(spr.id_) FROM student_pre_registration spr
|
|
|
<where>
|
|
|
<if test="musicGroupId != null">
|
|
|
- and spr.music_group_id_ = #{musicGroupId},
|
|
|
+ and spr.music_group_id_ = #{musicGroupId}
|
|
|
</if>
|
|
|
<if test="isAllowAdjust != null">
|
|
|
- and spr.is_allow_adjust_ = #{isAllowAdjust},
|
|
|
+ and spr.is_allow_adjust_ = #{isAllowAdjust}
|
|
|
</if>
|
|
|
<if test="subjectId != null">
|
|
|
- and (spr.subject_first_ = #{subjectId} or spr.subject_second_ = #{subjectId}),
|
|
|
+ and (spr.subject_first_ = #{subjectId} or spr.subject_second_ = #{subjectId})
|
|
|
</if>
|
|
|
<if test="name != null">
|
|
|
- and (spr.phone_ like concat('%',#{name},'%') or spr.user_name_ like concat('%',#{name},'%') or spr.user_id_ like concat('%',#{name},'%')),
|
|
|
+ and (spr.phone_ like concat('%',#{name},'%') or spr.user_name_ like concat('%',#{name},'%') or spr.user_id_ like concat('%',#{name},'%'))
|
|
|
</if>
|
|
|
<if test="isAllowAdjust != null">
|
|
|
- and spr.is_allow_adjust_ = #{isAllowAdjust},
|
|
|
+ and spr.is_allow_adjust_ = #{isAllowAdjust}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|