根据反向工程生成的mapper.xml文件结构,描述。

ID 描述
BaseResultMap 除了Blob格式的map
ResultMapWithBLOBs 所有列的map
Example_Where_Clause 查询条件,确定某些行
Update_By_Example_Where_Clause
Base_Column_List 除了blob的列集合
Blob_Column_List blob的列集合
selectByExampleWithBLOBs 查询数据,包含blob数据
selectByExample 查询数据,不包含blob数据
selectByPrimaryKey 根据ID选择
deleteByPrimaryKey 根据ID删除
deleteByExample
insert 根据entity插入,包含所有的列
insertSelective 插入非null的列
countByExample
updateByExampleSelective 更新非null的列
updateByExampleWithBLOBs
updateByExample
updateByPrimaryKeySelective 根据id更新非null的列,包括blob
updateByPrimaryKeyWithBLOBs 根据id更新所有列
updateByPrimaryKey 根据id更新除了blob的所有列

表添加列的时候可能需要改动的项目:

  1. BaseResultMap(ResultMapWithBLOBs)
  2. Base_Column_List(Blob_Column_List)
  3. select 根据blob决定
  4. insert
  5. update
<?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.test.meta.entity.User" >
  <resultMap id="BaseResultMap" type="com.test.meta.entity.User" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="user_name" property="userName" jdbcType="VARCHAR" />
    <result column="note" property="note" jdbcType="VARCHAR" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.test.meta.entity.User" extends="BaseResultMap" >
    <result column="icon" property="icon" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    id, user_name, note
  </sql>
  <sql id="Blob_Column_List" >
    icon
  </sql>
  <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.finup.meta.entity.MdmBusinessSystemInfoExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from mdm_business_system_info
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.finup.meta.entity.MdmBusinessSystemInfoExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from mdm_business_system_info
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from mdm_business_system_info
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from mdm_business_system_info
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.finup.meta.entity.MdmBusinessSystemInfoExample" >
    delete from mdm_business_system_info
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.finup.meta.entity.MdmBusinessSystemInfo" >
    insert into mdm_business_system_info (id, business_system_cd, business_system_name, 
      department_id, business_line_id, status, 
      create_time, update_time, note, 
      icon)
    values (#{id,jdbcType=BIGINT}, #{businessSystemCd,jdbcType=VARCHAR}, #{businessSystemName,jdbcType=VARCHAR}, 
      #{departmentId,jdbcType=BIGINT}, #{businessLineId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{note,jdbcType=VARCHAR}, 
      #{icon,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.finup.meta.entity.MdmBusinessSystemInfo" >
    insert into mdm_business_system_info
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="userName != null" >
        userName,
      </if>
      <if test="note != null" >
        note,
      </if>
      <if test="icon != null" >
        icon,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="userName != null" >
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="note != null" >
        #{note,jdbcType=VARCHAR},
      </if>
      <if test="icon != null" >
        #{icon,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.finup.meta.entity.MdmBusinessSystemInfoExample" resultType="java.lang.Integer" >
    select count(*) from mdm_business_system_info
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update mdm_business_system_info
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.userName != null" >
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.note != null" >
        note = #{record.note,jdbcType=VARCHAR},
      </if>
      <if test="record.icon != null" >
        icon = #{record.icon,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map" >
    update mdm_business_system_info
    set id = #{record.id,jdbcType=BIGINT},
      user_name = #{record.userName,jdbcType=VARCHAR},
      note = #{record.note,jdbcType=VARCHAR},
      icon = #{record.icon,jdbcType=LONGVARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update mdm_business_system_info
    set id = #{record.id,jdbcType=BIGINT},
      user_name = #{record.userName,jdbcType=VARCHAR},
      note = #{record.note,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.finup.meta.entity.MdmBusinessSystemInfo" >
    update mdm_business_system_info
    <set >
      <if test="businessSystemCd != null" >
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="note != null" >
        note = #{note,jdbcType=VARCHAR},
      </if>
      <if test="icon != null" >
        icon = #{icon,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.finup.meta.entity.MdmBusinessSystemInfo" >
    update mdm_business_system_info
    set user_name = #{userName,jdbcType=VARCHAR},
      note = #{note,jdbcType=VARCHAR},
      icon = #{icon,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.finup.meta.entity.MdmBusinessSystemInfo" >
    update mdm_business_system_info
    set user_name = #{userName,jdbcType=VARCHAR},
      note = #{note,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐