|
|
@@ -68,47 +68,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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 TO_CHAR(create_time, 'YYYYMMDD') >= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
|
|
|
</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 TO_CHAR(create_time, 'YYYYMMDD') <= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
<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 IN (select table_name from gen_table)
|
|
|
+ select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time
|
|
|
+ from information_schema.tables t
|
|
|
+ join pg_catalog.pg_class pc on pc.relname = t.table_name
|
|
|
+ where t.table_schema = current_database()
|
|
|
+ AND t.table_name NOT LIKE 'qrtz\_%' AND t.table_name NOT LIKE 'gen\_%'
|
|
|
+ AND t.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(t.table_name) like lower(concat('%', #{tableName}, '%'))
|
|
|
</if>
|
|
|
<if test="tableComment != null and tableComment != ''">
|
|
|
- AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
|
|
+ AND lower(pg_catalog.obj_description(pc.oid)) 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 TO_CHAR(t.create_time, 'YYYYMMDD') >= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
|
|
|
</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 TO_CHAR(t.create_time, 'YYYYMMDD') <= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
|
|
|
</if>
|
|
|
- order by create_time desc
|
|
|
+ order by t.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())
|
|
|
- and table_name in
|
|
|
+ select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time
|
|
|
+ from information_schema.tables t
|
|
|
+ join pg_catalog.pg_class pc on pc.relname = t.table_name
|
|
|
+ where t.table_name NOT LIKE 'qrtz\_%' and t.table_name NOT LIKE 'gen\_%' and t.table_schema = current_database()
|
|
|
+ and t.table_name in
|
|
|
<foreach collection="array" item="name" open="(" separator="," close=")">
|
|
|
#{name}
|
|
|
</foreach>
|
|
|
</select>
|
|
|
|
|
|
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
|
|
- select table_name, table_comment, create_time, update_time from information_schema.tables
|
|
|
- where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
|
|
- and table_name = #{tableName}
|
|
|
+ select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time
|
|
|
+ from information_schema.tables t
|
|
|
+ join pg_catalog.pg_class pc on pc.relname = t.table_name
|
|
|
+ where pg_catalog.obj_description(pc.oid) <![CDATA[ <> ]]> '' and t.table_schema = current_database()
|
|
|
+ and t.table_name = #{tableName}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
|
|
@@ -135,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order by c.sort
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
|
|
+ <insert id="insertGenTable" parameterType="GenTable">
|
|
|
insert into gen_table (
|
|
|
<if test="tableName != null">table_name,</if>
|
|
|
<if test="tableComment != null and tableComment != ''">table_comment,</if>
|
|
|
@@ -151,24 +157,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="genPath != null and genPath != ''">gen_path,</if>
|
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
- create_time
|
|
|
- )values(
|
|
|
- <if test="tableName != null">#{tableName},</if>
|
|
|
- <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>
|
|
|
- <if test="functionName != null and functionName != ''">#{functionName},</if>
|
|
|
- <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
|
|
- <if test="genType != null and genType != ''">#{genType},</if>
|
|
|
- <if test="genPath != null and genPath != ''">#{genPath},</if>
|
|
|
- <if test="remark != null and remark != ''">#{remark},</if>
|
|
|
- <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
- sysdate()
|
|
|
- )
|
|
|
+ create_time
|
|
|
+ )values(
|
|
|
+ <if test="tableName != null">#{tableName},</if>
|
|
|
+ <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>
|
|
|
+ <if test="functionName != null and functionName != ''">#{functionName},</if>
|
|
|
+ <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
|
|
+ <if test="genType != null and genType != ''">#{genType},</if>
|
|
|
+ <if test="genPath != null and genPath != ''">#{genPath},</if>
|
|
|
+ <if test="remark != null and remark != ''">#{remark},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
+ CURRENT_TIMESTAMP
|
|
|
+ )
|
|
|
</insert>
|
|
|
|
|
|
<update id="createTable">
|
|
|
@@ -195,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="options != null and options != ''">options = #{options},</if>
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
- update_time = sysdate()
|
|
|
+ update_time = CURRENT_TIMESTAMP
|
|
|
</set>
|
|
|
where table_id = #{tableId}
|
|
|
</update>
|