distinct ip_address, browser, start_time, end_time, usid, operate_time, method, description, class_name, account
where 1=1
and ip_address ${ipAddressOperator} #{ipAddress}
and browser ${browserOperator} #{browser}
and start_time >= to_date(#{startTime1},'yyyy-mm-dd hh24:mi:ss')
and start_time <= to_date(#{startTime2},'yyyy-mm-dd hh24:mi:ss')+1
and usid ${usidOperator} #{usid}
and operate_time ${operateTimeOperator} #{operateTime}
and operate_time >= #{operateTime1}
and operate_time <= #{operateTime2}
and method ${methodOperator} #{method}
and description ${descriptionOperator} #{description}
and class_name ${classNameOperator} #{className}
and account ${accountOperator} '%${account}%'
and id ${idOperator} #{id}
insert into TS_LOG()
values (#{ipAddress}, #{browser}, #{startTime}, #{endTime}, #{usid}, #{operateTime}, #{method}, #{description},
#{className}, #{account},
#{id})
insert into ts_mi_log
(id
,account
,user_name
,access_page
,department
,oparate_date)
values(
#{id}
,#{account}
,#{userName}
,#{accessPage}
,#{department}
,#{operateDate})
merge into TS_LOG a
using (
select
#{ipAddress} as ipAddress,
#{startTime} as startTime,
#{endTime} as endTime,
#{usid} as usid,
#{method} as method,
#{description} as description,
#{className} as className,
#{account} as account,
#{id} as id
from dual )b
on (a.ip_address = b.ipAddress
and
(to_date(to_char(b.startTime,'yyyy-mm-dd hh24-mi-ss'), 'yyyy-mm-dd hh24-mi-ss')-to_date( to_char(a.START_TIME,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss') )*24*60*60
<='2'
and a.usid = b.usid
and a.method = b.method
and a.description = b.description
and a.class_name = b.className
and a.account = b.account)
when not matched then
insert (ip_address,start_time,end_time,usid,method,description,class_name,account,id)
values (b.ipAddress,b.startTime,b.endTime,b.usid,b.method,b.description,b.className,b.account,b.id)
update TS_LOG
set ip_address = #{ipAddress},
browser = #{browser},
start_time = #{startTime},
end_time = #{endTime},
usid = #{usid},
operate_time = #{operateTime},
method = #{method},
description = #{description},
class_name = #{className},
account = #{account}
where id = #{id}
update TS_LOG
ip_address = #{ipAddress},
browser = #{browser},
start_time = #{startTime},
end_time = #{endTime},
usid = #{usid},
operate_time = #{operateTime},
method = #{method},
description = #{description},
class_name = #{className},
account = #{account},
where id = #{id}
delete from TS_LOG
where id = #{value}