mirror of https://gitee.com/stylefeng/roses
parent
44dcfcdd50
commit
98bcac389f
|
@ -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;
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue