给日志模块增加按租户查询的参数
This commit is contained in:
@@ -13,7 +13,8 @@ public interface LogMapperEx {
|
||||
@Param("operation") String operation,
|
||||
@Param("userInfo") String userInfo,
|
||||
@Param("clientIp") String clientIp,
|
||||
@Param("status") Integer status,
|
||||
@Param("tenantLoginName") String tenantLoginName,
|
||||
@Param("tenantType") String tenantType,
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("content") String content,
|
||||
@@ -24,7 +25,8 @@ public interface LogMapperEx {
|
||||
@Param("operation") String operation,
|
||||
@Param("userInfo") String userInfo,
|
||||
@Param("clientIp") String clientIp,
|
||||
@Param("status") Integer status,
|
||||
@Param("tenantLoginName") String tenantLoginName,
|
||||
@Param("tenantType") String tenantType,
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("content") String content);
|
||||
|
||||
@@ -34,11 +34,12 @@ public class LogComponent implements ICommonQuery {
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
String userInfo = StringUtil.getInfo(search, "userInfo");
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
Integer status = StringUtil.parseInteger(StringUtil.getInfo(search, "status"));
|
||||
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
|
||||
String tenantType = StringUtil.getInfo(search, "tenantType");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.select(operation, userInfo, clientIp, status, beginTime, endTime, content,
|
||||
return logService.select(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content,
|
||||
QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@@ -48,11 +49,12 @@ public class LogComponent implements ICommonQuery {
|
||||
String operation = StringUtil.getInfo(search, "operation");
|
||||
String userInfo = StringUtil.getInfo(search, "userInfo");
|
||||
String clientIp = StringUtil.getInfo(search, "clientIp");
|
||||
Integer status = StringUtil.parseInteger(StringUtil.getInfo(search, "status"));
|
||||
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
|
||||
String tenantType = StringUtil.getInfo(search, "tenantType");
|
||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||
String endTime = StringUtil.getInfo(search, "endTime");
|
||||
String content = StringUtil.getInfo(search, "content");
|
||||
return logService.countLog(operation, userInfo, clientIp, status, beginTime, endTime, content);
|
||||
return logService.countLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,13 +63,13 @@ public class LogService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<LogVo4List> select(String operation, String userInfo, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String content, int offset, int rows)throws Exception {
|
||||
public List<LogVo4List> select(String operation, String userInfo, String clientIp, String tenantLoginName, String tenantType,
|
||||
String beginTime, String endTime, String content, int offset, int rows)throws Exception {
|
||||
List<LogVo4List> list=null;
|
||||
try{
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
list=logMapperEx.selectByConditionLog(operation, userInfo, clientIp, status, beginTime, endTime,
|
||||
list=logMapperEx.selectByConditionLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime,
|
||||
content, offset, rows);
|
||||
if (null != list) {
|
||||
for (LogVo4List log : list) {
|
||||
@@ -82,13 +82,13 @@ public class LogService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countLog(String operation, String userInfo, String clientIp, Integer status, String beginTime, String endTime,
|
||||
String content)throws Exception {
|
||||
public Long countLog(String operation, String userInfo, String clientIp, String tenantLoginName, String tenantType,
|
||||
String beginTime, String endTime, String content)throws Exception {
|
||||
Long result=null;
|
||||
try{
|
||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||
result=logMapperEx.countsByLog(operation, userInfo, clientIp, status, beginTime, endTime, content);
|
||||
result=logMapperEx.countsByLog(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
select l.*,u.login_name,u.username userName
|
||||
FROM jsh_log l
|
||||
left join jsh_user u on l.user_id = u.id and ifnull(u.Status,'0') !='1'
|
||||
left join jsh_tenant t on l.tenant_id=t.tenant_id
|
||||
where 1=1
|
||||
<if test="operation != null">
|
||||
<bind name="bindOperation" value="'%'+operation+'%'"/>
|
||||
@@ -23,8 +24,11 @@
|
||||
<bind name="bindClientIp" value="'%'+clientIp+'%'"/>
|
||||
and l.client_ip like #{bindClientIp}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and l.status=#{status}
|
||||
<if test="tenantLoginName != null">
|
||||
and t.login_name = #{tenantLoginName}
|
||||
</if>
|
||||
<if test="tenantType != null">
|
||||
and t.type = #{tenantType}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and l.create_time >= #{beginTime}
|
||||
@@ -46,6 +50,7 @@
|
||||
COUNT(1)
|
||||
FROM jsh_log l
|
||||
left join jsh_user u on l.user_id = u.id and ifnull(u.Status,'0') !='1'
|
||||
left join jsh_tenant t on l.tenant_id=t.tenant_id
|
||||
WHERE 1=1
|
||||
<if test="operation != null">
|
||||
<bind name="bindOperation" value="'%'+operation+'%'"/>
|
||||
@@ -59,8 +64,11 @@
|
||||
<bind name="bindClientIp" value="'%'+clientIp+'%'"/>
|
||||
and l.client_ip like #{bindClientIp}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and l.status = #{status}
|
||||
<if test="tenantLoginName != null">
|
||||
and t.login_name = #{tenantLoginName}
|
||||
</if>
|
||||
<if test="tenantType != null">
|
||||
and t.type = #{tenantType}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and l.create_time >= #{beginTime}
|
||||
|
||||
Reference in New Issue
Block a user