审计日志相关代码提交
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.system.service.impl;
|
package com.njcn.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||||
import com.njcn.system.mapper.UserLogMapper;
|
import com.njcn.system.mapper.UserLogMapper;
|
||||||
@@ -26,6 +27,42 @@ public class UserLogServiceImpl extends ServiceImpl<UserLogMapper, UserLog> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addUserLog(LogInfoDTO logInfoDTO) {
|
public void addUserLog(LogInfoDTO logInfoDTO) {
|
||||||
|
UserLog userLog = new UserLog();
|
||||||
|
BeanUtil.copyProperties(logInfoDTO, userLog);
|
||||||
|
if(logInfoDTO.getIsLogin() == 0){
|
||||||
|
userLog.setCreateBy(userLog.getUserName());
|
||||||
|
userLog.setUpdateBy(userLog.getUserName());
|
||||||
|
}
|
||||||
|
userLog.setState(0);
|
||||||
|
this.baseMapper.insert(userLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 严重度 文字 转 数字
|
||||||
|
*/
|
||||||
|
private Integer levelStringToNumber(String level) {
|
||||||
|
switch (level) {
|
||||||
|
case "中等":
|
||||||
|
return 1;
|
||||||
|
case "严重":
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 严重度 数字 转 文字
|
||||||
|
*/
|
||||||
|
private String levelNumberToString(Integer level) {
|
||||||
|
switch (level) {
|
||||||
|
case 1:
|
||||||
|
return "中等";
|
||||||
|
case 2:
|
||||||
|
return "严重";
|
||||||
|
default:
|
||||||
|
return "普通";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user