mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
update 优化 SQL 语句和改进 Oracle 数据库的 Date 格式化的修改方式
This commit is contained in:
parent
bd0454309f
commit
97849846c5
@ -92,6 +92,8 @@ spring:
|
||||
testOnReturn: false
|
||||
# 注意这个值和druid原生不一致,默认启动了stat
|
||||
filters: stat
|
||||
# 物理连接初始化的时候执行的 SQL,设置 Oracle 默认的 Date 类型格式化,简化时间查询
|
||||
initConnectionSqls: ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
|
||||
|
||||
--- # druid 配置
|
||||
spring:
|
||||
|
||||
@ -127,9 +127,9 @@ public class OracleGenTableServiceImpl extends BaseGenTableServiceImpl {
|
||||
wrapper.apply("dt.table_name = dtc.table_name")
|
||||
.apply("dt.table_name = uo.object_name")
|
||||
.eq("uo.object_type ", "TABLE")
|
||||
.notLike("dt.table_name", "XXL_JOB_")
|
||||
.notLike("dt.table_name", "GEN_")
|
||||
.notInSql("lower(dt.table_name)", "select table_name from gen_table")
|
||||
.apply("dt.table_name not like 'XXL_JOB_%'")
|
||||
.apply("dt.table_name not like 'GEN_%'")
|
||||
.apply("not exists (select (1) from gen_table gt where gt.table_name = lower(dt.table_name))")
|
||||
.like(StringUtils.isNotBlank(genTable.getTableName()), "lower(dt.table_name)", StringUtils.lowerCase(genTable.getTableName()))
|
||||
.like(StringUtils.isNotBlank(genTable.getTableComment()), "lower(dt.table_comment)", StringUtils.lowerCase(genTable.getTableComment()))
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
|
||||
@ -68,11 +68,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
|
||||
from user_tables dt, user_tab_comments dtc, user_objects uo
|
||||
where dt.table_name = dtc.table_name
|
||||
and dt.table_name = uo.object_name
|
||||
where dt.table_name = dtc.table_name and dt.table_name = uo.object_name
|
||||
and uo.object_type = 'TABLE'
|
||||
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
|
||||
AND dt.table_name NOT IN (select table_name from gen_table)
|
||||
and dt.table_name not like 'XXL_JOB_%' and dt.table_name not like 'GEN_%'
|
||||
and not exists (select (1) from gen_table gt where gt.table_name = lower(dt.table_name))
|
||||
and lower(dt.table_name) in
|
||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
@ -82,11 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
|
||||
from user_tables dt, user_tab_comments dtc, user_objects uo
|
||||
where dt.table_name = dtc.table_name
|
||||
and dt.table_name = uo.object_name
|
||||
where dt.table_name = dtc.table_name and dt.table_name = uo.object_name
|
||||
and uo.object_type = 'TABLE'
|
||||
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
|
||||
AND dt.table_name NOT IN (select table_name from gen_table)
|
||||
and dt.table_name not like 'XXL_JOB_%' and dt.table_name not like 'GEN_%'
|
||||
and not exists (select (1) from gen_table gt where gt.table_name = lower(dt.table_name))
|
||||
and lower(dt.table_name) = #{tableName}
|
||||
</select>
|
||||
|
||||
|
||||
@ -952,16 +952,3 @@ begin
|
||||
select instr(','||arg2||',' , ','||arg1||',') into Result from dual;
|
||||
return(Result);
|
||||
end find_in_set;
|
||||
|
||||
/ -- 函数分隔符
|
||||
|
||||
-- ----------------------------
|
||||
-- 钩子 ,用于session连接之后 自动设置默认的date类型格式化 简化时间查询
|
||||
-- 如需设置其它配置 可在此钩子内任意增加处理语句
|
||||
-- 例如: SELECT * FROM sys_user WHERE create_time BETWEEN '2022-03-01 00:00:00' AND '2022-04-01 00:00:00'
|
||||
-- ----------------------------
|
||||
create or replace trigger login_trg
|
||||
after logon on database
|
||||
begin
|
||||
execute immediate 'alter session set nls_date_format=''YYYY-MM-DD HH24:MI:SS''';
|
||||
end login_trg;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user