SysYxSchoolMapper.xml 3.17 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.student.mapper.SysYxSchoolMapper">
  <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxSchool">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="school_name" jdbcType="VARCHAR" property="schoolName" />
    <result column="school_type" jdbcType="INTEGER" property="schoolType" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, school_name, school_type, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_yx_school
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_yx_school
    where id = #{id,jdbcType=INTEGER}
  </delete>

  <select id="selectList" parameterType="com.sincere.student.dto.yx.AddYxSchoolVo" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from sys_yx_school
    <where>
      <if test="schoolName != null and schoolName !=''">
        and school_name = #{schoolName}
      </if>
      <if test="schoolType != null">
        and school_type = #{schoolType}
      </if>
    </where>
  </select>

  <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolVo" resultType="java.lang.Integer">
    select
        count(0)
    from sys_yx_school
    <where>
      <if test="schoolName != null">
        and school_name = #{schoolName}
      </if>
      <if test="schoolType != null">
        and school_type = #{schoolType}
      </if>
    </where>
  </select>

  <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxSchool">
    insert into sys_yx_school
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="schoolName != null">
        school_name,
      </if>
      <if test="schoolType != null">
        school_type,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="schoolName != null">
        #{schoolName,jdbcType=VARCHAR},
      </if>
      <if test="schoolType != null">
        #{schoolType,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchool">
    update sys_yx_school
    <set>
      <if test="schoolName != null">
        school_name = #{schoolName,jdbcType=VARCHAR},
      </if>
      <if test="schoolType != null">
        school_type = #{schoolType,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>