|  | @@ -20,6 +20,7 @@
 | 
	
		
			
				|  |  |  		<result column="is_replied_" property="isReplied" />
 | 
	
		
			
				|  |  |  		<result column="is_view_" property="isView" />
 | 
	
		
			
				|  |  |  		<result column="organ_name_" property="organName" />
 | 
	
		
			
				|  |  | +		<result column="submit_time_" property="submitTime" />
 | 
	
		
			
				|  |  |  	</resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<resultMap id="ExtraExerciseStudentsDto" type="com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto" extends="ExtracurricularExercisesReply">
 | 
	
	
		
			
				|  | @@ -127,6 +128,9 @@
 | 
	
		
			
				|  |  |  			<if test="attachments != null">
 | 
	
		
			
				|  |  |  			attachments_ = #{attachments},
 | 
	
		
			
				|  |  |  			</if>
 | 
	
		
			
				|  |  | +			<if test="submitTime != null">
 | 
	
		
			
				|  |  | +				submit_time_ = #{submitTime},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  |  			update_time_ = NOW()
 | 
	
		
			
				|  |  |  		</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
	
		
			
				|  | @@ -137,8 +141,10 @@
 | 
	
		
			
				|  |  |  	</delete>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 分页查询 -->
 | 
	
		
			
				|  |  | -	<select id="queryPage" resultMap="ExtracurricularExercisesReply" parameterType="map">
 | 
	
		
			
				|  |  | -		SELECT eer.*,u.username_,ee.title_,o.name_ organ_name_ FROM extracurricular_exercises_reply eer left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  | +	<select id="queryPage" resultMap="ExtraExerciseStudentsDto" parameterType="map">
 | 
	
		
			
				|  |  | +		SELECT eer.*,u.username_,ee.title_,o.name_ organ_name_,ee.teacher_id_,ee.expire_date_
 | 
	
		
			
				|  |  | +		FROM extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +		left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  |  		left join sys_user u on eer.user_id_ = u.id_
 | 
	
		
			
				|  |  |  		left join teacher t on t.id_ = ee.teacher_id_
 | 
	
		
			
				|  |  |  		left join organization o on o.id_ = t.organ_id_
 | 
	
	
		
			
				|  | @@ -148,7 +154,8 @@
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  |  	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | -		SELECT COUNT(eer.id_) FROM extracurricular_exercises_reply eer left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  | +		SELECT COUNT(eer.id_) FROM extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +		left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  |  		left join sys_user u on eer.user_id_ = u.id_
 | 
	
		
			
				|  |  |  		left join teacher t on t.id_ = ee.teacher_id_
 | 
	
		
			
				|  |  |  		left join organization o on o.id_ = t.organ_id_
 | 
	
	
		
			
				|  | @@ -225,4 +232,66 @@
 | 
	
		
			
				|  |  |  	<select id="countIsSubmitStudents" resultType="int">
 | 
	
		
			
				|  |  |  		SELECT COUNT(id_) FROM extracurricular_exercises_reply WHERE extracurricular_exercises_id_=#{extraExerciseId} AND attachments_ IS NOT NULL
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<sql id="queryExtraExercisesCondition">
 | 
	
		
			
				|  |  | +		<where>
 | 
	
		
			
				|  |  | +			<if test="extracurricularExercisesId != null">
 | 
	
		
			
				|  |  | +				AND extracurricular_exercises_id_ = #{extracurricularExercisesId}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="teacherId != null">
 | 
	
		
			
				|  |  | +				AND teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="organId != null">
 | 
	
		
			
				|  |  | +				AND o.id_ = #{organId}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="studentId != null">
 | 
	
		
			
				|  |  | +				AND user_id_ = #{studentId}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="title != null">
 | 
	
		
			
				|  |  | +				AND title_ like '%' #{title} '%'
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="status != null">
 | 
	
		
			
				|  |  | +				AND eer.status_ = #{status}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="isReplied != null">
 | 
	
		
			
				|  |  | +				AND is_replied_ = #{isReplied}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="isView != null">
 | 
	
		
			
				|  |  | +				AND is_view_ = #{isView}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="search != null">
 | 
	
		
			
				|  |  | +				AND title_ like concat('%',#{search},'%') or u.username_ like concat('%',#{search},'%')
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="submitStartTime != null">
 | 
	
		
			
				|  |  | +				AND date(eer.create_time_) >= #{submitStartTime}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="submitEndTime != null">
 | 
	
		
			
				|  |  | +				AND date(eer.create_time_) <= #{submitEndTime}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="expireDate != null">
 | 
	
		
			
				|  |  | +				AND DATE_FORMAT(ee.expire_date_,"%Y%m%d") = DATE_FORMAT(#{expireDate},"%Y%m%d")
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		</where>
 | 
	
		
			
				|  |  | +	</sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<select id="findExtraExercises" resultMap="ExtraExerciseStudentsDto">
 | 
	
		
			
				|  |  | +		SELECT eer.*,u.username_,ee.title_,o.name_ organ_name_,ee.teacher_id_,ee.expire_date_
 | 
	
		
			
				|  |  | +		FROM extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +		left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  | +		left join sys_user u on eer.user_id_ = u.id_
 | 
	
		
			
				|  |  | +		left join teacher t on t.id_ = ee.teacher_id_
 | 
	
		
			
				|  |  | +		left join organization o on o.id_ = t.organ_id_
 | 
	
		
			
				|  |  | +		<include refid="queryExtraExercisesCondition"/>
 | 
	
		
			
				|  |  | +		ORDER BY eer.id_ <include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<select id="countExtraExercises" resultType="int">
 | 
	
		
			
				|  |  | +		SELECT COUNT(eer.id_) FROM extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +		left join extracurricular_exercises ee on eer.extracurricular_exercises_id_ = ee.id_
 | 
	
		
			
				|  |  | +		left join sys_user u on eer.user_id_ = u.id_
 | 
	
		
			
				|  |  | +		left join teacher t on t.id_ = ee.teacher_id_
 | 
	
		
			
				|  |  | +		left join organization o on o.id_ = t.organ_id_
 | 
	
		
			
				|  |  | +		<include refid="queryExtraExercisesCondition"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  |  </mapper>
 |