解决登录时候日志记录的bug
This commit is contained in:
@@ -77,6 +77,8 @@ public class TenantConfig {
|
|||||||
return true;
|
return true;
|
||||||
} else if ("com.jsh.erp.datasource.mappers.RoleMapperEx.getRoleWithoutTenant".equals(ms.getId())) {
|
} else if ("com.jsh.erp.datasource.mappers.RoleMapperEx.getRoleWithoutTenant".equals(ms.getId())) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if ("com.jsh.erp.datasource.mappers.logMapperEx.insertLogWithUserId".equals(ms.getId())) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public class UserController {
|
|||||||
User user=null;
|
User user=null;
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String loginName = userParam.getLoginName().trim();
|
String loginName = userParam.getLoginName().trim();
|
||||||
String password = userParam.getPassword().trim();
|
String password = userParam.getPassword().trim();
|
||||||
//判断用户是否已经登录过,登录过不再处理
|
//判断用户是否已经登录过,登录过不再处理
|
||||||
|
|||||||
@@ -33,4 +33,6 @@ public interface LogMapperEx {
|
|||||||
@Param("moduleName") String moduleName,
|
@Param("moduleName") String moduleName,
|
||||||
@Param("clientIp") String clientIp,
|
@Param("clientIp") String clientIp,
|
||||||
@Param("createTime") String createTime);
|
@Param("createTime") String createTime);
|
||||||
|
|
||||||
|
int insertLogWithUserId(Log log);
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ public class LogService {
|
|||||||
log.setStatus(status);
|
log.setStatus(status);
|
||||||
log.setContent(content);
|
log.setContent(content);
|
||||||
log.setTenantId(tenantId);
|
log.setTenantId(tenantId);
|
||||||
logMapper.insertSelective(log);
|
logMapperEx.insertLogWithUserId(log);
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
|
|||||||
@@ -77,4 +77,13 @@
|
|||||||
<select id="getCountByIpAndDate" resultType="java.lang.Long">
|
<select id="getCountByIpAndDate" resultType="java.lang.Long">
|
||||||
select count(1) from jsh_log where operation=#{moduleName} and client_ip=#{clientIp} and create_time=#{createTime}
|
select count(1) from jsh_log where operation=#{moduleName} and client_ip=#{clientIp} and create_time=#{createTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertLogWithUserId" parameterType="com.jsh.erp.datasource.entities.Log">
|
||||||
|
insert into jsh_log (user_id, operation,
|
||||||
|
client_ip, create_time, status,
|
||||||
|
content, tenant_id)
|
||||||
|
values (#{userId,jdbcType=BIGINT}, #{operation,jdbcType=VARCHAR},
|
||||||
|
#{clientIp,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
|
||||||
|
#{content,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user