|  | @@ -0,0 +1,165 @@
 | 
	
		
			
				|  |  | +<?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.ExtracurricularExercisesReplyDao">
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<resultMap type="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" id="ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | +		<result column="id_" property="id" />
 | 
	
		
			
				|  |  | +		<result column="extracurricular_exercises_id_" property="extracurricularExercisesId" />
 | 
	
		
			
				|  |  | +		<result column="user_id_" property="userId" />
 | 
	
		
			
				|  |  | +		<result column="attachments_" property="attachments" />
 | 
	
		
			
				|  |  | +		<result column="create_time_" property="createTime" />
 | 
	
		
			
				|  |  | +		<result column="update_time_" property="updateTime" />
 | 
	
		
			
				|  |  | +		<result column="remark_" property="remark" />
 | 
	
		
			
				|  |  | +		<result column="status_" property="status" />
 | 
	
		
			
				|  |  | +		<result column="is_replied_" property="isReplied" />
 | 
	
		
			
				|  |  | +		<result column="is_view_" property="isView" />
 | 
	
		
			
				|  |  | +	</resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<resultMap id="ExtraExerciseStudentsDto" type="com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto" extends="ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | +		<result column="student_name_" property="studentName"/>
 | 
	
		
			
				|  |  | +		<result column="teacher_id_" property="teacherId"/>
 | 
	
		
			
				|  |  | +		<result column="teacher_name_" property="teacherName"/>
 | 
	
		
			
				|  |  | +		<result column="title_" property="title"/>
 | 
	
		
			
				|  |  | +		<result column="content_" property="content"/>
 | 
	
		
			
				|  |  | +	</resultMap>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  | +	<select id="get" resultMap="ExtracurricularExercisesReply" >
 | 
	
		
			
				|  |  | +		SELECT * FROM extracurricular_exercises_reply WHERE id_ = #{id} 
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 全查询 -->
 | 
	
		
			
				|  |  | +	<select id="findAll" resultMap="ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | +		SELECT * FROM extracurricular_exercises_reply ORDER BY id_
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  | +	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | +		<!--
 | 
	
		
			
				|  |  | +		<selectKey resultClass="int" keyProperty="id" > 
 | 
	
		
			
				|  |  | +		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 | 
	
		
			
				|  |  | +		</selectKey>
 | 
	
		
			
				|  |  | +		-->
 | 
	
		
			
				|  |  | +		INSERT INTO extracurricular_exercises_reply (extracurricular_exercises_id_,user_id_,attachments_,create_time_,update_time_,remark_,status_,is_replied_,is_view_)
 | 
	
		
			
				|  |  | +		VALUES(#{extracurricularExercisesId},#{userId},#{attachments},NOW(),NOW(),#{remark},#{status},#{isReplied},#{isView})
 | 
	
		
			
				|  |  | +	</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_)
 | 
	
		
			
				|  |  | +		VALUES
 | 
	
		
			
				|  |  | +		<foreach collection="replies" item="reply" separator=",">
 | 
	
		
			
				|  |  | +			(#{reply.extracurricularExercisesId},#{reply.userId},#{reply.attachments},NOW(),NOW(),#{reply.remark},#{reply.status},#{reply.isReplied},#{reply.isView})
 | 
	
		
			
				|  |  | +		</foreach>
 | 
	
		
			
				|  |  | +	</insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  | +	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply">
 | 
	
		
			
				|  |  | +		UPDATE extracurricular_exercises_reply
 | 
	
		
			
				|  |  | +		<set>
 | 
	
		
			
				|  |  | +			<if test="status != null">
 | 
	
		
			
				|  |  | +			status_ = #{status},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="isView != null">
 | 
	
		
			
				|  |  | +			is_view_ = #{isView},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="userId != null">
 | 
	
		
			
				|  |  | +			user_id_ = #{userId},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="remark != null">
 | 
	
		
			
				|  |  | +			remark_ = #{remark},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="id != null">
 | 
	
		
			
				|  |  | +			id_ = #{id},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="isReplied != null">
 | 
	
		
			
				|  |  | +			is_replied_ = #{isReplied},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="extracurricularExercisesId != null">
 | 
	
		
			
				|  |  | +			extracurricular_exercises_id_ = #{extracurricularExercisesId},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="attachments != null">
 | 
	
		
			
				|  |  | +			attachments_ = #{attachments},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			update_time_ = NOW()
 | 
	
		
			
				|  |  | +		</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +	</update>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | +	<delete id="delete" >
 | 
	
		
			
				|  |  | +		DELETE FROM extracurricular_exercises_reply WHERE id_ = #{id} 
 | 
	
		
			
				|  |  | +	</delete>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 分页查询 -->
 | 
	
		
			
				|  |  | +	<select id="queryPage" resultMap="ExtracurricularExercisesReply" parameterType="map">
 | 
	
		
			
				|  |  | +		SELECT * FROM extracurricular_exercises_reply ORDER BY id_ <include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  | +	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | +		SELECT COUNT(*) FROM extracurricular_exercises_reply
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<select id="findExtraExerciseStudents" resultMap="ExtraExerciseStudentsDto">
 | 
	
		
			
				|  |  | +		SELECT
 | 
	
		
			
				|  |  | +			eer.*,
 | 
	
		
			
				|  |  | +			su.student_name_
 | 
	
		
			
				|  |  | +		FROM
 | 
	
		
			
				|  |  | +			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 | 
	
		
			
				|  |  | +		WHERE eer.extracurricular_exercises_id_= #{extraExerciseId}
 | 
	
		
			
				|  |  | +		<if test="studentName != null">
 | 
	
		
			
				|  |  | +			AND su.username_ LIKE CONCAT('%',#{studentName},'%')
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<select id="findExtraExerciseReply" resultMap="ExtraExerciseStudentsDto">
 | 
	
		
			
				|  |  | +		SELECT
 | 
	
		
			
				|  |  | +			eer.*,
 | 
	
		
			
				|  |  | +			ee.title_,
 | 
	
		
			
				|  |  | +			ee.content_,
 | 
	
		
			
				|  |  | +			ee.teacher_id_,
 | 
	
		
			
				|  |  | +			su.student_name_
 | 
	
		
			
				|  |  | +		FROM
 | 
	
		
			
				|  |  | +			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +			LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
 | 
	
		
			
				|  |  | +			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 | 
	
		
			
				|  |  | +		WHERE
 | 
	
		
			
				|  |  | +			eer.id_ = #{extraExerciseReplyId}
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<sql id="queryStudentExtraExercisesCondition">
 | 
	
		
			
				|  |  | +		<where>
 | 
	
		
			
				|  |  | +			<if test="teacherId!=null">
 | 
	
		
			
				|  |  | +				user_id_=#{studentId}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="createTime!=null">
 | 
	
		
			
				|  |  | +				DATE_FORMAT(create_time_, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d')
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		</where>
 | 
	
		
			
				|  |  | +	</sql>
 | 
	
		
			
				|  |  | +	<select id="countStudentExtraExercises" resultType="int">
 | 
	
		
			
				|  |  | +		SELECT COUNT(id_) FROM extracurricular_exercises_reply
 | 
	
		
			
				|  |  | +		<include refid="queryStudentExtraExercisesCondition"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<select id="findStudentExtraExercises" resultMap="ExtraExerciseStudentsDto">
 | 
	
		
			
				|  |  | +		SELECT
 | 
	
		
			
				|  |  | +			eer.*,
 | 
	
		
			
				|  |  | +			ee.teacher_id_,
 | 
	
		
			
				|  |  | +			tea.real_name_ teacher_name_,
 | 
	
		
			
				|  |  | +			su.student_name_
 | 
	
		
			
				|  |  | +		FROM
 | 
	
		
			
				|  |  | +			extracurricular_exercises_reply eer
 | 
	
		
			
				|  |  | +			LEFT JOIN extracurricular_exercises ee ON ee.id_=eer.extracurricular_exercises_id_
 | 
	
		
			
				|  |  | +			LEFT JOIN sys_user su ON su.id_ = eer.user_id_
 | 
	
		
			
				|  |  | +			LEFT JOIN sys_user tea ON tea.id_=ee.teacher_id_
 | 
	
		
			
				|  |  | +			<include refid="queryStudentExtraExercisesCondition"/>
 | 
	
		
			
				|  |  | +			ORDER BY eer.create_time_ DESC
 | 
	
		
			
				|  |  | +		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<select id="countIsSubmitStudents" resultType="int">
 | 
	
		
			
				|  |  | +		SELECT COUNT(id_) FROM extracurricular_exercises_reply WHERE extracurricular_exercises_id_=#{extraExerciseId} AND attachments_ IS NOT NULL
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +</mapper>
 |