|
|
@@ -0,0 +1,239 @@
|
|
|
+<?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.usoftchina.smartschool.school.mapper.CurriculumMapper" >
|
|
|
+ <resultMap id="CurriculumDetailDTOMap" type="com.usoftchina.smartschool.school.dto.CurriculumDetailDTO">
|
|
|
+ <id column="cur_id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="cur_lessons" property="lessons" jdbcType="INTEGER" />
|
|
|
+ <result column="cur_mon" property="mon" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_tues" property="tues" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_wed" property="wed" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_thur" property="thur" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_fri" property="fri" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_sat" property="sat" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_status" property="status" jdbcType="INTEGER" />
|
|
|
+ <result column="cur_remarks" property="remarks" jdbcType="VARCHAR" />
|
|
|
+ <result column="cur_start_time" property="startTime" jdbcType="TIME" />
|
|
|
+ <result column="cur_end_time" property="endTime" jdbcType="TIME" />
|
|
|
+ <result column="clazz_id" property="clazzId" jdbcType="INTEGER" />
|
|
|
+ <result column="school_id" property="schoolId" jdbcType="INTEGER" />
|
|
|
+ <result column="cur_mid" property="mId" jdbcType="INTEGER" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="CurriculumDTOMap" type="com.usoftchina.smartschool.school.dto.CurriculumDTO">
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="mcur_code" property="code" jdbcType="VARCHAR" />
|
|
|
+ <result column="mcur_term_name" property="termName" jdbcType="VARCHAR" />
|
|
|
+ <result column="mcur_name" property="name" jdbcType="VARCHAR" />
|
|
|
+ <result column="mcur_term_start" property="termStart" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="mcur_term_end" property="termEnd" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="mcur_weeknum" property="weekNum" jdbcType="INTEGER" />
|
|
|
+ <result column="creatorName" property="creatorName" jdbcType="VARCHAR" />
|
|
|
+ <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="mcur_status" property="status" jdbcType="VARCHAR" />
|
|
|
+ <!--<result column="school_id" property="" jdbcType="VARCHAR" />-->
|
|
|
+ <result column="clazz_id" property="clazzId" jdbcType="VARCHAR" />
|
|
|
+ <result column="grade_id" property="gradeId" jdbcType="VARCHAR" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectByCondition" resultType="com.usoftchina.smartschool.school.dto.CurriculumListDTO">
|
|
|
+ select mcur.id id, school.school_name schoolName, grade.grade_name gradeName, clazz.clazz_name clazzName, mcur_status status, mcur.school_id schoolId, mcur.clazz_id clazzId, clazz.grade_id gradeId,
|
|
|
+ mcur.mcur_term_name termName, mcur.mcur_name name, mcur.mcur_term_start termStart, mcur.mcur_term_end termEnd
|
|
|
+ from clazz_main_curriculum mcur
|
|
|
+ left join sys_clazz clazz on mcur.clazz_id = clazz.clazz_id
|
|
|
+ left join sys_grade grade on clazz.grade_id = grade.grade_id
|
|
|
+ left join sys_school school on school.school_id = mcur.school_id
|
|
|
+ <where>
|
|
|
+ <if test="condition != null">
|
|
|
+ ${condition}
|
|
|
+ </if>
|
|
|
+ <if test="schoolId != null">
|
|
|
+ and mcur.school_id = #{schoolId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectMain" resultMap="CurriculumDTOMap">
|
|
|
+ select * from clazz_main_curriculum where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectItems" resultMap="CurriculumDetailDTOMap">
|
|
|
+ select * from clazz_curriculum where cur_mid = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSubject" resultType="com.usoftchina.smartschool.school.po.SubjectDO">
|
|
|
+ select * from subject where school_id = #{school_id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ delete from clazz_main_curriculum where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDetailByMainId">
|
|
|
+ delete from clazz_curriculum where cur_mid = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteDetail">
|
|
|
+ DELETE FROM clazz_curriculum where cur_id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="insertSelective" parameterType="com.usoftchina.smartschool.school.dto.CurriculumDTO">
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
+ INSERT INTO clazz_main_curriculum
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="code != null">
|
|
|
+ mcur_code,
|
|
|
+ </if>
|
|
|
+ <if test="termName != null">
|
|
|
+ mcur_term_name,
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ mcur_name,
|
|
|
+ </if>
|
|
|
+ <if test="termStart != null">
|
|
|
+ mcur_term_start,
|
|
|
+ </if>
|
|
|
+ <if test="termEnd != null">
|
|
|
+ mcur_term_end,
|
|
|
+ </if>
|
|
|
+ <if test="weekNum != null">
|
|
|
+ mcur_weeknum,
|
|
|
+ </if>
|
|
|
+ <if test="creatorName != null">
|
|
|
+ creatorName,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ createTime,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="code != null">
|
|
|
+ #{code, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="termName != null">
|
|
|
+ #{termName, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ #{name, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="termStart != null">
|
|
|
+ #{termStart, jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="termEnd != null">
|
|
|
+ #{termEnd, jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="weekNum != null">
|
|
|
+ #{weekNum, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="creatorName != null">
|
|
|
+ #{creatorName, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ #{createTime, jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertDetailSelective" parameterType="java.util.List">
|
|
|
+ insert into clazz_curriculum
|
|
|
+ (cur_lessons,cur_mon,cur_tues,cur_wed,
|
|
|
+ cur_thur,cur_fri,cur_sat,cur_start_time,cur_end_time,
|
|
|
+ cur_status,cur_remarks,clazz_id,school_id,cur_mid
|
|
|
+ ) values
|
|
|
+ <foreach collection="list" item="item" index="index" open="" close="" separator=",">
|
|
|
+ (
|
|
|
+ #{lessons, jdbcType=INTEGER},#{mon,jdbcType=INTEGER},#{tues,jdbcType=INTEGER},#{wed,jdbcType=INTEGER},
|
|
|
+ #{thur,jdbcType=INTEGER},#{fri,jdbcType=INTEGER},#{sat,jdbcType=INTEGER},#{startTime,jdbcType=TIME},
|
|
|
+ #{endTime,jdbcType=TIME},#{status,jdbcType=INTEGER},#{remarks,jdbcType=VARCHAR},#{clazzId,jdbcType=INTEGER},
|
|
|
+ #{schoolId,jdbcType=INTEGER},#{mId,jdbcType=INTEGER},
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.school.dto.CurriculumDTO" >
|
|
|
+ update clazz_main_curriculum
|
|
|
+ <set >
|
|
|
+ <if test="mcur_code != null" >
|
|
|
+ mcur_code = #{code,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="mcur_term_name != null" >
|
|
|
+ mcur_term_name = #{termName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="mcur_name != null" >
|
|
|
+ mcur_name = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="mcur_term_start != null" >
|
|
|
+ mcur_term_start = #{termStart,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="mcur_term_end != null" >
|
|
|
+ mcur_term_end = #{termEnd,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="mcur_weeknum != null" >
|
|
|
+ mcur_weeknum = #{weekNum,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="creatorName != null" >
|
|
|
+ creatorName = #{creatorName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="clazzId != null" >
|
|
|
+ clazz_id = #{clazzId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateDetailSelective" parameterType="com.usoftchina.smartschool.school.dto.CurriculumDetailDTO">
|
|
|
+ <foreach collection="list" item="item" index="index" separator=";">
|
|
|
+ update clazz_curriculum
|
|
|
+ <set>
|
|
|
+ <if test="item.lessons != null and lessons != 0">
|
|
|
+ cur_lessons = #{item.lession, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.mon != null">
|
|
|
+ cur_mon = #{item.mon, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.tues != null">
|
|
|
+ cur_tues = #{item.tues, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.wed != null">
|
|
|
+ cur_wed = #{item.wed, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.thur != null">
|
|
|
+ cur_thur = #{item.thur, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.fri != null">
|
|
|
+ cur_fri = #{item.fri, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.sat != null">
|
|
|
+ cur_sat = #{item.sat, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.startTime != null">
|
|
|
+ cur_start_time = #{item.startTime, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.endTime != null">
|
|
|
+ cur_end_time = #{item.endTime, jdbcType=TIME},
|
|
|
+ </if>
|
|
|
+ <if test="item.status != null">
|
|
|
+ cur_status = #{item.status, jdbcType=TIME},
|
|
|
+ </if>
|
|
|
+ <if test="item.remarks != null">
|
|
|
+ cur_remarks = #{item.remarks, jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.clazzId != null">
|
|
|
+ clazz_id = #{item.clazzId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.schoolId != null">
|
|
|
+ school_id = #{item.schoolId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.mId != null">
|
|
|
+ cur_mid = #{item.mId, jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ WHERE cur_id= #{item.id,jdbcType=INTEGER}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|