| | |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.hnct.generator.mapper.GenTableMapper"> |
| | | <mapper namespace="com.ycl.generator.mapper.GenTableMapper"> |
| | | |
| | | <resultMap type="com.hnct.generator.domain.GenTable" id="GenTableResult"> |
| | | <resultMap type="GenTable" id="GenTableResult"> |
| | | <id property="tableId" column="table_id" /> |
| | | <result property="tableName" column="table_name" /> |
| | | <result property="tableComment" column="table_comment" /> |
| | |
| | | <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="com.hnct.generator.domain.GenTableColumn" id="GenTableColumnResult"> |
| | | <resultMap type="GenTableColumn" id="GenTableColumnResult"> |
| | | <id property="columnId" column="column_id" /> |
| | | <result property="tableId" column="table_id" /> |
| | | <result property="columnName" column="column_name" /> |
| | |
| | | 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="com.hnct.generator.domain.GenTable" resultMap="GenTableResult"> |
| | | <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> |
| | | <include refid="selectGenTableVo"/> |
| | | <where> |
| | | <if test="tableName != null and tableName != ''"> |
| | |
| | | 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') >= date_format(#{params.beginTime},'%Y%m%d') |
| | | AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') |
| | | AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectDbTableList" parameterType="com.hnct.generator.domain.GenTable" resultMap="GenTableResult"> |
| | | <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}, '%')) |
| | |
| | | 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') >= date_format(#{params.beginTime},'%Y%m%d') |
| | | AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | AND date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') |
| | | AND date_format(create_time,'%y%m%d') <= 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} |
| | |
| | | order by c.sort |
| | | </select> |
| | | |
| | | <insert id="insertGenTable" parameterType="com.hnct.generator.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId"> |
| | | <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId"> |
| | | insert into gen_table ( |
| | | <if test="tableName != null">table_name,</if> |
| | | <if test="tableComment != null and tableComment != ''">table_comment,</if> |
| | |
| | | ${sql} |
| | | </update> |
| | | |
| | | <update id="updateGenTable" parameterType="com.hnct.generator.domain.GenTable"> |
| | | <update id="updateGenTable" parameterType="GenTable"> |
| | | update gen_table |
| | | <set> |
| | | <if test="tableName != null">table_name = #{tableName},</if> |