| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?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.ExtracurricularExercisesDao">
-
- <resultMap type="com.ym.mec.biz.dal.entity.ExtracurricularExercises" id="ExtracurricularExercises">
- <result column="id_" property="id" />
- <result column="teacher_id_" property="teacherId" />
- <result column="student_id_list_" property="studentIdList" />
- <result column="batch_no_" property="batchNo" />
- <result column="title_" property="title" />
- <result column="attachments_" property="attachments" />
- <result column="content_" property="content" />
- <result column="expire_date_" property="expireDate" />
- <result column="completed_num_" property="completedNum" />
- <result column="expect_num_" property="expectNum" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- </resultMap>
- <sql id="queryPageCondition">
- <where>
- <if test="teacherId != null">
- teacher_id_ = #{teacherId}
- </if>
- <if test="title != null">
- title_ = #{title}
- </if>
- <if test="batchNo != null">
- batch_no_ = #{batchNo}
- </if>
- <if test="assignStartTime != null">
- AND create_time_ >= #{assignStartTime}
- </if>
- <if test="assignEndTime != null">
- AND create_time_ <= #{assignEndTime}
- </if>
- </where>
- </sql>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExtracurricularExercises" >
- SELECT * FROM extracurricular_exercises WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="ExtracurricularExercises">
- SELECT * FROM extracurricular_exercises ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercises" 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 (id_,teacher_id_,student_id_list_,batch_no_,title_,attachments_,content_,expire_date_,completed_num_,expect_num_,create_time_,update_time_)
- VALUES(#{id},#{teacherId},#{studentIdList},#{batchNo},#{title},#{attachments},#{content},#{expireDate},#{completedNum},#{expectNum},NOW(), NOW())
- </insert>
-
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercises">
- UPDATE extracurricular_exercises
- <set>
- <if test="studentIdList != null">
- student_id_list_ = #{studentIdList},
- </if>
- <if test="expireDate != null">
- expire_date_ = #{expireDate},
- </if>
- <if test="batchNo != null">
- batch_no_ = #{batchNo},
- </if>
- <if test="id != null">
- id_ = #{id},
- </if>
- <if test="teacherId != null">
- teacher_id_ = #{teacherId},
- </if>
- <if test="title != null">
- title_ = #{title},
- </if>
- <if test="expectNum != null">
- expect_num_ = #{expectNum},
- </if>
- <if test="content != null">
- content_ = #{content},
- </if>
- <if test="attachments != null">
- attachments_ = #{attachments},
- </if>
- <if test="completedNum != null">
- completed_num_ = #{completedNum},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
-
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM extracurricular_exercises WHERE id_ = #{id}
- </delete>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="ExtracurricularExercises" parameterType="map">
- SELECT * FROM extracurricular_exercises
- <include refid="queryPageCondition"/>
- ORDER BY id_ <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM extracurricular_exercises
- <include refid="queryPageCondition"/>
- </select>
- <sql id="queryExtraExercisesCondition">
- <where>
- <if test="teacherId!=null">
- teacher_id_=#{teacherId}
- </if>
- <if test="createTime!=null">
- AND DATE_FORMAT(create_time_, '%Y-%m') = DATE_FORMAT(#{createTime}, '%Y-%m')
- </if>
- </where>
- </sql>
- <select id="countExtraExercises" resultType="int">
- SELECT COUNT(id_) FROM extracurricular_exercises
- <include refid="queryExtraExercisesCondition"/>
- </select>
- <select id="findExtraExercises" resultMap="ExtracurricularExercises">
- SELECT * FROM extracurricular_exercises
- <include refid="queryExtraExercisesCondition"/>
- ORDER BY create_time_ DESC
- <include refid="global.limit"/>
- </select>
- </mapper>
|