ScheduleMapper.xml 2.58 KB
<?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.sincere.independence.mapper.ScheduleMapper">
    <resultMap id="BaseResultMap" type="com.sincere.independence.model.Schedule">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="schedule_name" property="scheduleName" jdbcType="VARCHAR"/>
        <result column="school_id" property="schoolId" jdbcType="INTEGER"/>
        <result column="team" property="team" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="speed" property="speed" jdbcType="INTEGER"/>
        <result column="morning" property="morning" jdbcType="INTEGER"/>
        <result column="afternoon" property="afternoon" jdbcType="INTEGER"/>
        <result column="night" property="night" jdbcType="INTEGER"/>
    </resultMap>

    <insert id="insert" parameterType="com.sincere.independence.model.Schedule" useGeneratedKeys="true" keyColumn="id"
            keyProperty="id">
        insert into sz_schedule ( schedule_name , school_id, team,create_time,speed)
        values (#{scheduleName},#{schoolId},#{team},#{createTime},#{speed})
    </insert>

    <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select * from sz_schedule where id =#{id}
    </select>

    <select id="selectBySchoolAndTeam" parameterType="com.sincere.independence.model.Schedule"
            resultMap="BaseResultMap">
        select * from sz_schedule where school_id =#{schoolId} and team =#{team}
    </select>

    <select id="selectBySchool" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select * from sz_schedule where school_id = #{schoolId}
    </select>

    <delete id="deleteBySchedule" parameterType="java.lang.Integer">
        delete sz_schedule where id =#{id}
    </delete>

    <update id="updateSpeed" parameterType="com.sincere.independence.model.Schedule">
        update sz_schedule set speed = #{speed} where id =#{id}
    </update>

    <update id="update" parameterType="com.sincere.independence.model.Schedule">
        update sz_schedule set schedule_name = #{scheduleName} , team =#{team} where id =#{id}
    </update>

    <update id="updateZuoxi" parameterType="com.sincere.independence.model.Schedule">
        update sz_schedule set morning = #{morning} , afternoon =#{afternoon} , night=#{night} where id =#{id}
    </update>
</mapper>