TKzyRelationClassMapper.xml 8 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.server.web.common.mapper.TKzyRelationClassMapper">
  <resultMap id="BaseResultMap" type="com.server.web.common.model.TKzyRelationClass">
    <constructor>
      <idArg column="id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="relation_id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="first_class_id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="second_class_id" javaType="java.lang.Long" jdbcType="BIGINT" />
      <arg column="create_dt" javaType="java.util.Date" jdbcType="TIMESTAMP" />
    </constructor>
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, relation_id, first_class_id, second_class_id, create_dt
  </sql>
  <select id="selectByExample" parameterType="com.server.web.common.model.TKzyRelationClassExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_kzy_relation_class
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_kzy_relation_class
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from t_kzy_relation_class
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.server.web.common.model.TKzyRelationClassExample">
    delete from t_kzy_relation_class
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.server.web.common.model.TKzyRelationClass" useGeneratedKeys="true">
    insert into t_kzy_relation_class (relation_id, first_class_id, second_class_id, 
      create_dt)
    values (#{relationId,jdbcType=BIGINT}, #{firstClassId,jdbcType=BIGINT}, #{secondClassId,jdbcType=BIGINT}, 
      #{createDt,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.server.web.common.model.TKzyRelationClass" useGeneratedKeys="true">
    insert into t_kzy_relation_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="relationId != null">
        relation_id,
      </if>
      <if test="firstClassId != null">
        first_class_id,
      </if>
      <if test="secondClassId != null">
        second_class_id,
      </if>
      <if test="createDt != null">
        create_dt,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="relationId != null">
        #{relationId,jdbcType=BIGINT},
      </if>
      <if test="firstClassId != null">
        #{firstClassId,jdbcType=BIGINT},
      </if>
      <if test="secondClassId != null">
        #{secondClassId,jdbcType=BIGINT},
      </if>
      <if test="createDt != null">
        #{createDt,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.server.web.common.model.TKzyRelationClassExample" resultType="java.lang.Long">
    select count(*) from t_kzy_relation_class
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update t_kzy_relation_class
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.relationId != null">
        relation_id = #{record.relationId,jdbcType=BIGINT},
      </if>
      <if test="record.firstClassId != null">
        first_class_id = #{record.firstClassId,jdbcType=BIGINT},
      </if>
      <if test="record.secondClassId != null">
        second_class_id = #{record.secondClassId,jdbcType=BIGINT},
      </if>
      <if test="record.createDt != null">
        create_dt = #{record.createDt,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update t_kzy_relation_class
    set id = #{record.id,jdbcType=BIGINT},
      relation_id = #{record.relationId,jdbcType=BIGINT},
      first_class_id = #{record.firstClassId,jdbcType=BIGINT},
      second_class_id = #{record.secondClassId,jdbcType=BIGINT},
      create_dt = #{record.createDt,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.server.web.common.model.TKzyRelationClass">
    update t_kzy_relation_class
    <set>
      <if test="relationId != null">
        relation_id = #{relationId,jdbcType=BIGINT},
      </if>
      <if test="firstClassId != null">
        first_class_id = #{firstClassId,jdbcType=BIGINT},
      </if>
      <if test="secondClassId != null">
        second_class_id = #{secondClassId,jdbcType=BIGINT},
      </if>
      <if test="createDt != null">
        create_dt = #{createDt,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.server.web.common.model.TKzyRelationClass">
    update t_kzy_relation_class
    set relation_id = #{relationId,jdbcType=BIGINT},
      first_class_id = #{firstClassId,jdbcType=BIGINT},
      second_class_id = #{secondClassId,jdbcType=BIGINT},
      create_dt = #{createDt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>