SysYxSchoolMapper.xml 3.99 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="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="area" jdbcType="VARCHAR" property="area" />
  </resultMap>
  <sql id="Base_Column_List">
    id, school_name, school_type, create_time,province,city,area
  </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 schoolName !=''">
        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>
      <if test="province != null">
        province,
      </if>
      <if test="city != null">
        city,
      </if>
      <if test="area != null">
        area,
      </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>
      <if test="province != null">
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="area != null">
        #{area,jdbcType=VARCHAR},
      </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>
      <if test="province != null">
        province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        city = #{city,jdbcType=VARCHAR},
      </if>
      <if test="area != null">
        area = #{area,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>