Result Maps collection already contains value for com.miniprogram.meirong.user.dao.UserMapper.BaseResultMap

出现这种情况了,是mybatis-generator生成mapper.xml一遍之后。

再修改数据库,然后再生成,它不会删去之前的,只是增加,就会出现两段相同的代码。

<?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.miniprogram.meirong.user.dao.UserMapper">
  <resultMap id="BaseResultMap" type="com.miniprogram.meirong.user.entity.User">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="userName" jdbcType="VARCHAR" property="username" />
    <result column="sex" jdbcType="INTEGER" property="sex" />
    <result column="brithday" jdbcType="VARCHAR" property="brithday" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="imageName" jdbcType="VARCHAR" property="imagename" />
    <result column="likes" jdbcType="BIGINT" property="likes" />
    <result column="phoneNumber" jdbcType="VARCHAR" property="phonenumber" />
    <result column="money" jdbcType="REAL" property="money" />
    <result column="country" jdbcType="VARCHAR" property="country" />
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
    <result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="openid" jdbcType="VARCHAR" property="openid" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.miniprogram.meirong.user.entity.User">
    <result column="address" jdbcType="LONGVARCHAR" property="address" />
  </resultMap>
  <sql id="Base_Column_List">
    id, userName, sex, brithday, remark, imageName, likes, phoneNumber, money, country, 
    province, city, createTime, updateTime, openid
  </sql>
  <sql id="Blob_Column_List">
    address
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_user
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from t_user
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.miniprogram.meirong.user.entity.User">
    insert into t_user (id, userName, sex, 
      brithday, remark, imageName, 
      likes, phoneNumber, money, 
      country, province, city, 
      createTime, updateTime, openid, 
      address)
    values (#{id,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, 
      #{brithday,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{imagename,jdbcType=VARCHAR}, 
      #{likes,jdbcType=BIGINT}, #{phonenumber,jdbcType=VARCHAR}, #{money,jdbcType=REAL}, 
      #{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, #{openid,jdbcType=VARCHAR}, 
      #{address,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.miniprogram.meirong.user.entity.User">
    insert into t_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="username != null">
        userName,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="brithday != null">
        brithday,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="imagename != null">
        imageName,
      </if>
      <if test="likes != null">
        likes,
      </if>
      <if test="phonenumber != null">
        phoneNumber,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="country != null">
        country,
      </if>
      <if test="province != null">
        province,
      </if>
      <if test="city != null">
        city,
      </if>
      <if test="createtime != null">
        createTime,
      </if>
      <if test="updatetime != null">
        updateTime,
      </if>
      <if test="openid != null">
        openid,
      </if>
      <if test="address != null">
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="brithday != null">
        #{brithday,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="likes != null">
        #{likes,jdbcType=BIGINT},
      </if>
      <if test="phonenumber != null">
        #{phonenumber,jdbcType=VARCHAR},
      </if>
      <if test="money != null">
        #{money,jdbcType=REAL},
      </if>
      <if test="country != null">
        #{country,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="openid != null">
        #{openid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    <set>
      <if test="username != null">
        userName = #{username,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="brithday != null">
        brithday = #{brithday,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        imageName = #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="likes != null">
        likes = #{likes,jdbcType=BIGINT},
      </if>
      <if test="phonenumber != null">
        phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=REAL},
      </if>
      <if test="country != null">
        country = #{country,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        city = #{city,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        createTime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="openid != null">
        openid = #{openid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    set userName = #{username,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      brithday = #{brithday,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      imageName = #{imagename,jdbcType=VARCHAR},
      likes = #{likes,jdbcType=BIGINT},
      phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      money = #{money,jdbcType=REAL},
      country = #{country,jdbcType=VARCHAR},
      province = #{province,jdbcType=VARCHAR},
      city = #{city,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      openid = #{openid,jdbcType=VARCHAR},
      address = #{address,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    set userName = #{username,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      brithday = #{brithday,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      imageName = #{imagename,jdbcType=VARCHAR},
      likes = #{likes,jdbcType=BIGINT},
      phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      money = #{money,jdbcType=REAL},
      country = #{country,jdbcType=VARCHAR},
      province = #{province,jdbcType=VARCHAR},
      city = #{city,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      openid = #{openid,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <resultMap id="BaseResultMap" type="com.miniprogram.meirong.user.entity.User">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="userName" jdbcType="VARCHAR" property="username" />
    <result column="sex" jdbcType="INTEGER" property="sex" />
    <result column="brithday" jdbcType="VARCHAR" property="brithday" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="imageName" jdbcType="VARCHAR" property="imagename" />
    <result column="likes" jdbcType="BIGINT" property="likes" />
    <result column="phoneNumber" jdbcType="VARCHAR" property="phonenumber" />
    <result column="money" jdbcType="REAL" property="money" />
    <result column="country" jdbcType="VARCHAR" property="country" />
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
    <result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="openid" jdbcType="VARCHAR" property="openid" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.miniprogram.meirong.user.entity.User">
    <result column="address" jdbcType="LONGVARCHAR" property="address" />
  </resultMap>
  <sql id="Base_Column_List">
    id, userName, sex, brithday, remark, imageName, likes, phoneNumber, money, country, 
    province, city, createTime, updateTime, openid
  </sql>
  <sql id="Blob_Column_List">
    address
  </sql>
  <select id="findByOpenid" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_user
    where openid = #{openid,jdbcType=VARCHAR}
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_user
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from t_user
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.miniprogram.meirong.user.entity.User">
    insert into t_user (id, userName, sex, 
      brithday, remark, imageName, 
      likes, phoneNumber, money, 
      country, province, city, 
      createTime, updateTime, openid, 
      address)
    values (#{id,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, 
      #{brithday,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{imagename,jdbcType=VARCHAR}, 
      #{likes,jdbcType=BIGINT}, #{phonenumber,jdbcType=VARCHAR}, #{money,jdbcType=REAL}, 
      #{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, 
      #{createtime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, #{openid,jdbcType=VARCHAR}, 
      #{address,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.miniprogram.meirong.user.entity.User">
    insert into t_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="username != null">
        userName,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="brithday != null">
        brithday,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="imagename != null">
        imageName,
      </if>
      <if test="likes != null">
        likes,
      </if>
      <if test="phonenumber != null">
        phoneNumber,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="country != null">
        country,
      </if>
      <if test="province != null">
        province,
      </if>
      <if test="city != null">
        city,
      </if>
      <if test="createtime != null">
        createTime,
      </if>
      <if test="updatetime != null">
        updateTime,
      </if>
      <if test="openid != null">
        openid,
      </if>
      <if test="address != null">
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="brithday != null">
        #{brithday,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="likes != null">
        #{likes,jdbcType=BIGINT},
      </if>
      <if test="phonenumber != null">
        #{phonenumber,jdbcType=VARCHAR},
      </if>
      <if test="money != null">
        #{money,jdbcType=REAL},
      </if>
      <if test="country != null">
        #{country,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="openid != null">
        #{openid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    <set>
      <if test="username != null">
        userName = #{username,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="brithday != null">
        brithday = #{brithday,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        imageName = #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="likes != null">
        likes = #{likes,jdbcType=BIGINT},
      </if>
      <if test="phonenumber != null">
        phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=REAL},
      </if>
      <if test="country != null">
        country = #{country,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        city = #{city,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        createTime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null">
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="openid != null">
        openid = #{openid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    set userName = #{username,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      brithday = #{brithday,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      imageName = #{imagename,jdbcType=VARCHAR},
      likes = #{likes,jdbcType=BIGINT},
      phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      money = #{money,jdbcType=REAL},
      country = #{country,jdbcType=VARCHAR},
      province = #{province,jdbcType=VARCHAR},
      city = #{city,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      openid = #{openid,jdbcType=VARCHAR},
      address = #{address,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.miniprogram.meirong.user.entity.User">
    update t_user
    set userName = #{username,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=INTEGER},
      brithday = #{brithday,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      imageName = #{imagename,jdbcType=VARCHAR},
      likes = #{likes,jdbcType=BIGINT},
      phoneNumber = #{phonenumber,jdbcType=VARCHAR},
      money = #{money,jdbcType=REAL},
      country = #{country,jdbcType=VARCHAR},
      province = #{province,jdbcType=VARCHAR},
      city = #{city,jdbcType=VARCHAR},
      createTime = #{createtime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      openid = #{openid,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>
原文地址:https://www.cnblogs.com/fuckingPangzi/p/10208349.html