Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
6f2bcf7f
Commit
6f2bcf7f
authored
Nov 17, 2021
by
季圣华
Browse files
优化日志查询接口
parent
6c92337f
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/LogMapperEx.java
View file @
6f2bcf7f
...
@@ -11,7 +11,7 @@ public interface LogMapperEx {
...
@@ -11,7 +11,7 @@ public interface LogMapperEx {
List
<
LogVo4List
>
selectByConditionLog
(
List
<
LogVo4List
>
selectByConditionLog
(
@Param
(
"operation"
)
String
operation
,
@Param
(
"operation"
)
String
operation
,
@Param
(
"userI
d"
)
Integer
userI
d
,
@Param
(
"userI
nfo"
)
String
userI
nfo
,
@Param
(
"clientIp"
)
String
clientIp
,
@Param
(
"clientIp"
)
String
clientIp
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"beginTime"
)
String
beginTime
,
...
@@ -22,7 +22,7 @@ public interface LogMapperEx {
...
@@ -22,7 +22,7 @@ public interface LogMapperEx {
Long
countsByLog
(
Long
countsByLog
(
@Param
(
"operation"
)
String
operation
,
@Param
(
"operation"
)
String
operation
,
@Param
(
"userI
d"
)
Integer
userI
d
,
@Param
(
"userI
nfo"
)
String
userI
nfo
,
@Param
(
"clientIp"
)
String
clientIp
,
@Param
(
"clientIp"
)
String
clientIp
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"beginTime"
)
String
beginTime
,
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/LogVo4List.java
View file @
6f2bcf7f
...
@@ -4,10 +4,20 @@ import com.jsh.erp.datasource.entities.Log;
...
@@ -4,10 +4,20 @@ import com.jsh.erp.datasource.entities.Log;
public
class
LogVo4List
extends
Log
{
public
class
LogVo4List
extends
Log
{
private
String
loginName
;
private
String
userName
;
private
String
userName
;
private
String
createTimeStr
;
private
String
createTimeStr
;
public
String
getLoginName
()
{
return
loginName
;
}
public
void
setLoginName
(
String
loginName
)
{
this
.
loginName
=
loginName
;
}
public
String
getUserName
()
{
public
String
getUserName
()
{
return
userName
;
return
userName
;
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/log/LogComponent.java
View file @
6f2bcf7f
...
@@ -32,13 +32,13 @@ public class LogComponent implements ICommonQuery {
...
@@ -32,13 +32,13 @@ public class LogComponent implements ICommonQuery {
private
List
<?>
getLogList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
private
List
<?>
getLogList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
operation
=
StringUtil
.
getInfo
(
search
,
"operation"
);
String
operation
=
StringUtil
.
getInfo
(
search
,
"operation"
);
Integer
userI
d
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"userI
d"
)
);
String
userI
nfo
=
StringUtil
.
getInfo
(
search
,
"userI
nfo"
);
String
clientIp
=
StringUtil
.
getInfo
(
search
,
"clientIp"
);
String
clientIp
=
StringUtil
.
getInfo
(
search
,
"clientIp"
);
Integer
status
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"status"
));
Integer
status
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"status"
));
String
beginTime
=
StringUtil
.
getInfo
(
search
,
"beginTime"
);
String
beginTime
=
StringUtil
.
getInfo
(
search
,
"beginTime"
);
String
endTime
=
StringUtil
.
getInfo
(
search
,
"endTime"
);
String
endTime
=
StringUtil
.
getInfo
(
search
,
"endTime"
);
String
content
=
StringUtil
.
getInfo
(
search
,
"content"
);
String
content
=
StringUtil
.
getInfo
(
search
,
"content"
);
return
logService
.
select
(
operation
,
userI
d
,
clientIp
,
status
,
beginTime
,
endTime
,
content
,
return
logService
.
select
(
operation
,
userI
nfo
,
clientIp
,
status
,
beginTime
,
endTime
,
content
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
}
...
@@ -46,13 +46,13 @@ public class LogComponent implements ICommonQuery {
...
@@ -46,13 +46,13 @@ public class LogComponent implements ICommonQuery {
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
operation
=
StringUtil
.
getInfo
(
search
,
"operation"
);
String
operation
=
StringUtil
.
getInfo
(
search
,
"operation"
);
Integer
userI
d
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"userI
d"
)
);
String
userI
nfo
=
StringUtil
.
getInfo
(
search
,
"userI
nfo"
);
String
clientIp
=
StringUtil
.
getInfo
(
search
,
"clientIp"
);
String
clientIp
=
StringUtil
.
getInfo
(
search
,
"clientIp"
);
Integer
status
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"status"
));
Integer
status
=
StringUtil
.
parseInteger
(
StringUtil
.
getInfo
(
search
,
"status"
));
String
beginTime
=
StringUtil
.
getInfo
(
search
,
"beginTime"
);
String
beginTime
=
StringUtil
.
getInfo
(
search
,
"beginTime"
);
String
endTime
=
StringUtil
.
getInfo
(
search
,
"endTime"
);
String
endTime
=
StringUtil
.
getInfo
(
search
,
"endTime"
);
String
content
=
StringUtil
.
getInfo
(
search
,
"content"
);
String
content
=
StringUtil
.
getInfo
(
search
,
"content"
);
return
logService
.
countLog
(
operation
,
userI
d
,
clientIp
,
status
,
beginTime
,
endTime
,
content
);
return
logService
.
countLog
(
operation
,
userI
nfo
,
clientIp
,
status
,
beginTime
,
endTime
,
content
);
}
}
@Override
@Override
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/log/LogService.java
View file @
6f2bcf7f
...
@@ -63,13 +63,13 @@ public class LogService {
...
@@ -63,13 +63,13 @@ public class LogService {
return
list
;
return
list
;
}
}
public
List
<
LogVo4List
>
select
(
String
operation
,
Integer
userI
d
,
String
clientIp
,
Integer
status
,
String
beginTime
,
String
endTime
,
public
List
<
LogVo4List
>
select
(
String
operation
,
String
userI
nfo
,
String
clientIp
,
Integer
status
,
String
beginTime
,
String
endTime
,
String
content
,
int
offset
,
int
rows
)
throws
Exception
{
String
content
,
int
offset
,
int
rows
)
throws
Exception
{
List
<
LogVo4List
>
list
=
null
;
List
<
LogVo4List
>
list
=
null
;
try
{
try
{
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
list
=
logMapperEx
.
selectByConditionLog
(
operation
,
userI
d
,
clientIp
,
status
,
beginTime
,
endTime
,
list
=
logMapperEx
.
selectByConditionLog
(
operation
,
userI
nfo
,
clientIp
,
status
,
beginTime
,
endTime
,
content
,
offset
,
rows
);
content
,
offset
,
rows
);
if
(
null
!=
list
)
{
if
(
null
!=
list
)
{
for
(
LogVo4List
log
:
list
)
{
for
(
LogVo4List
log
:
list
)
{
...
@@ -82,13 +82,13 @@ public class LogService {
...
@@ -82,13 +82,13 @@ public class LogService {
return
list
;
return
list
;
}
}
public
Long
countLog
(
String
operation
,
Integer
userI
d
,
String
clientIp
,
Integer
status
,
String
beginTime
,
String
endTime
,
public
Long
countLog
(
String
operation
,
String
userI
nfo
,
String
clientIp
,
Integer
status
,
String
beginTime
,
String
endTime
,
String
content
)
throws
Exception
{
String
content
)
throws
Exception
{
Long
result
=
null
;
Long
result
=
null
;
try
{
try
{
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
beginTime
=
Tools
.
parseDayToTime
(
beginTime
,
BusinessConstants
.
DAY_FIRST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
endTime
=
Tools
.
parseDayToTime
(
endTime
,
BusinessConstants
.
DAY_LAST_TIME
);
result
=
logMapperEx
.
countsByLog
(
operation
,
userI
d
,
clientIp
,
status
,
beginTime
,
endTime
,
content
);
result
=
logMapperEx
.
countsByLog
(
operation
,
userI
nfo
,
clientIp
,
status
,
beginTime
,
endTime
,
content
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
...
...
jshERP-boot/src/main/resources/mapper_xml/LogMapperEx.xml
View file @
6f2bcf7f
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
<mapper
namespace=
"com.jsh.erp.datasource.mappers.LogMapperEx"
>
<mapper
namespace=
"com.jsh.erp.datasource.mappers.LogMapperEx"
>
<resultMap
extends=
"com.jsh.erp.datasource.mappers.LogMapper.BaseResultMap"
id=
"ResultExMap"
type=
"com.jsh.erp.datasource.vo.LogVo4List"
>
<resultMap
extends=
"com.jsh.erp.datasource.mappers.LogMapper.BaseResultMap"
id=
"ResultExMap"
type=
"com.jsh.erp.datasource.vo.LogVo4List"
>
<result
column=
"userName"
jdbcType=
"VARCHAR"
property=
"userName"
/>
<result
column=
"userName"
jdbcType=
"VARCHAR"
property=
"userName"
/>
<result
column=
"login_name"
jdbcType=
"VARCHAR"
property=
"loginName"
/>
</resultMap>
</resultMap>
<select
id=
"selectByConditionLog"
parameterType=
"com.jsh.erp.datasource.entities.LogExample"
resultMap=
"ResultExMap"
>
<select
id=
"selectByConditionLog"
parameterType=
"com.jsh.erp.datasource.entities.LogExample"
resultMap=
"ResultExMap"
>
select l.*,u.username userName
select l.*,u.
login_name,u.
username userName
FROM jsh_log l
FROM jsh_log l
left join jsh_user u on l.user_id = u.id and ifnull(u.Status,'0') !='1'
left join jsh_user u on l.user_id = u.id and ifnull(u.Status,'0') !='1'
where 1=1
where 1=1
...
@@ -14,8 +15,9 @@
...
@@ -14,8 +15,9 @@
<bind
name=
"bindOperation"
value=
"'%'+operation+'%'"
/>
<bind
name=
"bindOperation"
value=
"'%'+operation+'%'"
/>
and l.operation like #{bindOperation}
and l.operation like #{bindOperation}
</if>
</if>
<if
test=
"userId != null"
>
<if
test=
"userInfo != null"
>
and l.user_id=#{userId}
<bind
name=
"bindUserInfo"
value=
"'%'+userInfo+'%'"
/>
and (u.username like #{bindUserInfo} or u.login_name like #{bindUserInfo})
</if>
</if>
<if
test=
"clientIp != null"
>
<if
test=
"clientIp != null"
>
<bind
name=
"bindClientIp"
value=
"'%'+clientIp+'%'"
/>
<bind
name=
"bindClientIp"
value=
"'%'+clientIp+'%'"
/>
...
@@ -49,8 +51,9 @@
...
@@ -49,8 +51,9 @@
<bind
name=
"bindOperation"
value=
"'%'+operation+'%'"
/>
<bind
name=
"bindOperation"
value=
"'%'+operation+'%'"
/>
and l.operation like #{bindOperation}
and l.operation like #{bindOperation}
</if>
</if>
<if
test=
"userId != null"
>
<if
test=
"userInfo != null"
>
and l.user_id=#{userId}
<bind
name=
"bindUserInfo"
value=
"'%'+userInfo+'%'"
/>
and (u.username like #{bindUserInfo} or u.login_name like #{bindUserInfo})
</if>
</if>
<if
test=
"clientIp != null"
>
<if
test=
"clientIp != null"
>
<bind
name=
"bindClientIp"
value=
"'%'+clientIp+'%'"
/>
<bind
name=
"bindClientIp"
value=
"'%'+clientIp+'%'"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment