mybatis / generator

A code generator for MyBatis.
http://www.mybatis.org/generator/
5.29k stars 2.52k forks source link

Use mybatis-generator generation oracle dba permissions code duplication #297

Closed it-noob closed 6 years ago

it-noob commented 6 years ago

Hello, I found a problem using mybatis generator. I'm not sure if there is a problem with the way it is used or the program is abnormal.

When I use the 1.3.5 version of the mybatis-generator, in the generation of oracle database table structure, if the current connection oracle database user has dba permissions, then the generated xml code will repeat the case, and repeated The same number of times as resultmap repeats.

However, this is not the case when I tested with version 1.3.0. Is this a bug or is there any problem with my use?

it-noob commented 6 years ago

This is my generatorConfig.xml configuration file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
  PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <!--数据库驱动-->
    <classPathEntry    location="ojdbc6-11.2.0.4.jar"/>
    <context id="DB2Tables"    targetRuntime="MyBatis3">
        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>
        <!--数据库链接地址账号密码-->
        <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@myhost:1521:orcl" userId="oracletest" password="oracletest">
        </jdbcConnection>
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
        <!--生成Model类存放位置-->
        <javaModelGenerator targetPackage="com.itnoob.model" targetProject="src">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
        <!--生成映射文件存放位置-->
        <sqlMapGenerator targetPackage="com.itnoob.mapping" targetProject="src">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>
        <!--生成Dao类存放位置-->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.itnoob.dao" targetProject="src">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>
        <!--生成对应表及类名-->
        <table tableName="QRTZ_CRON_TRIGGERS"  enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"></table>
    </context>
</generatorConfiguration>

This is the command java -jar mybatis-generator-core-1.3.0.jar -configfile generatorConfig.xml -overwrite

it-noob commented 6 years ago

This is a table structure table statement

-- Create table
create table QRTZ_CRON_TRIGGERS
(
  sched_name      VARCHAR2(120) not null,
  trigger_name    VARCHAR2(200) not null,
  trigger_group   VARCHAR2(200) not null,
  cron_expression VARCHAR2(120) not null,
  time_zone_id    VARCHAR2(80)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table QRTZ_CRON_TRIGGERS
  add constraint QRTZ_CRON_TRIG_PK primary key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    minextents 1
    maxextents unlimited
  );
alter table QRTZ_CRON_TRIGGERS
  add constraint QRTZ_CRON_TRIG_TO_TRIG_FK foreign key (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  references QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP);
it-noob commented 6 years ago

This is normal execution result code with 1.3.0 mybatis-generator-core

<?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.itnoob.dao.QrtzCronTriggersMapper">
  <resultMap id="BaseResultMap" type="com.itnoob.model.QrtzCronTriggers">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
    <id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" />
    <id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" />
    <result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression" />
    <result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    SCHED_NAME, TRIGGER_GROUP, TRIGGER_NAME, CRON_EXPRESSION, TIME_ZONE_ID
  </sql>
  <select id="selectByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itnoob.model.QrtzCronTriggers">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into QRTZ_CRON_TRIGGERS (SCHED_NAME, TRIGGER_GROUP, TRIGGER_NAME, 
      CRON_EXPRESSION, TIME_ZONE_ID)
    values (#{schedName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, 
      #{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into QRTZ_CRON_TRIGGERS
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        SCHED_NAME,
      </if>
      <if test="triggerGroup != null">
        TRIGGER_GROUP,
      </if>
      <if test="triggerName != null">
        TRIGGER_NAME,
      </if>
      <if test="cronExpression != null">
        CRON_EXPRESSION,
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        #{schedName,jdbcType=VARCHAR},
      </if>
      <if test="triggerGroup != null">
        #{triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="triggerName != null">
        #{triggerName,jdbcType=VARCHAR},
      </if>
      <if test="cronExpression != null">
        #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="record.schedName != null">
        SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerGroup != null">
        TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerName != null">
        TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      </if>
      <if test="record.cronExpression != null">
        CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="record.timeZoneId != null">
        TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update QRTZ_CRON_TRIGGERS
    set SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="cronExpression != null">
        CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggers">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update QRTZ_CRON_TRIGGERS
    set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR}
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
  </update>
</mapper>
it-noob commented 6 years ago

This is an unusual execution result code with 1.3.5 mybatis-generator-core

<?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.itnoob.dao.QrtzCronTriggersMapper">
  <resultMap id="BaseResultMap" type="com.itnoob.model.QrtzCronTriggers">
    <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
    <id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" />
    <id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" />
    <result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression" />
    <result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId" />
  </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">
    SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, CRON_EXPRESSION, TIME_ZONE_ID
  </sql>
  <select id="selectByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey">
    delete from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample">
    delete from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, 
      CRON_EXPRESSION, TIME_ZONE_ID)
    values (#{schedName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR}, 
      #{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        SCHED_NAME,
      </if>
      <if test="triggerName != null">
        TRIGGER_NAME,
      </if>
      <if test="triggerGroup != null">
        TRIGGER_GROUP,
      </if>
      <if test="cronExpression != null">
        CRON_EXPRESSION,
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        #{schedName,jdbcType=VARCHAR},
      </if>
      <if test="triggerName != null">
        #{triggerName,jdbcType=VARCHAR},
      </if>
      <if test="triggerGroup != null">
        #{triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="cronExpression != null">
        #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultType="java.lang.Long">
    select count(*) from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="record.schedName != null">
        SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerName != null">
        TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerGroup != null">
        TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="record.cronExpression != null">
        CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="record.timeZoneId != null">
        TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    set SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="cronExpression != null">
        CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggers">
    update QRTZ_CRON_TRIGGERS
    set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR}
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </update>
  <resultMap id="BaseResultMap" type="com.itnoob.model.QrtzCronTriggers">
    <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
    <id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" />
    <id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" />
    <result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression" />
    <result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId" />
  </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">
    SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, CRON_EXPRESSION, TIME_ZONE_ID
  </sql>
  <select id="selectByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggersKey">
    delete from QRTZ_CRON_TRIGGERS
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample">
    delete from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, 
      CRON_EXPRESSION, TIME_ZONE_ID)
    values (#{schedName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR}, 
      #{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        SCHED_NAME,
      </if>
      <if test="triggerName != null">
        TRIGGER_NAME,
      </if>
      <if test="triggerGroup != null">
        TRIGGER_GROUP,
      </if>
      <if test="cronExpression != null">
        CRON_EXPRESSION,
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="schedName != null">
        #{schedName,jdbcType=VARCHAR},
      </if>
      <if test="triggerName != null">
        #{triggerName,jdbcType=VARCHAR},
      </if>
      <if test="triggerGroup != null">
        #{triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="cronExpression != null">
        #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultType="java.lang.Long">
    select count(*) from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="record.schedName != null">
        SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerName != null">
        TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      </if>
      <if test="record.triggerGroup != null">
        TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      </if>
      <if test="record.cronExpression != null">
        CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="record.timeZoneId != null">
        TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    set SCHED_NAME = #{record.schedName,jdbcType=VARCHAR},
      TRIGGER_NAME = #{record.triggerName,jdbcType=VARCHAR},
      TRIGGER_GROUP = #{record.triggerGroup,jdbcType=VARCHAR},
      CRON_EXPRESSION = #{record.cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{record.timeZoneId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="cronExpression != null">
        CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      </if>
      <if test="timeZoneId != null">
        TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
      </if>
    </set>
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.itnoob.model.QrtzCronTriggers">
    update QRTZ_CRON_TRIGGERS
    set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
      TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR}
    where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
      and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
      and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
  </update>
  <resultMap id="BaseResultMap" type="com.itnoob.model.QrtzCronTriggers">
    <result column="ID" jdbcType="DECIMAL" property="id" />
    <result column="TRIGGER_ID" jdbcType="DECIMAL" property="triggerId" />
    <result column="CRONEXPERSSION" jdbcType="VARCHAR" property="cronexperssion" />
  </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, TRIGGER_ID, CRONEXPERSSION
  </sql>
  <select id="selectByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample">
    delete from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS (ID, TRIGGER_ID, CRONEXPERSSION
      )
    values (#{id,jdbcType=DECIMAL}, #{triggerId,jdbcType=DECIMAL}, #{cronexperssion,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.itnoob.model.QrtzCronTriggers">
    insert into QRTZ_CRON_TRIGGERS
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="triggerId != null">
        TRIGGER_ID,
      </if>
      <if test="cronexperssion != null">
        CRONEXPERSSION,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=DECIMAL},
      </if>
      <if test="triggerId != null">
        #{triggerId,jdbcType=DECIMAL},
      </if>
      <if test="cronexperssion != null">
        #{cronexperssion,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.itnoob.model.QrtzCronTriggersExample" resultType="java.lang.Long">
    select count(*) from QRTZ_CRON_TRIGGERS
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    <set>
      <if test="record.id != null">
        ID = #{record.id,jdbcType=DECIMAL},
      </if>
      <if test="record.triggerId != null">
        TRIGGER_ID = #{record.triggerId,jdbcType=DECIMAL},
      </if>
      <if test="record.cronexperssion != null">
        CRONEXPERSSION = #{record.cronexperssion,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update QRTZ_CRON_TRIGGERS
    set ID = #{record.id,jdbcType=DECIMAL},
      TRIGGER_ID = #{record.triggerId,jdbcType=DECIMAL},
      CRONEXPERSSION = #{record.cronexperssion,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>
it-noob commented 6 years ago

This is the creation of Oracle users and authorized script

create user oracletest identified by oracletest  
default tablespace USERS;
grant connect,resource,dba to oracletest;

It should be noted that when I revoke the oracletest dba permissions, 1.3.5 is normal.

jeffgbutler commented 6 years ago

I think the issue is that you have <property name="suppressAllComments" value="true"/> set in your configuration. This breaks the merge function and will cause the repeated elements.

Regarding the oracletest user, I suppose that without that user created you don't have authority to the table and the generator can't introspect that table.

If you want to keep that setting, then you should delete the old XML and Java files before you run the generator.

it-noob commented 6 years ago

@jeffgbutler Thank you very much for your reply. I'm sure that all the directory include files have been emptied each time I execute the command that generated the code. The same configuration, when I invoke revoke dba from oracletest, the result is normal. The results of the modified attributes normal, but there will be a lot of automatically generated annotation, because I do not need these automatically generated annotations, is this a bug?

jeffgbutler commented 6 years ago

My next thought is that there are multiple tables called QRTZ_CRON_TRIGGERS in different schemas. When you give dba permission for oracletest, you are now able to see those other schemas.

Try adding the schema you are interested in to your <table> definition. This will limit the generator to only the specific table you want.

it-noob commented 6 years ago

@jeffgbutler Sorry, thank you for your reply. I confirmed the next, it is indeed dba users too much authority, that found other users of the table structure. Thanks for your suggestion, thanks again, I am having trouble with usage and I'm sorry to bother you.

jeffgbutler commented 6 years ago

No problem. Glad you figured it out.