1.操作日志用户名称

2.操作日志详情的用户名称
3.登录日志的用户名称
pull/4/head
Linjinfeng 2021-03-29 23:04:16 +08:00
parent 44dcfcdd50
commit 98bcac389f
7 changed files with 89 additions and 8 deletions

View File

@ -0,0 +1,62 @@
package cn.stylefeng.roses.kernel.log.api.pojo.loginlog;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
public class SysLoginLogDto extends BaseRequest {
/**
* id
*/
private Long llgId;
/**
*
*/
private String llgName;
/**
*
*/
private String llgSucceed;
/**
*
*/
private String llgMessage;
/**
* ip
*/
private String llgIpAddress;
/**
* id
*/
private Long userId;
/**
*
*/
private String userName;
/**
*
*/
private Date createTime;
/**
*
*/
private String beginTime;
/**
*
*/
private String endTime;
}

View File

@ -30,8 +30,6 @@ import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.system.modular.loginlog.service.SysLoginLogService;
import cn.stylefeng.roses.kernel.system.modular.loginlog.wrapper.SysLoginLogWrapper;
import cn.stylefeng.roses.kernel.wrapper.api.annotation.Wrapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@ -80,7 +78,6 @@ public class SysLoginLogController {
* @date 2021/1/13 17:51
*/
@GetResource(name = "分页查询登录日志", path = "/loginLog/page")
@Wrapper(SysLoginLogWrapper.class)
public ResponseData page(SysLoginLogRequest sysLoginLogRequest) {
return new SuccessResponseData(sysLoginLogService.findPage(sysLoginLogRequest));
}

View File

@ -24,8 +24,12 @@
*/
package cn.stylefeng.roses.kernel.system.modular.loginlog.mapper;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogDto;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogRequest;
import cn.stylefeng.roses.kernel.system.modular.loginlog.entity.SysLoginLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
/**
* mapper
@ -34,4 +38,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2020/3/13 16:17
*/
public interface SysLoginLogMapper extends BaseMapper<SysLoginLog> {
Page<SysLoginLogDto> customFindPage(@Param("page") Page page, @Param("sysLoginLogRequest") SysLoginLogRequest sysLoginLogRequest);
}

View File

@ -2,4 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.stylefeng.roses.kernel.system.modular.loginlog.mapper.SysLoginLogMapper">
<select id="customFindPage" resultType="cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogDto" parameterType="cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogRequest">
select a.llg_id as llgId,a.llg_name as llgName,a.llg_succeed as llgSucceed,a.llg_message as llgMessage,a.llg_ip_address as llgIpAddress ,a.user_id as userId,a.create_time as createTime,b.real_name as userName
from sys_login_log a
left join sys_user b on a.user_id = b.user_id
where 1=1
<if test="sysLoginLogRequest.llgName != null and sysLoginLogRequest.llgName != ''">
and a.llg_name like CONCAT('%',#{sysLoginLogRequest.llgName},'%')
</if>
<if test="sysLoginLogRequest.beginTime != null and sysLoginLogRequest.beginTime != '' and sysLoginLogRequest.endTime != null and sysLoginLogRequest.endTime != ''">
and a.create_time <![CDATA[ >= ]]> #{sysLoginLogRequest.beginTime} and a.create_time <![CDATA[ <= ]]>
#{sysLoginLogRequest.endTime}
</if>
</select>
</mapper>

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.system.modular.loginlog.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogDto;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogRequest;
import cn.stylefeng.roses.kernel.system.modular.loginlog.entity.SysLoginLog;
import com.baomidou.mybatisplus.extension.service.IService;
@ -70,6 +71,6 @@ public interface SysLoginLogService extends IService<SysLoginLog> {
* @author chenjinlong
* @date 2021/1/13 10:57
*/
PageResult<SysLoginLog> findPage(SysLoginLogRequest sysLoginLogRequest);
PageResult<SysLoginLogDto> findPage(SysLoginLogRequest sysLoginLogRequest);
}

View File

@ -31,6 +31,7 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.log.api.LoginLogServiceApi;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogDto;
import cn.stylefeng.roses.kernel.log.api.pojo.loginlog.SysLoginLogRequest;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
@ -66,10 +67,8 @@ public class SysLoginLogServiceImpl extends ServiceImpl<SysLoginLogMapper, SysLo
}
@Override
public PageResult<SysLoginLog> findPage(SysLoginLogRequest sysLoginLogRequest) {
LambdaQueryWrapper<SysLoginLog> wrapper = createWrapper(sysLoginLogRequest);
wrapper.orderByDesc(SysLoginLog::getCreateTime);
Page<SysLoginLog> page = this.page(PageFactory.defaultPage(), wrapper);
public PageResult<SysLoginLogDto> findPage(SysLoginLogRequest sysLoginLogRequest) {
Page<SysLoginLogDto> page = baseMapper.customFindPage(PageFactory.defaultPage(), sysLoginLogRequest);
return PageResultFactory.createPageResult(page);
}

View File

@ -104,6 +104,7 @@ public class LogManagerController {
* @date 2021/1/11 17:36
*/
@GetResource(name = "查看日志详情", path = "/logManager/detail")
@Wrapper(LogInfoWrapper.class)
public ResponseData detail(@Validated(LogManagerRequest.detail.class) LogManagerRequest logManagerRequest) {
return new SuccessResponseData(logManagerApi.detail(logManagerRequest));
}