| 
					
				 | 
			
			
				@@ -5,220 +5,132 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 不要修改此文件。所有改动将在下次重新自动生成时丢失。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <mapper namespace="com.ym.mec.biz.dal.dao.StudentDao"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<resultMap type="com.ym.mec.biz.dal.entity.Student" id="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="user_id_" property="userId" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="subject_id_list_" property="subjectIdList" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="service_tag_" property="serviceTag" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="operating_tag_" property="operatingTag" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="create_time_" property="createTime" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<result column="update_time_" property="updateTime" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <resultMap type="com.ym.mec.biz.dal.entity.Student" id="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="user_id_" property="userId"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="subject_id_list_" property="subjectIdList"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="service_tag_" property="serviceTag"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="operating_tag_" property="operatingTag"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="create_time_" property="createTime"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="update_time_" property="updateTime"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<!-- 根据主键查询一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="get" resultMap="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM student WHERE user_id_ = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <!-- 根据主键查询一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="get" resultMap="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE user_id_ = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<!-- 全查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="findAll" resultMap="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <!-- 全查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="findAll" resultMap="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="lockUser" resultType="int" useCache="false" flushCache="true"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM sys_user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE id_ = #{userId} FOR 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        UPDATE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <!-- 向数据库增加一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        INSERT INTO student (user_id_,subject_id_list_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            service_tag_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            operating_tag_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        create_time_,update_time_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        VALUES 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        (#{userId},#{subjectIdList}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            #{serviceTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            #{operatingTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        NOW(),NOW()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <update id="update" parameterType="com.ym.mec.biz.dal.entity.Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        UPDATE student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="subjectIdList != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                subject_id_list_ = #{subjectIdList}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                service_tag_ = #{serviceTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                operating_tag_ = #{operatingTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="updateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                update_time_ = #{updateTime}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="updateTime == null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                update_time_ = NOW() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE user_id_ = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <!-- 分页查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="queryPage" resultMap="Student" parameterType="map"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT * FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <!-- 查询当前表的总记录数 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="queryCount" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT COUNT(*) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="findStudents" resultMap="com.ym.mec.biz.dal.dao.TeacherDao.SysUser"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT id_, username_, phone_,avatar_ FROM sys_user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="studentQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ORDER BY id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="countStudents" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT COUNT(id_) FROM sys_user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="studentQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <sql id="studentQueryCondition"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="organIdList!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                organ_id_ IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <foreach collection="organIdList" item="organId" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    #{organId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="search!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND (username_ LIKE CONCAT('%', #{search}, '%') OR phone_ LIKE CONCAT('%', #{search}, '%')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            AND FIND_IN_SET("STUDENT", user_type_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <resultMap id="student4operating" type="com.ym.mec.biz.dal.dto.Student4operating"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="organ_name_" property="organName"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="organ_id_" property="organId"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="student_name_" property="studentName"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="student_id_" property="studentId"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="teacher_id_" property="teacherId"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="teacher_name_" property="teacherName"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="operating_tag_" property="operatingTag"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="vip_times_" property="vipTimes"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="free_practice_times_" property="freePracticeTimes"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result column="buy_practice_times_" property="buyPracticeTimes"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="getOperatingStudents" resultMap="student4operating"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT su.organ_id_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               o.name_ organ_name_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               su.username_   student_name_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               s.user_id_     student_id_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               tsu.id_        teacher_id_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               tsu.real_name_ teacher_name_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               s.operating_tag_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               a.vip_times_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               a.buy_practice_times_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               p.free_practice_times_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM student s 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 LEFT JOIN sys_user su ON s.user_id_ = su.id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 LEFT JOIN organization o ON o.id_ = su.organ_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 LEFT JOIN ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            SELECT s.user_id_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   SUM(case when (cs.group_type_ = 'VIP') then 1 ELSE 0 END) vip_times_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   SUM(case when (pg.buy_months_ > 0) then 1 ELSE 0 END)     buy_practice_times_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            FROM student s 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            WHERE cs.status_ = 'NOT_START' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GROUP BY s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) a on a.user_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 LEFT JOIN ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            SELECT student_id_, count(id_) free_practice_times_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            FROM practice_group 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            WHERE buy_months_ IS NULL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GROUP BY student_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) p ON p.student_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="student4OperatingQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ORDER BY s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <select id="countOperatingStudents" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT COUNT(s.user_id_) FROM student s 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN sys_user su ON s.user_id_ = su.id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN sys_user tsu ON tsu.id_ = s.teacher_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT s.user_id_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SUM(case when (cs.group_type_ = 'VIP') then 1 ELSE 0 END) vip_times_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SUM(case when (pg.buy_months_ > 0) then 1 ELSE 0 END)     buy_practice_times_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM student s 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN practice_group pg ON pg.`id_` = cs.`music_group_id_` AND cs.`group_type_` = 'PRACTICE' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE cs.status_ = 'NOT_START' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        GROUP BY s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) a on a.user_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT student_id_, count(id_) free_practice_times_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM practice_group 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        WHERE buy_months_ IS NULL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        GROUP BY student_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ) p ON p.student_id_ = s.user_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <include refid="student4OperatingQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <sql id="student4OperatingQueryCondition"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="organId != null and organId != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND FIND_IN_SET(su.organ_id_,#{organId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="teacherId!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND s.teacher_id_ = #{teacherId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="operatingTag !=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND s.operating_tag_ = #{operatingTag} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='hasVip != null and hasVip.toString()=="1".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND a.vip_times_ >=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='hasVip != null and hasVip.toString()=="0".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND (a.vip_times_ =0 OR a.vip_times_ IS NULL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='HasFreePractice != null and HasFreePractice.toString()=="1".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND p.free_practice_times_ >=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='HasFreePractice != null and HasFreePractice.toString()=="0".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND (p.free_practice_times_ =0 OR p.free_practice_times_ IS NULL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='HasBuyPractice != null and HasBuyPractice.toString()=="1".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND a.buy_practice_times_ >=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test='HasBuyPractice != null and HasBuyPractice.toString()=="0".toString()'> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                AND (a.buy_practice_times_ =0 OR a.buy_practice_times_ IS NULL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="lockUser" resultType="int" useCache="false" flushCache="true"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT id_ FROM sys_user WHERE id_=#{userId} FOR UPDATE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<!-- 向数据库增加一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		INSERT INTO student (user_id_,subject_id_list_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			service_tag_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			operating_tag_, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		create_time_,update_time_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		VALUES 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		(#{userId},#{subjectIdList}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			#{serviceTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			#{operatingTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		NOW(),NOW()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		UPDATE student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="subjectIdList != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				subject_id_list_ = #{subjectIdList}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				service_tag_ = #{serviceTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				operating_tag_ = #{operatingTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="updateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				update_time_ = #{updateTime}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="updateTime == null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				update_time_ = NOW() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE user_id_ = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<!-- 分页查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="queryPage" resultMap="Student" parameterType="map"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM student <include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<!-- 查询当前表的总记录数 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="queryCount" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT COUNT(*) FROM student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="findStudents" resultMap="com.ym.mec.biz.dal.dao.TeacherDao.SysUser"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT id_, username_, phone_,avatar_ FROM sys_user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<include refid="studentQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		ORDER BY id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="countStudents" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT COUNT(id_) FROM sys_user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<include refid="studentQueryCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<sql id="studentQueryCondition"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		<where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="organIdList!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				organ_id_ IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<foreach collection="organIdList" item="organId" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					#{organId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<if test="search!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				AND (username_ LIKE CONCAT('%', #{search}, '%') OR phone_ LIKE CONCAT('%', #{search}, '%')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			AND FIND_IN_SET("STUDENT", user_type_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		</where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="queryByOperatingTag" resultMap="Student"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM student WHERE operating_tag_ = #{operatingTag} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<update id="batchUpdate" parameterType="java.util.List"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	<foreach collection="studentList" item="item" index="index" open="" close="" separator=";"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			UPDATE student 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			<set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<if test="item.subjectIdList != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					subject_id_list_ = #{item.subjectIdList}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<if test="item.serviceTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					service_tag_ = #{item.serviceTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<if test="item.operatingTag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					operating_tag_ = #{item.operatingTag}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<if test="item.updateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					update_time_ = #{item.updateTime}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				<if test="item.updateTime == null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					update_time_ = NOW() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			</set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			WHERE user_id_ = #{item.userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |