RuoYi
2024-07-08 fcccbde28b3ad8597abec1b2015ac13b269f8820
src/main/resources/mybatis/tool/GenTableMapper.xml
@@ -12,6 +12,7 @@
      <result property="subTableFkName" column="sub_table_fk_name" />
      <result property="className"      column="class_name"        />
      <result property="tplCategory"    column="tpl_category"      />
      <result property="tplWebType"     column="tpl_web_type"      />
      <result property="packageName"    column="package_name"      />
      <result property="moduleName"     column="module_name"       />
      <result property="businessName"   column="business_name"     />
@@ -25,7 +26,7 @@
      <result property="updateBy"       column="update_by"         />
      <result property="updateTime"     column="update_time"       />
      <result property="remark"         column="remark"            />
      <collection  property="columns"  javaType="java.util.List"  resultMap="GenTableColumnResult" />
      <collection  property="columns"   javaType="java.util.List"  resultMap="GenTableColumnResult" />
   </resultMap>
   
   <resultMap type="GenTableColumn" id="GenTableColumnResult">
@@ -54,7 +55,7 @@
    </resultMap>
   
   <sql id="selectGenTableVo">
        select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
        select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
    </sql>
    
    <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
@@ -67,10 +68,10 @@
            AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
         </if>
         <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
         </if>
         <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
         </if>
      </where>
   </select>
@@ -78,7 +79,7 @@
   <select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
      select table_name, table_comment, create_time, update_time from information_schema.tables
      where table_schema = (select database())
      AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
      AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%'
      AND table_name NOT IN (select table_name from gen_table)
      <if test="tableName != null and tableName != ''">
         AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
@@ -87,16 +88,17 @@
         AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
      </if>
      <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
         AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
         AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
      </if>
      <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
         AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
         AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
      </if>
        order by create_time desc
   </select>
   
   <select id="selectDbTableListByNames" resultMap="GenTableResult">
      select table_name, table_comment, create_time, update_time from information_schema.tables
      where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
      where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database())
      and table_name in
       <foreach collection="array" item="name" open="(" separator="," close=")">
          #{name}
@@ -110,7 +112,7 @@
   </select>
   
   <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
            c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
      FROM gen_table t
          LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@@ -118,7 +120,7 @@
   </select>
   
   <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
            c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
      FROM gen_table t
          LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@@ -126,7 +128,7 @@
   </select>
   
   <select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
       SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
            c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
      FROM gen_table t
          LEFT JOIN gen_table_column c ON t.table_id = c.table_id
@@ -139,6 +141,7 @@
         <if test="tableComment != null and tableComment != ''">table_comment,</if>
         <if test="className != null and className != ''">class_name,</if>
         <if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
         <if test="tplWebType != null and tplWebType != ''">tpl_web_type,</if>
         <if test="packageName != null and packageName != ''">package_name,</if>
         <if test="moduleName != null and moduleName != ''">module_name,</if>
         <if test="businessName != null and businessName != ''">business_name,</if>
@@ -154,6 +157,7 @@
         <if test="tableComment != null and tableComment != ''">#{tableComment},</if>
         <if test="className != null and className != ''">#{className},</if>
         <if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
         <if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if>
         <if test="packageName != null and packageName != ''">#{packageName},</if>
         <if test="moduleName != null and moduleName != ''">#{moduleName},</if>
         <if test="businessName != null and businessName != ''">#{businessName},</if>
@@ -167,6 +171,10 @@
         )
    </insert>
    
    <update id="createTable">
        ${sql}
    </update>
    <update id="updateGenTable" parameterType="GenTable">
        update gen_table
        <set>
@@ -179,6 +187,7 @@
            <if test="genType != null and genType != ''">gen_type = #{genType},</if>
            <if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
            <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
            <if test="tplWebType != null and tplWebType != ''">tpl_web_type = #{tplWebType},</if>
            <if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
            <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
            <if test="businessName != null and businessName != ''">business_name = #{businessName},</if>