|
@@ -0,0 +1,180 @@
|
|
|
+<?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.StudentExtracurricularExercisesSituationDao">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" id="StudentExtracurricularExercisesSituation">
|
|
|
+ <result column="id_" property="id" />
|
|
|
+ <result column="student_id_" property="studentId" />
|
|
|
+ <result column="week_of_year_" property="weekOfYear" />
|
|
|
+ <result column="monday_" property="monday" />
|
|
|
+ <result column="sunday_" property="sunday" />
|
|
|
+ <result column="teacher_id_" property="teacherId" />
|
|
|
+ <result column="expect_exercises_num_" property="expectExercisesNum" />
|
|
|
+ <result column="actual_exercises_num_" property="actualExercisesNum" />
|
|
|
+ <result column="exercises_reply_num_" property="exercisesReplyNum" />
|
|
|
+ <result column="exercises_message_num_" property="exercisesMessageNum" />
|
|
|
+ <result column="exercises_message_timely_num_" property="exercisesMessageTimelyNum" />
|
|
|
+ <result column="create_time_" property="createTime" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="StudentExercisesSituationDto" type="com.ym.mec.biz.dal.dto.StudentExercisesSituationDto" extends="StudentExtracurricularExercisesSituation">
|
|
|
+ <result column="student_name_" property="studentName"/>
|
|
|
+ <result column="teacher_name_" property="teacherName"/>
|
|
|
+ <result column="organ_name_" property="organName"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="StudentExtracurricularExercisesSituation" >
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="StudentExtracurricularExercisesSituation">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ <!--
|
|
|
+ <selectKey resultClass="int" keyProperty="id" >
|
|
|
+ SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
|
|
|
+ </selectKey>
|
|
|
+ -->
|
|
|
+ INSERT INTO student_extracurricular_exercises_situation_ (id_,student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,actual_exercises_num_,exercises_reply_num_,exercises_message_num_,exercises_message_timely_num_,create_time_,update_time_)
|
|
|
+ VALUES(#{id},#{studentId},#{weekOfYear},#{monday},#{sunday},#{teacherId},#{expectExercisesNum},#{actualExercisesNum},#{exercisesReplyNum},#{exercisesMessageNum},#{exercisesMessageTimelyNum},NOW(),NOW())
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO student_extracurricular_exercises_situation_ (student_id_,week_of_year_,monday_,sunday_,teacher_id_,expect_exercises_num_,actual_exercises_num_,exercises_reply_num_,exercises_message_num_,exercises_message_timely_num_,create_time_,update_time_)
|
|
|
+ VALUES
|
|
|
+ <foreach collection="situations" item="situation" separator=",">
|
|
|
+ (#{situation.studentId},#{situation.weekOfYear},#{situation.monday},#{situation.sunday},#{situation.teacherId},#{situation.expectExercisesNum},#{situation.actualExercisesNum},#{situation.exercisesReplyNum},#{situation.exercisesMessageNum},#{situation.exercisesMessageTimelyNum},NOW(),NOW())
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation">
|
|
|
+ UPDATE student_extracurricular_exercises_situation_
|
|
|
+ <set>
|
|
|
+ <if test="exercisesReplyNum != null">
|
|
|
+ exercises_reply_num_ = #{exercisesReplyNum},
|
|
|
+ </if>
|
|
|
+ <if test="monday != null">
|
|
|
+ monday_ = #{monday},
|
|
|
+ </if>
|
|
|
+ <if test="id != null">
|
|
|
+ id_ = #{id},
|
|
|
+ </if>
|
|
|
+ <if test="weekOfYear != null">
|
|
|
+ week_of_year_ = #{weekOfYear},
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageNum != null">
|
|
|
+ exercises_message_num_ = #{exercisesMessageNum},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="teacherId != null">
|
|
|
+ teacher_id_ = #{teacherId},
|
|
|
+ </if>
|
|
|
+ <if test="actualExercisesNum != null">
|
|
|
+ actual_exercises_num_ = #{actualExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="exercisesMessageTimelyNum != null">
|
|
|
+ exercises_message_timely_num_ = #{exercisesMessageTimelyNum},
|
|
|
+ </if>
|
|
|
+ <if test="studentId != null">
|
|
|
+ student_id_ = #{studentId},
|
|
|
+ </if>
|
|
|
+ <if test="expectExercisesNum != null">
|
|
|
+ expect_exercises_num_ = #{expectExercisesNum},
|
|
|
+ </if>
|
|
|
+ <if test="sunday != null">
|
|
|
+ sunday_ = #{sunday},
|
|
|
+ </if>
|
|
|
+ update_time_ = #{updateTime}
|
|
|
+ </set> WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete" >
|
|
|
+ DELETE FROM student_extracurricular_exercises_situation_ WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteByMonday">
|
|
|
+ DELETE FROM student_extracurricular_exercises_situation_ WHERE monday_ = #{monday}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="StudentExtracurricularExercisesSituation" parameterType="map">
|
|
|
+ SELECT * FROM student_extracurricular_exercises_situation_ ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM student_extracurricular_exercises_situation_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findExercisesSituations" resultMap="StudentExercisesSituationDto">
|
|
|
+ SELECT
|
|
|
+ student_id_,
|
|
|
+ stu.username_ student_name_,
|
|
|
+ o.name_ organ_name_,
|
|
|
+ MAX( teacher_id_ ) teacher_id_,
|
|
|
+ SUM( expect_exercises_num_ ) expect_exercises_num_,
|
|
|
+ SUM( actual_exercises_num_ ) actual_exercises_num_,
|
|
|
+ SUM( exercises_reply_num_ ) exercises_reply_num_,
|
|
|
+ SUM( exercises_message_num_ ) exercises_message_num_,
|
|
|
+ SUM( exercises_message_timely_num_ ) exercises_message_timely_num_
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN sys_user stu ON sut.id_=sees.student_id_
|
|
|
+ LEFT JOIN organization o ON stu.organ_id_=o.id_
|
|
|
+ WHERE
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
+ AND sees.sunday_ <= #{sunday}
|
|
|
+ <if test="search!=null">
|
|
|
+ AND stu.username_ LIKE CONCAT('%', #{search}, '%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ student_id_
|
|
|
+ <trim prefix="HAVING" suffix=";" suffixOverrides="and">
|
|
|
+ <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
+ <if test="actualExercisesNum!=null "> SUM( actual_exercises_num_ )= #{actualExercisesNum} and</if>
|
|
|
+ <if test="exercisesReplyNum!=null "> SUM( exercises_reply_num_ ) = #{exercisesReplyNum} and</if>
|
|
|
+ <if test="exercisesMessageNum!=null "> SUM( exercises_message_num_ ) = #{exercisesMessageNum} and</if>
|
|
|
+ <if test="exercisesMessageTimelyNum!=null "> SUM( exercises_message_timely_num_ ) = #{exercisesMessageTimelyNum} and</if>
|
|
|
+ </trim>
|
|
|
+ ORDER BY student_id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countExercisesSituations" resultType="int">
|
|
|
+ SELECT COUNT(1) FROM (
|
|
|
+ SELECT
|
|
|
+ 1
|
|
|
+ FROM
|
|
|
+ student_extracurricular_exercises_situation_ sees
|
|
|
+ LEFT JOIN sys_user stu ON sut.id_=sees.student_id_
|
|
|
+ WHERE
|
|
|
+ sees.monday_ >= #{monday}
|
|
|
+ AND sees.sunday_ <= #{sunday}
|
|
|
+ <if test="search!=null">
|
|
|
+ AND stu.username_ LIKE CONCAT('%', #{search}, '%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ student_id_
|
|
|
+ <trim prefix="HAVING" suffix=";" suffixOverrides="and">
|
|
|
+ <if test="expectExercisesNum!=null"> SUM( expect_exercises_num_ ) = #{expectExercisesNum}</if>
|
|
|
+ <if test="actualExercisesNum!=null "> SUM( actual_exercises_num_ )= #{actualExercisesNum} and</if>
|
|
|
+ <if test="exercisesReplyNum!=null "> SUM( exercises_reply_num_ ) = #{exercisesReplyNum} and</if>
|
|
|
+ <if test="exercisesMessageNum!=null "> SUM( exercises_message_num_ ) = #{exercisesMessageNum} and</if>
|
|
|
+ <if test="exercisesMessageTimelyNum!=null "> SUM( exercises_message_timely_num_ ) = #{exercisesMessageTimelyNum} and</if>
|
|
|
+ </trim>
|
|
|
+ ) tmp
|
|
|
+ </select>
|
|
|
+</mapper>
|