init
This commit is contained in:
13
log/log-biz/src/main/resources/bootstrap-dev.yml
Normal file
13
log/log-biz/src/main/resources/bootstrap-dev.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.7.127.189:38848
|
||||
namespace: clay
|
||||
|
||||
dubbo:
|
||||
registry:
|
||||
parameters:
|
||||
namespace: dubbo-clay
|
||||
11
log/log-biz/src/main/resources/bootstrap-pro.yml
Normal file
11
log/log-biz/src/main/resources/bootstrap-pro.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
# Spring
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: nacos.fateverse.svc.cluster.local:8848
|
||||
|
||||
management:
|
||||
server:
|
||||
port: 9595
|
||||
42
log/log-biz/src/main/resources/bootstrap.yml
Normal file
42
log/log-biz/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 10005
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: log
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 192.168.101.108:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
namespace: ${spring.profiles.active}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
namespace: ${spring.profiles.active}
|
||||
shared-configs:
|
||||
- data-id: application-${spring.profiles.active}.yaml
|
||||
refresh: true
|
||||
dubbo:
|
||||
application:
|
||||
name: dubbo-${spring.application.name}
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
password: ${spring.cloud.nacos.discovery.password}
|
||||
parameters:
|
||||
namespace: dubbo-${spring.profiles.active}
|
||||
BIN
log/log-biz/src/main/resources/ip2region.xdb
Normal file
BIN
log/log-biz/src/main/resources/ip2region.xdb
Normal file
Binary file not shown.
58
log/log-biz/src/main/resources/mapper/LoginInfoMapper.xml
Normal file
58
log/log-biz/src/main/resources/mapper/LoginInfoMapper.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.log.mapper.LoginInfoMapper">
|
||||
<resultMap type="cn.fateverse.log.entity.LoginInfo" id="LoginInfoResult">
|
||||
<id property="infoId" column="info_id"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="ipddr" column="ipaddr"/>
|
||||
<result property="loginLocation" column="login_location"/>
|
||||
<result property="browser" column="browser"/>
|
||||
<result property="os" column="os"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="msg" column="msg"/>
|
||||
<result property="loginTime" column="login_time"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="save" parameterType="cn.fateverse.log.entity.LoginInfo">
|
||||
insert into sys_login_infor
|
||||
(info_id, user_name, ipaddr, login_location, browser, os, state, msg, login_time)
|
||||
values
|
||||
(#{infoId}, #{userName}, #{ipddr}, #{loginLocation}, #{browser}, #{os}, #{state}, #{msg}, #{loginTime})
|
||||
</insert>
|
||||
<select id="search" resultMap="LoginInfoResult"
|
||||
parameterType="cn.fateverse.log.query.LoginLogQuery">
|
||||
select info_id, user_name, ipaddr, login_location, browser, os, state, msg, login_time
|
||||
from sys_login_infor
|
||||
<where>
|
||||
<if test="ipAddr !=null and ipAddr !=''">
|
||||
and ipaddr like concat('%',#{ipAddr},'%')
|
||||
</if>
|
||||
<if test="userName !=null and userName !=''">
|
||||
and user_name like concat('%',#{userName},'%')
|
||||
</if>
|
||||
<if test="state !=null and state !=''">
|
||||
and state = #{state}
|
||||
</if>
|
||||
<if test="startTime !=null">
|
||||
and login_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by login_time desc
|
||||
</select>
|
||||
|
||||
<delete id="delete" parameterType="String">
|
||||
delete from sys_login_infor where info_id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectById" resultMap="LoginInfoResult">
|
||||
select info_id, user_name, ipaddr, login_location, browser, os, state, msg, login_time
|
||||
from sys_login_infor
|
||||
where info_id =#{infoId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
176
log/log-biz/src/main/resources/mapper/OperationMapper.xml
Normal file
176
log/log-biz/src/main/resources/mapper/OperationMapper.xml
Normal file
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.fateverse.log.mapper.OperationMapper">
|
||||
|
||||
<resultMap type="cn.fateverse.log.entity.OperationLog" id="OperationLogResult">
|
||||
<id property="operId" column="oper_id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="businessType" column="business_type"/>
|
||||
<result property="method" column="method"/>
|
||||
<result property="requestMethod" column="request_method"/>
|
||||
<result property="operatorType" column="operator_type"/>
|
||||
<result property="operName" column="oper_name"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="operUrl" column="oper_url"/>
|
||||
<result property="operIp" column="oper_ip"/>
|
||||
<result property="operLocation" column="oper_location"/>
|
||||
<result property="operParam" column="oper_param"/>
|
||||
<result property="jsonResult" column="json_result"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="errorMsg" column="error_msg"/>
|
||||
<result property="operTime" column="oper_time"/>
|
||||
<result property="consumeTime" column="consume_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<insert id="batchSave">
|
||||
insert into sys_operation_log
|
||||
(oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip,
|
||||
oper_location, oper_param, json_result, state, error_msg, error_stack_trace, oper_time, consume_time)
|
||||
values
|
||||
<foreach collection="list" item="log" separator=",">
|
||||
(#{log.operId}, #{log.title}, #{log.businessType}, #{log.method}, #{log.requestMethod}, #{log.operatorType},
|
||||
#{log.operName},
|
||||
#{log.deptName}, #{log.operUrl}, #{log.operIp}, #{log.operLocation}, #{log.operParam}, #{log.jsonResult},
|
||||
#{log.state}, #{log.errorMsg},
|
||||
#{log.errorStackTrace}, #{log.operTime}, #{log.consumeTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="searchSubQuery" resultMap="OperationLogResult"
|
||||
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url,
|
||||
oper_ip, oper_location, state, oper_time, consume_time
|
||||
from sys_operation_log
|
||||
<where>
|
||||
oper_id >= (select oper_id from sys_operation_log
|
||||
<where>
|
||||
<if test="operation.title !=null and operation.title !=''">
|
||||
and title like concat('%',#{operation.title},'%')
|
||||
</if>
|
||||
<if test="operation.operName !=null and operation.operName !=''">
|
||||
and oper_name like concat('%',#{operation.operName},'%')
|
||||
</if>
|
||||
<if test="operation.businessType !=null ">
|
||||
and business_type like concat('%',#{operation.businessType},'%')
|
||||
</if>
|
||||
<if test="operation.state !=null and operation.state !=''">
|
||||
and state =#{operation.state}
|
||||
</if>
|
||||
<if test="operation.startTime !=null ">
|
||||
and oper_time >=#{operation.startTime}
|
||||
</if>
|
||||
<if test="operation.endTime !=null ">
|
||||
and oper_time <=#{operation.endTime}
|
||||
</if>
|
||||
</where>
|
||||
limit #{start},1
|
||||
)
|
||||
<if test="operation.title !=null and operation.title !=''">
|
||||
and title like concat('%',#{operation.title},'%')
|
||||
</if>
|
||||
<if test="operation.operName !=null and operation.operName !=''">
|
||||
and oper_name like concat('%',#{operation.operName},'%')
|
||||
</if>
|
||||
<if test="operation.businessType !=null ">
|
||||
and business_type like concat('%',#{operation.businessType},'%')
|
||||
</if>
|
||||
<if test="operation.state !=null and operation.state !=''">
|
||||
and state =#{operation.state}
|
||||
</if>
|
||||
<if test="operation.startTime !=null ">
|
||||
and oper_time >=#{operation.startTime}
|
||||
</if>
|
||||
<if test="operation.endTime !=null ">
|
||||
and oper_time <=#{operation.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by oper_time desc limit #{size}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="search" resultMap="OperationLogResult"
|
||||
parameterType="cn.fateverse.log.query.OperationLogQuery">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url,
|
||||
oper_ip, oper_location, state, oper_time, consume_time
|
||||
from sys_operation_log
|
||||
<where>
|
||||
<if test="operation.title !=null and operation.title !=''">
|
||||
and title like concat('%',#{operation.title},'%')
|
||||
</if>
|
||||
<if test="operation.operName !=null and operation.operName !=''">
|
||||
and oper_name like concat('%',#{operation.operName},'%')
|
||||
</if>
|
||||
<if test="operation.businessType !=null ">
|
||||
and business_type like concat('%',#{operation.businessType},'%')
|
||||
</if>
|
||||
<if test="operation.state !=null and operation.state !=''">
|
||||
and state =#{operation.state}
|
||||
</if>
|
||||
<if test="operation.startTime !=null ">
|
||||
and oper_time >=#{operation.startTime}
|
||||
</if>
|
||||
<if test="operation.endTime !=null ">
|
||||
and oper_time <=#{operation.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by oper_time desc
|
||||
</select>
|
||||
|
||||
<select id="searchCount" resultType="java.lang.Long">
|
||||
select count(*) from sys_operation_log
|
||||
<where>
|
||||
<if test="operation.title !=null and operation.title !=''">
|
||||
and title like concat('%',#{operation.title},'%')
|
||||
</if>
|
||||
<if test="operation.operName !=null and operation.operName !=''">
|
||||
and oper_name like concat('%',#{operation.operName},'%')
|
||||
</if>
|
||||
<if test="operation.businessType !=null ">
|
||||
and business_type like concat('%',#{operation.businessType},'%')
|
||||
</if>
|
||||
<if test="operation.state !=null and operation.state !=''">
|
||||
and state =#{operation.state}
|
||||
</if>
|
||||
<if test="operation.startTime !=null ">
|
||||
and oper_time >=#{operation.startTime}
|
||||
</if>
|
||||
<if test="operation.endTime !=null ">
|
||||
and oper_time <=#{operation.endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="delete" parameterType="String">
|
||||
delete from sys_operation_log where oper_id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectById" resultMap="OperationLogResult">
|
||||
select oper_id,
|
||||
title,
|
||||
business_type,
|
||||
method,
|
||||
request_method,
|
||||
operator_type,
|
||||
oper_name,
|
||||
dept_name,
|
||||
oper_url,
|
||||
oper_ip,
|
||||
oper_location,
|
||||
oper_param,
|
||||
json_result,
|
||||
state,
|
||||
error_msg,
|
||||
error_stack_trace,
|
||||
oper_time,
|
||||
consume_time
|
||||
from sys_operation_log
|
||||
where oper_id = #{operId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user