feat: 生成用户登录日志
This commit is contained in:
parent
364a038d14
commit
6fcf473df8
|
@ -3,9 +3,11 @@ package cn.bunny.common.generator.generator;
|
|||
import cn.bunny.common.generator.entity.BaseField;
|
||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||
import cn.bunny.dao.dto.log.ScheduleExecuteLogDto;
|
||||
import cn.bunny.dao.entity.log.ScheduleExecuteLog;
|
||||
import cn.bunny.dao.vo.log.QuartzExecuteLogVo;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogAddDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogUpdateDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import cn.bunny.dao.vo.log.UserLoginLogVo;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -34,26 +36,26 @@ import java.util.stream.Stream;
|
|||
@Service
|
||||
public class WebGeneratorCode {
|
||||
// 公共路径
|
||||
public static String commonPath = "D:\\MyFolder\\auth-admin\\auth-web\\src";
|
||||
public static String commonPath = "D:\\Project\\web\\PC\\auth\\auth-web\\src";
|
||||
// 生成API请求路径
|
||||
public static String apiPath = commonPath + "\\api\\v1\\";
|
||||
// 生成vue路径
|
||||
public static String vuePath = commonPath + "\\views\\scheduler\\";
|
||||
public static String vuePath = commonPath + "\\views\\monitor\\";
|
||||
// 生成仓库路径
|
||||
public static String storePath = commonPath + "\\store\\scheduler\\";
|
||||
public static String storePath = commonPath + "\\store\\monitor\\";
|
||||
// 后端controller
|
||||
public static String controllerPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||
public static String servicePath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||
public static String serviceImplPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
||||
public static String mapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
||||
public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||
public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||
public static String serviceImplPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
||||
public static String mapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
||||
public static String resourceMapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class<?> originalClass = ScheduleExecuteLog.class;
|
||||
Class<?> dtoClass = ScheduleExecuteLogDto.class;
|
||||
Class<?> addDtoClass = QuartzExecuteLogAddDto.class;
|
||||
Class<?> updateDtoClass = QuartzExecuteLogUpdateDto.class;
|
||||
Class<?> voClass = QuartzExecuteLogVo.class;
|
||||
Class<?> originalClass = UserLoginLog.class;
|
||||
Class<?> dtoClass = UserLoginLogDto.class;
|
||||
Class<?> addDtoClass = UserLoginLogAddDto.class;
|
||||
Class<?> updateDtoClass = UserLoginLogUpdateDto.class;
|
||||
Class<?> voClass = UserLoginLogVo.class;
|
||||
|
||||
// 设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.dao.entity.system.${originalName};
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.services.mapper.${originalName}Mapper;
|
||||
import cn.bunny.services.service.${originalName}Service;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
||||
#foreach($item in $baseFieldList)
|
||||
|
||||
// $item.annotation
|
||||
<!-- $item.annotation -->
|
||||
<el-form-item :label="$t('${lowercaseName}_${item.name}')" prop="$item.name">
|
||||
<el-input v-model="form.$item.name" autocomplete="off" type="text" :placeholder="$t('input') + $t('${lowercaseName}_${item.name}')" />
|
||||
</el-form-item>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package cn.bunny.dao.dto.log;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserLoginLogDto对象", title = "用户登录日志分页查询", description = "用户登录日志分页查询")
|
||||
public class UserLoginLogAddDto {
|
||||
|
||||
@Schema(name = "userId", title = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "token", title = "登录token")
|
||||
private String token;
|
||||
|
||||
@Schema(name = "ip", title = "登录Ip")
|
||||
private String ip;
|
||||
|
||||
@Schema(name = "ipAddress", title = "登录Ip地点")
|
||||
private String ipAddress;
|
||||
|
||||
@Schema(name = "userAgent", title = "登录时代理")
|
||||
private String userAgent;
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package cn.bunny.dao.dto.log;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserLoginLogDto对象", title = "用户登录日志分页查询", description = "用户登录日志分页查询")
|
||||
public class UserLoginLogDto {
|
||||
|
||||
@Schema(name = "userId", title = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "token", title = "登录token")
|
||||
private String token;
|
||||
|
||||
@Schema(name = "ip", title = "登录Ip")
|
||||
private String ip;
|
||||
|
||||
@Schema(name = "ipAddress", title = "登录Ip地点")
|
||||
private String ipAddress;
|
||||
|
||||
@Schema(name = "userAgent", title = "登录时代理")
|
||||
private String userAgent;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package cn.bunny.dao.dto.log;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserLoginLogDto对象", title = "用户登录日志分页查询", description = "用户登录日志分页查询")
|
||||
public class UserLoginLogUpdateDto {
|
||||
|
||||
@Schema(name = "userId", title = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "token", title = "登录token")
|
||||
private String token;
|
||||
|
||||
@Schema(name = "ip", title = "登录Ip")
|
||||
private String ip;
|
||||
|
||||
@Schema(name = "ipAddress", title = "登录Ip地点")
|
||||
private String ipAddress;
|
||||
|
||||
@Schema(name = "userAgent", title = "登录时代理")
|
||||
private String userAgent;
|
||||
|
||||
}
|
|
@ -2,8 +2,7 @@ package cn.bunny.dao.entity.log;
|
|||
|
||||
import cn.bunny.dao.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -20,25 +19,25 @@ import lombok.experimental.Accessors;
|
|||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("log_user_login")
|
||||
@ApiModel(value = "UserLogin对象", description = "用户登录日志")
|
||||
@Schema(name = "UserLogin对象", title = "用户登录日志", description = "用户登录日志")
|
||||
public class UserLoginLog extends BaseEntity {
|
||||
|
||||
@ApiModelProperty("用户Id")
|
||||
@Schema(name = "userId", title = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("登录token")
|
||||
@Schema(name = "token", title = "登录token")
|
||||
private String token;
|
||||
|
||||
@ApiModelProperty("登录Ip")
|
||||
@Schema(name = "ip", title = "登录Ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("登录Ip地点")
|
||||
@Schema(name = "ipAddress", title = "登录Ip地点")
|
||||
private String ipAddress;
|
||||
|
||||
@ApiModelProperty("登录时代理")
|
||||
@Schema(name = "userAgent", title = "登录时代理")
|
||||
private String userAgent;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package cn.bunny.dao.vo.log;
|
||||
|
||||
import cn.bunny.dao.vo.common.BaseVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "UserLoginLogVo对象", title = "用户登录日志", description = "用户登录日志")
|
||||
public class UserLoginLogVo extends BaseVo {
|
||||
|
||||
@Schema(name = "userId", title = "用户Id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "token", title = "登录token")
|
||||
private String token;
|
||||
|
||||
@Schema(name = "ip", title = "登录Ip")
|
||||
private String ip;
|
||||
|
||||
@Schema(name = "ipAddress", title = "登录Ip地点")
|
||||
private String ipAddress;
|
||||
|
||||
@Schema(name = "userAgent", title = "登录时代理")
|
||||
private String userAgent;
|
||||
|
||||
}
|
|
@ -1,18 +1,72 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogAddDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogUpdateDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.log.UserLoginLogVo;
|
||||
import cn.bunny.services.service.UserLoginLogService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户登录日志 前端控制器
|
||||
* 用户登录日志表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-18
|
||||
* @since 2024-10-18 22:36:07
|
||||
*/
|
||||
@Tag(name = "用户登录日志", description = "用户登录日志相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/userLogin")
|
||||
@RequestMapping("admin/userLoginLog")
|
||||
public class UserLoginLogController {
|
||||
|
||||
@Autowired
|
||||
private UserLoginLogService userLoginLogService;
|
||||
|
||||
@Operation(summary = "分页查询用户登录日志", description = "分页查询用户登录日志")
|
||||
@GetMapping("getUserLoginLogList/{page}/{limit}")
|
||||
public Mono<Result<PageResult<UserLoginLogVo>>> getUserLoginLogList(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
UserLoginLogDto dto) {
|
||||
Page<UserLoginLog> pageParams = new Page<>(page, limit);
|
||||
PageResult<UserLoginLogVo> pageResult = userLoginLogService.getUserLoginLogList(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加用户登录日志", description = "添加用户登录日志")
|
||||
@PostMapping("addUserLoginLog")
|
||||
public Mono<Result<String>> addUserLoginLog(@Valid @RequestBody UserLoginLogAddDto dto) {
|
||||
userLoginLogService.addUserLoginLog(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新用户登录日志", description = "更新用户登录日志")
|
||||
@PutMapping("updateUserLoginLog")
|
||||
public Mono<Result<String>> updateUserLoginLog(@Valid @RequestBody UserLoginLogUpdateDto dto) {
|
||||
userLoginLogService.updateUserLoginLog(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除用户登录日志", description = "删除用户登录日志")
|
||||
@DeleteMapping("deleteUserLoginLog")
|
||||
public Mono<Result<String>> deleteUserLoginLog(@RequestBody List<Long> ids) {
|
||||
userLoginLogService.deleteUserLoginLog(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -10,9 +16,24 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-18
|
||||
* @since 2024-10-18 22:36:07
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserLoginLogMapper extends BaseMapper<UserLoginLog> {
|
||||
|
||||
/**
|
||||
* * 分页查询用户登录日志内容
|
||||
*
|
||||
* @param pageParams 用户登录日志分页参数
|
||||
* @param dto 用户登录日志查询表单
|
||||
* @return 用户登录日志分页结果
|
||||
*/
|
||||
IPage<UserLoginLog> selectListByPage(@Param("page") Page<UserLoginLog> pageParams, @Param("dto") UserLoginLogDto dto);
|
||||
|
||||
/**
|
||||
* 物理删除用户登录日志
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.dto.log.UserLoginLogAddDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogUpdateDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.log.UserLoginLogVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -9,8 +18,35 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-18
|
||||
* @since 2024-10-18 22:36:07
|
||||
*/
|
||||
public interface UserLoginLogService extends IService<UserLoginLog> {
|
||||
|
||||
/**
|
||||
* * 获取用户登录日志列表
|
||||
*
|
||||
* @return 用户登录日志返回列表
|
||||
*/
|
||||
PageResult<UserLoginLogVo> getUserLoginLogList(Page<UserLoginLog> pageParams, UserLoginLogDto dto);
|
||||
|
||||
/**
|
||||
* * 添加用户登录日志
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void addUserLoginLog(@Valid UserLoginLogAddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新用户登录日志
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void updateUserLoginLog(@Valid UserLoginLogUpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除用户登录日志类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void deleteUserLoginLog(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,92 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.dao.dto.log.UserLoginLogAddDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogDto;
|
||||
import cn.bunny.dao.dto.log.UserLoginLogUpdateDto;
|
||||
import cn.bunny.dao.entity.log.UserLoginLog;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.log.UserLoginLogVo;
|
||||
import cn.bunny.services.mapper.UserLoginLogMapper;
|
||||
import cn.bunny.services.service.UserLoginLogService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户登录日志 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-10-18
|
||||
* @since 2024-10-18 22:36:07
|
||||
*/
|
||||
@Service
|
||||
public class UserLoginLogServiceImpl extends ServiceImpl<UserLoginLogMapper, UserLoginLog> implements UserLoginLogService {
|
||||
|
||||
/**
|
||||
* * 用户登录日志 服务实现类
|
||||
*
|
||||
* @param pageParams 用户登录日志分页查询page对象
|
||||
* @param dto 用户登录日志分页查询对象
|
||||
* @return 查询分页用户登录日志返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<UserLoginLogVo> getUserLoginLogList(Page<UserLoginLog> pageParams, UserLoginLogDto dto) {
|
||||
// 分页查询菜单图标
|
||||
IPage<UserLoginLog> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
List<UserLoginLogVo> voList = page.getRecords().stream().map(userLoginLog -> {
|
||||
UserLoginLogVo userLoginLogVo = new UserLoginLogVo();
|
||||
BeanUtils.copyProperties(userLoginLog, userLoginLogVo);
|
||||
return userLoginLogVo;
|
||||
}).toList();
|
||||
|
||||
return PageResult.<UserLoginLogVo>builder()
|
||||
.list(voList)
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户登录日志
|
||||
*
|
||||
* @param dto 用户登录日志添加
|
||||
*/
|
||||
@Override
|
||||
public void addUserLoginLog(@Valid UserLoginLogAddDto dto) {
|
||||
// 保存数据
|
||||
UserLoginLog userLoginLog = new UserLoginLog();
|
||||
BeanUtils.copyProperties(dto, userLoginLog);
|
||||
save(userLoginLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户登录日志
|
||||
*
|
||||
* @param dto 用户登录日志更新
|
||||
*/
|
||||
@Override
|
||||
public void updateUserLoginLog(@Valid UserLoginLogUpdateDto dto) {
|
||||
// 更新内容
|
||||
UserLoginLog userLoginLog = new UserLoginLog();
|
||||
BeanUtils.copyProperties(dto, userLoginLog);
|
||||
updateById(userLoginLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除用户登录日志
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserLoginLog(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,23 +4,61 @@
|
|||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.log.UserLoginLog">
|
||||
<id column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="token" property="token"/>
|
||||
<result column="ip" property="ip"/>
|
||||
<result column="ip_address" property="ipAddress"/>
|
||||
<result column="user_agent" property="userAgent"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<id column="id" property="id"/>
|
||||
<id column="create_time" property="createTime"/>
|
||||
<id column="update_time" property="updateTime"/>
|
||||
<id column="create_user" property="createUser"/>
|
||||
<id column="update_user" property="updateUser"/>
|
||||
<id column="is_deleted" property="isDeleted"/>
|
||||
<id column="user_id" property="userId"/>
|
||||
<id column="username" property="username"/>
|
||||
<id column="token" property="token"/>
|
||||
<id column="ip" property="ip"/>
|
||||
<id column="ip_address" property="ipAddress"/>
|
||||
<id column="user_agent" property="userAgent"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, username, token, ip, ip_address, user_agent, create_time, update_time, create_user, update_user, is_deleted
|
||||
id, create_time, update_time, create_user, update_user, is_deleted, user_id, username, token, ip, ip_address, user_agent
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询用户登录日志内容 -->
|
||||
<select id="selectListByPage" resultType="cn.bunny.dao.entity.log.UserLoginLog">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from log_user_login
|
||||
<where>
|
||||
<if test="dto.userId != null and dto.userId != ''">
|
||||
and user_id like CONCAT('%',#{dto.userId},'%')
|
||||
</if>
|
||||
<if test="dto.username != null and dto.username != ''">
|
||||
and username like CONCAT('%',#{dto.username},'%')
|
||||
</if>
|
||||
<if test="dto.token != null and dto.token != ''">
|
||||
and token like CONCAT('%',#{dto.token},'%')
|
||||
</if>
|
||||
<if test="dto.ip != null and dto.ip != ''">
|
||||
and ip like CONCAT('%',#{dto.ip},'%')
|
||||
</if>
|
||||
<if test="dto.ipAddress != null and dto.ipAddress != ''">
|
||||
and ip_address like CONCAT('%',#{dto.ipAddress},'%')
|
||||
</if>
|
||||
<if test="dto.userAgent != null and dto.userAgent != ''">
|
||||
and user_agent like CONCAT('%',#{dto.userAgent},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除用户登录日志 -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete
|
||||
from log_user_login
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue