系统管理-操作记录模块SQL 修改
This commit is contained in:
parent
5d38e04a88
commit
2e2de0ae3b
|
|
@ -9,17 +9,17 @@
|
|||
</delete>
|
||||
<!--查询用户记录列表-->
|
||||
<select id="getAppUserHistoryList" resultType="com.bonus.bmw.basic.entity.UserHistoryBean">
|
||||
select ala."id" as id,ala.USER_ID as userId,su.USERNAME as userName,su."phone",ala.DEVICE_ID as deviceId,ala.DEVICE_MODEL as deviceMode,
|
||||
ala.ANDROID_VERSION as androidVersion,ala.LOGIN_DATE as loginDate,ala.LOGIN_TIME as loginTime
|
||||
select ala."id" as id,ala."user_id" as userId,su."username" as userName,su."phone",ala."device_id" as deviceId,ala."device_model" as deviceMode,
|
||||
ala."android_version" as androidVersion,ala."login_date" as loginDate,ala."login_time" as loginTime
|
||||
from "ynrealname"."app_login_audit" ala
|
||||
left join "ynrealname"."sys_user" su on su."id" = ala.USER_ID
|
||||
left join "ynrealname"."sys_user" su on su."id" = ala."user_id"
|
||||
where ala."is_active" = '1'
|
||||
and ala.LOGIN_DATE BETWEEN #{params.startTime} and #{params.endTime}
|
||||
and ala."login_date" BETWEEN #{params.startTime} and #{params.endTime}
|
||||
<if test="params.keyWord != null and params.keyWord!='' ">
|
||||
and (
|
||||
su.USERNAME like concat ('%',#{params.keyWord},'%') or
|
||||
ala.DEVICE_ID like concat ('%',#{params.keyWord},'%') or
|
||||
ala.DEVICE_MODEL like concat ('%',#{params.keyWord},'%')
|
||||
su."username" like '%' || #{params.keyWord} || '%' or
|
||||
ala."device_id" like '%' || #{params.keyWord} || '%' or
|
||||
ala."device_model" like '%' || #{params.keyWord} || '%'
|
||||
)
|
||||
</if>
|
||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||
|
|
@ -28,14 +28,14 @@
|
|||
</select>
|
||||
<select id="getAppUserHistoryCount" resultType="java.lang.Integer">
|
||||
select COUNT(1) from "ynrealname"."app_login_audit" ala
|
||||
left join "ynrealname"."sys_user" su on su."id" = ala.USER_ID
|
||||
left join "ynrealname"."sys_user" su on su."id" = ala."user_id"
|
||||
where ala."is_active" = '1'
|
||||
and ala.LOGIN_DATE BETWEEN #{params.startTime} and #{params.endTime}
|
||||
and ala."login_date" BETWEEN #{params.startTime} and #{params.endTime}
|
||||
<if test="params.keyWord != null and params.keyWord!='' ">
|
||||
and (
|
||||
su.USERNAME like concat ('%',#{params.keyWord},'%') or
|
||||
ala.DEVICE_ID like concat ('%',#{params.keyWord},'%') or
|
||||
ala.DEVICE_MODEL like concat ('%',#{params.keyWord},'%')
|
||||
su."username" like '%' || #{params.keyWord} || '%' or
|
||||
ala."device_id" like '%' || #{params.keyWord} || '%' or
|
||||
ala."device_model" like '%' || #{params.keyWord} || '%'
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -5,29 +5,29 @@
|
|||
<mapper namespace="com.bonus.system.logs.dao.SysOperLogMapper">
|
||||
|
||||
<sql id="selectOperLogVo">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time
|
||||
from sys_oper_log
|
||||
select "oper_id", "title", "business_type", "method", "request_method", "operator_type", "oper_name", "dept_name", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg", "oper_time"
|
||||
from "ynrealname"."sys_oper_log"
|
||||
</sql>
|
||||
|
||||
<sql id="where">
|
||||
<where>
|
||||
a.opersTime BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
||||
a."opersTime" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||
<if test="params != null">
|
||||
<if test="params.type != null and params.type != ''">
|
||||
and a.operatoType = #{params.type}
|
||||
and a."operatoType" = #{params.type}
|
||||
</if>
|
||||
<if test="params.module != null and params.module != ''">
|
||||
and locate(#{params.module},a.title) > 0
|
||||
and INSTR(a."title", #{params.module}) > 0
|
||||
</if>
|
||||
<if test="params.result != null and params.result != ''">
|
||||
and locate(#{params.result},a.jsonResult) > 0
|
||||
and INSTR(a."jsonResult", #{params.result}) > 0
|
||||
</if>
|
||||
<if test="params.keyWord != null and params.keyWord != ''">
|
||||
and (
|
||||
a.title like concat('%', #{params.keyWord}, '%') or
|
||||
a.type like concat('%', #{params.keyWord}, '%') or
|
||||
a.operName like concat('%', #{params.keyWord}, '%') or
|
||||
a.phone like concat('%', #{params.keyWord}, '%')
|
||||
a."title" like '%' || #{params.keyWord} || '%' or
|
||||
a."type" like '%' || #{params.keyWord} || '%' or
|
||||
a."operName" like '%' || #{params.keyWord} || '%' or
|
||||
a."phone" like '%' || #{params.keyWord} || '%'
|
||||
)
|
||||
</if>
|
||||
</if>
|
||||
|
|
@ -35,43 +35,43 @@
|
|||
</sql>
|
||||
|
||||
<insert id="insertOperlog">
|
||||
insert into "ynrealname"."sys_oper_log"("title", "user_id","business_type", "method", "request_method", "operator_type", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg")
|
||||
insert into "ynrealname"."sys_oper_log"("title", "user_id","business_type", "method", "request_method", "operator_type", "oper_url", "oper_ip", "oper_param", "json_result", "status", "error_msg")
|
||||
values (#{title}, #{userId}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg})
|
||||
</insert>
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||
<include refid="selectOperLogVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''">
|
||||
AND title like concat('%', #{title}, '%')
|
||||
AND "title" like '%' || #{title} || '%'
|
||||
</if>
|
||||
<if test="businessType != null">
|
||||
AND business_type = #{businessType}
|
||||
AND "business_type" = #{businessType}
|
||||
</if>
|
||||
<if test="businessTypes != null and businessTypes.length > 0">
|
||||
AND business_type in
|
||||
AND "business_type" in
|
||||
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
||||
#{businessType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
AND "status" = #{status}
|
||||
</if>
|
||||
<if test="operName != null and operName != ''">
|
||||
AND oper_name like concat('%', #{operName}, '%')
|
||||
AND "oper_name" like '%' || #{operName} || '%'
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(oper_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
and to_char("oper_time", 'YYYYMMDD') >= to_char(to_date(#{params.beginTime}, 'YYYY-MM-DD'), 'YYYYMMDD')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(oper_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
and to_char("oper_time", 'YYYYMMDD') <= to_char(to_date(#{params.endTime}, 'YYYY-MM-DD'), 'YYYYMMDD')
|
||||
</if>
|
||||
</where>
|
||||
order by oper_id desc
|
||||
order by "oper_id" desc
|
||||
</select>
|
||||
|
||||
<delete id="deleteOperLogByIds" parameterType="Long">
|
||||
delete from sys_oper_log where oper_id in
|
||||
delete from "ynrealname"."sys_oper_log" where "oper_id" in
|
||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||
#{operId}
|
||||
</foreach>
|
||||
|
|
@ -79,40 +79,40 @@
|
|||
|
||||
<select id="selectOperLogById" parameterType="Long" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||
<include refid="selectOperLogVo"/>
|
||||
where oper_id = #{operId}
|
||||
where "oper_id" = #{operId}
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
sys_oper_log sol
|
||||
"ynrealname"."sys_oper_log" sol
|
||||
where
|
||||
create_time BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
||||
"create_time" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||
<if test="params.type != null and params.type != ''">
|
||||
and operator_type = #{params.type}
|
||||
and "operator_type" = #{params.type}
|
||||
</if>
|
||||
<if test="params.module != null and params.module != ''">
|
||||
and locate(#{params.module},title) > 0
|
||||
and INSTR("title", #{params.module}) > 0
|
||||
</if>
|
||||
<if test="params.result != null and params.result != ''">
|
||||
and locate(#{params.result},json_result) > 0
|
||||
and INSTR("json_result", #{params.result}) > 0
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.bonus.system.api.domain.SysOperLog">
|
||||
select
|
||||
su.username AS operName,
|
||||
su.phone,
|
||||
su."username" AS operName,
|
||||
su."phone",
|
||||
a.*
|
||||
from(
|
||||
SELECT
|
||||
user_id,
|
||||
oper_id AS operId,
|
||||
title,
|
||||
json_result as jsonResult,
|
||||
"user_id",
|
||||
"oper_id" AS operId,
|
||||
"title",
|
||||
"json_result" as jsonResult,
|
||||
CASE
|
||||
business_type
|
||||
"business_type"
|
||||
WHEN 1 THEN '查询'
|
||||
WHEN 2 THEN '新增'
|
||||
WHEN 3 THEN '修改'
|
||||
|
|
@ -126,35 +126,35 @@
|
|||
ELSE '其他'
|
||||
END AS type,
|
||||
CASE
|
||||
operator_type
|
||||
"operator_type"
|
||||
WHEN 1 THEN '后台'
|
||||
WHEN 2 THEN 'APP'
|
||||
ELSE '其他'
|
||||
END AS operatoType ,
|
||||
create_time AS opersTime
|
||||
"create_time" AS opersTime
|
||||
FROM
|
||||
sys_oper_log
|
||||
"ynrealname"."sys_oper_log"
|
||||
where
|
||||
create_time BETWEEN CONCAT(#{params.startTime},' 00:00:00') and CONCAT(#{params.endTime},' 23:59:59')
|
||||
"create_time" BETWEEN #{params.startTime} || ' 00:00:00' and #{params.endTime} || ' 23:59:59'
|
||||
<if test="params.type != null and params.type != ''">
|
||||
and operator_type = #{params.type}
|
||||
and "operator_type" = #{params.type}
|
||||
</if>
|
||||
<if test="params.module != null and params.module != ''">
|
||||
and locate(#{params.module},title) > 0
|
||||
and INSTR("title", #{params.module}) > 0
|
||||
</if>
|
||||
<if test="params.result != null and params.result != ''">
|
||||
and locate(#{params.result},json_result) > 0
|
||||
and INSTR("json_result", #{params.result}) > 0
|
||||
</if>
|
||||
) a
|
||||
LEFT JOIN sys_user su ON su.id = a.user_id
|
||||
LEFT JOIN "ynrealname"."sys_user" su ON su."id" = a."user_id"
|
||||
order by a.opersTime DESC
|
||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||
limit #{offset}, #{limit}
|
||||
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="cleanOperLog">
|
||||
truncate table sys_oper_log
|
||||
truncate table "ynrealname"."sys_oper_log"
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue