|  | @@ -23,6 +23,7 @@
 | 
	
		
			
				|  |  |  		<result column="organ_name_" property="organName" />
 | 
	
		
			
				|  |  |  		<result column="submit_time_" property="submitTime" />
 | 
	
		
			
				|  |  |  		<result column="music_score_id_" property="musicScoreId" />
 | 
	
		
			
				|  |  | +		<result column="tenant_id_" property="tenantId" />
 | 
	
		
			
				|  |  |  		<association property="extracurricularExercises" columnPrefix="ee_" resultMap="com.ym.mec.biz.dal.dao.ExtracurricularExercisesDao.ExtracurricularExercises"/>
 | 
	
		
			
				|  |  |  	</resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -40,6 +41,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<sql id="queryPageCondition">
 | 
	
		
			
				|  |  |  		<where>
 | 
	
		
			
				|  |  | +			tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  			<if test="extracurricularExercisesId != null">
 | 
	
		
			
				|  |  |  				AND extracurricular_exercises_id_ = #{extracurricularExercisesId}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
	
		
			
				|  | @@ -83,20 +85,20 @@
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 全查询 -->
 | 
	
		
			
				|  |  |  	<select id="findAll" resultMap="ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | -		SELECT * FROM extracurricular_exercises_reply ORDER BY id_
 | 
	
		
			
				|  |  | +		SELECT * FROM extracurricular_exercises_reply where tenant_id_ = #{tenantId} ORDER BY id_
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  |  	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | -		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_)
 | 
	
		
			
				|  |  | -		VALUES(#{extracurricularExercisesId},#{userId},#{attachments},NOW(),NOW(),#{remark},#{status},#{isReplied},#{isView},#{isRepliedTimely},#{musicScoreId})
 | 
	
		
			
				|  |  | +		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_,tenant_id_)
 | 
	
		
			
				|  |  | +		VALUES(#{extracurricularExercisesId},#{userId},#{attachments},NOW(),NOW(),#{remark},#{status},#{isReplied},#{isView},#{isRepliedTimely},#{musicScoreId},#{tenantId})
 | 
	
		
			
				|  |  |  	</insert>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | -		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_)
 | 
	
		
			
				|  |  | +		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_,is_replied_timely_,music_score_id_,tenant_id_)
 | 
	
		
			
				|  |  |  		VALUES
 | 
	
		
			
				|  |  |  		<foreach collection="replies" item="reply" separator=",">
 | 
	
		
			
				|  |  | -			(#{reply.extracurricularExercisesId},#{reply.userId},#{reply.attachments},NOW(),NOW(),#{reply.remark},#{reply.status},#{reply.isReplied},#{reply.isView},#{reply.isRepliedTimely},#{reply.musicScoreId})
 | 
	
		
			
				|  |  | +			(#{reply.extracurricularExercisesId},#{reply.userId},#{reply.attachments},NOW(),NOW(),#{reply.remark},#{reply.status},#{reply.isReplied},#{reply.isView},#{reply.isRepliedTimely},#{reply.musicScoreId},#{replay.tenantId})
 | 
	
		
			
				|  |  |  		</foreach>
 | 
	
		
			
				|  |  |  	</insert>
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -138,7 +140,7 @@
 | 
	
		
			
				|  |  |  				submit_time_ = #{submitTime},
 | 
	
		
			
				|  |  |  			</if>
 | 
	
		
			
				|  |  |  			update_time_ = NOW()
 | 
	
		
			
				|  |  | -		</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 根据主键删除一条记录 -->
 | 
	
	
		
			
				|  | @@ -209,6 +211,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<sql id="queryStudentExtraExercisesCondition">
 | 
	
		
			
				|  |  |  		<where>
 | 
	
		
			
				|  |  | +			tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  			<if test="studentId!=null">
 | 
	
		
			
				|  |  |  				AND eer.user_id_=#{studentId}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
	
		
			
				|  | @@ -245,6 +248,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<sql id="queryExtraExercisesCondition">
 | 
	
		
			
				|  |  |  		<where>
 | 
	
		
			
				|  |  | +			tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  			<if test="extracurricularExercisesId != null">
 | 
	
		
			
				|  |  |  				AND extracurricular_exercises_id_ = #{extracurricularExercisesId}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
	
		
			
				|  | @@ -311,41 +315,6 @@
 | 
	
		
			
				|  |  |  		left join organization o on o.id_ = u.organ_id_
 | 
	
		
			
				|  |  |  		<include refid="queryExtraExercisesCondition"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | -    <select id="findNoPracticeStudentExercisesInWeek" resultMap="ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | -		SELECT
 | 
	
		
			
				|  |  | -			eer.id_,
 | 
	
		
			
				|  |  | -			eer.user_id_,
 | 
	
		
			
				|  |  | -			eer.status_,
 | 
	
		
			
				|  |  | -			eer.submit_time_,
 | 
	
		
			
				|  |  | -			eer.is_replied_,
 | 
	
		
			
				|  |  | -			eer.is_replied_timely_
 | 
	
		
			
				|  |  | -		FROM
 | 
	
		
			
				|  |  | -			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | -		WHERE
 | 
	
		
			
				|  |  | -			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
 | 
	
		
			
				|  |  | -			AND EXISTS (
 | 
	
		
			
				|  |  | -				SELECT
 | 
	
		
			
				|  |  | -					cssp.user_id_
 | 
	
		
			
				|  |  | -				FROM
 | 
	
		
			
				|  |  | -					course_schedule_student_payment cssp
 | 
	
		
			
				|  |  | -					LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
 | 
	
		
			
				|  |  | -					LEFT JOIN student s ON cssp.user_id_ = s.user_id_
 | 
	
		
			
				|  |  | -				WHERE
 | 
	
		
			
				|  |  | -					cssp.group_type_ = 'PRACTICE'
 | 
	
		
			
				|  |  | -					AND cssp.user_id_=eer.user_id_
 | 
	
		
			
				|  |  | -					AND s.service_tag_ = 1
 | 
	
		
			
				|  |  | -					AND cssp.user_id_ NOT IN (
 | 
	
		
			
				|  |  | -					SELECT
 | 
	
		
			
				|  |  | -						cssp1.user_id_
 | 
	
		
			
				|  |  | -					FROM
 | 
	
		
			
				|  |  | -						course_schedule_student_payment cssp1
 | 
	
		
			
				|  |  | -						LEFT JOIN course_schedule cs1 ON cssp1.course_schedule_id_ = cs1.id_
 | 
	
		
			
				|  |  | -					WHERE
 | 
	
		
			
				|  |  | -						cssp1.group_type_ = 'PRACTICE'
 | 
	
		
			
				|  |  | -						AND cs1.class_date_ BETWEEN #{monday} AND #{sunday}
 | 
	
		
			
				|  |  | -					)
 | 
	
		
			
				|  |  | -			)
 | 
	
		
			
				|  |  | -	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<resultMap id="StudentServiceHomeworkDto" type="com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto">
 | 
	
		
			
				|  |  |  		<result column="id_" property="id" />
 | 
	
	
		
			
				|  | @@ -370,7 +339,7 @@
 | 
	
		
			
				|  |  |  		FROM
 | 
	
		
			
				|  |  |  			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  |  		WHERE
 | 
	
		
			
				|  |  | -			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
 | 
	
		
			
				|  |  | +			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday} and eer.tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  		UNION ALL
 | 
	
		
			
				|  |  |  		SELECT
 | 
	
		
			
				|  |  |  			sch.id_,
 | 
	
	
		
			
				|  | @@ -384,7 +353,7 @@
 | 
	
		
			
				|  |  |  			student_course_homework sch
 | 
	
		
			
				|  |  |  			LEFT JOIN course_schedule cs ON cs.id_ = sch.course_schedule_id_
 | 
	
		
			
				|  |  |  		WHERE
 | 
	
		
			
				|  |  | -			cs.group_type_='PRACTICE' AND DATE_FORMAT( sch.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday}
 | 
	
		
			
				|  |  | +			cs.group_type_='PRACTICE' AND DATE_FORMAT( sch.create_time_, '%Y-%m-%d' ) BETWEEN #{monday} AND #{sunday} and sch.tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<resultMap id="StudentServiceDetailDto" type="com.ym.mec.biz.dal.dto.StudentServiceDetailDto">
 | 
	
	
		
			
				|  | @@ -500,7 +469,7 @@
 | 
	
		
			
				|  |  |  			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  |  			LEFT JOIN extracurricular_exercises ee ON eer.extracurricular_exercises_id_=ee.id_
 | 
	
		
			
				|  |  |  		WHERE
 | 
	
		
			
				|  |  | -			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
 | 
	
		
			
				|  |  | +			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate} and eer.tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="checkStudentHaveExercisesInDateRange" resultType="java.lang.Integer">
 | 
	
	
		
			
				|  | @@ -574,7 +543,7 @@
 | 
	
		
			
				|  |  |  			LEFT JOIN sys_user su ON ee.teacher_id_ = su.id_
 | 
	
		
			
				|  |  |  			LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
 | 
	
		
			
				|  |  |  			LEFT JOIN student_registration sr ON eer.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  | -		WHERE sr.music_group_status_='NORMAL'
 | 
	
		
			
				|  |  | +		WHERE sr.music_group_status_='NORMAL' and ee.tenant_id_ = #{tenantId}
 | 
	
		
			
				|  |  |  			<if test="groupIds!=null and groupIds.size()>0">
 | 
	
		
			
				|  |  |  				AND sr.music_group_id_ IN
 | 
	
		
			
				|  |  |  				<foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
 |