|
|
@@ -0,0 +1,91 @@
|
|
|
+<?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.SubjectMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.usoftchina.smartschool.school.po.Subject" >
|
|
|
+ <id column="subject_id" property="subject_id" jdbcType="BIGINT" />
|
|
|
+ <result column="subject_name" property="subject_name" jdbcType="VARCHAR" />
|
|
|
+ <result column="subject_status" property="subject_status" jdbcType="INTEGER" />
|
|
|
+ <result column="school_id" property="school_id" jdbcType="BIGINT" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ subject_id, subject_name, subject_status, school_id
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from subject
|
|
|
+ where subject_id = #{subject_id,jdbcType=BIGINT}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
|
|
+ delete from subject
|
|
|
+ where subject_id = #{subject_id,jdbcType=BIGINT}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.usoftchina.smartschool.school.po.Subject" >
|
|
|
+ insert into subject (subject_id, subject_name, subject_status,
|
|
|
+ school_id)
|
|
|
+ values (#{subject_id,jdbcType=BIGINT}, #{subject_name,jdbcType=VARCHAR}, #{subject_status,jdbcType=INTEGER},
|
|
|
+ #{school_id,jdbcType=BIGINT})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.usoftchina.smartschool.school.po.Subject" >
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="subject_id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
+ insert into subject
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="subject_name != null" >
|
|
|
+ subject_name,
|
|
|
+ </if>
|
|
|
+ <if test="subject_status != null" >
|
|
|
+ subject_status,
|
|
|
+ </if>
|
|
|
+ <if test="school_id != null" >
|
|
|
+ school_id,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="subject_name != null" >
|
|
|
+ #{subject_name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="subject_status != null" >
|
|
|
+ #{subject_status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="school_id != null" >
|
|
|
+ #{school_id,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.school.po.Subject" >
|
|
|
+ update subject
|
|
|
+ <set >
|
|
|
+ <if test="subject_name != null" >
|
|
|
+ subject_name = #{subject_name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="subject_status != null" >
|
|
|
+ subject_status = #{subject_status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="school_id != null" >
|
|
|
+ school_id = #{school_id,jdbcType=BIGINT},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where subject_id = #{subject_id,jdbcType=BIGINT}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.usoftchina.smartschool.school.po.Subject" >
|
|
|
+ update subject
|
|
|
+ set subject_name = #{subject_name,jdbcType=VARCHAR},
|
|
|
+ subject_status = #{subject_status,jdbcType=INTEGER},
|
|
|
+ school_id = #{school_id,jdbcType=BIGINT}
|
|
|
+ where subject_id = #{subject_id,jdbcType=BIGINT}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="selectByConditon" resultMap="BaseResultMap">
|
|
|
+ select * from subject <where>
|
|
|
+ <if test="con != null">
|
|
|
+ ${con}
|
|
|
+ </if>
|
|
|
+ <if test="school_id != null">
|
|
|
+ and school_id = #{school_id}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by subject_id DESC
|
|
|
+ </select>
|
|
|
+</mapper>
|