日志管理使用索引提升查询性能
This commit is contained in:
parent
dd4ebaf9da
commit
8a9665157b
@ -577,6 +577,9 @@ create table sys_oper_log (
|
||||
);
|
||||
|
||||
alter table sys_oper_log add constraint pk_sys_oper_log primary key (oper_id);
|
||||
create index idx_sys_oper_log_bt on sys_oper_log(business_type);
|
||||
create index idx_sys_oper_log_s on sys_oper_log(status);
|
||||
create index idx_sys_oper_log_ot on sys_oper_log(oper_time);
|
||||
|
||||
comment on table sys_oper_log is '操作日志记录';
|
||||
comment on column sys_oper_log.oper_id is '日志主键seq_sys_oper_log.nextval';
|
||||
@ -791,6 +794,8 @@ create table sys_logininfor (
|
||||
);
|
||||
|
||||
alter table sys_logininfor add constraint pk_sys_logininfor primary key (info_id);
|
||||
create index idx_sys_logininfor_s on sys_logininfor(status);
|
||||
create index idx_sys_logininfor_lt on sys_logininfor(login_time);
|
||||
|
||||
comment on table sys_logininfor is '系统访问记录';
|
||||
comment on column sys_logininfor.info_id is '访问主键seq_seq_sys_logininfor.nextval';
|
@ -37,10 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND user_name like concat(concat('%',#{userName}),'%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND to_char(login_time, 'yyyy-mm-dd') >= #{params.beginTime}
|
||||
AND login_time >= to_date(#{params.beginTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND to_char(login_time, 'yyyy-mm-dd') <= #{params.endTime}
|
||||
AND login_time <= to_date(#{params.endTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
</where>
|
||||
order by info_id desc
|
||||
|
@ -94,10 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND oper_name like concat(concat('%',#{operName}),'%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND to_char(oper_time, 'yyyy-mm-dd') >= #{params.beginTime}
|
||||
AND oper_time >= to_date(#{params.beginTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND to_char(oper_time, 'yyyy-mm-dd') <= #{params.endTime}
|
||||
AND oper_time <= to_date(#{params.endTime}, 'yyyy-mm-dd hh24:mi:ss')
|
||||
</if>
|
||||
</where>
|
||||
order by oper_id desc
|
||||
|
Loading…
Reference in New Issue
Block a user