parent
10a309edd8
commit
dee18115ca
@ -0,0 +1,36 @@
|
|||||||
|
package com.dsic.gj_erp.bean.sy;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class SyUserLog extends Model<SyUserLog> {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String yhdm;
|
||||||
|
|
||||||
|
private String yhms;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private String mac;
|
||||||
|
|
||||||
|
private String created;//操作时间
|
||||||
|
|
||||||
|
private String type;//操作类型
|
||||||
|
|
||||||
|
private String result;//操作结果
|
||||||
|
|
||||||
|
private String content;//操作内容
|
||||||
|
|
||||||
|
private String path;//菜单hash路径
|
||||||
|
|
||||||
|
private enum Type{
|
||||||
|
LOGIN,REDIRECT
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.dsic.gj_erp.controller.sy;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.dsic.gj_erp.annotation.AuthFunction;
|
||||||
|
import com.dsic.gj_erp.bean.ResultBean;
|
||||||
|
import com.dsic.gj_erp.bean.sy.SyUserLog;
|
||||||
|
import com.dsic.gj_erp.util.IPUtils;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.net.SocketException;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("userLog")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SyUserLogController {
|
||||||
|
|
||||||
|
@PostMapping("save")
|
||||||
|
@AuthFunction
|
||||||
|
public ResultBean<?> save(@RequestBody SyUserLog log, HttpServletRequest request){
|
||||||
|
String name= (String) request.getAttribute("yhms");
|
||||||
|
String yhdm= (String) request.getAttribute("yhdm");
|
||||||
|
log.setYhdm(yhdm);
|
||||||
|
log.setYhms(name);
|
||||||
|
String ipAddr = IPUtils.getIpAddr(request);
|
||||||
|
log.setIp(ipAddr);
|
||||||
|
log.setMac(IPUtils.getMACAddress(ipAddr));
|
||||||
|
log.setCreated(DateUtil.now());
|
||||||
|
log.insert();
|
||||||
|
return new ResultBean<>();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.dsic.gj_erp.mapper.sy;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.dsic.gj_erp.bean.sy.SyUserLog;
|
||||||
|
|
||||||
|
public interface SyUserLogMapper extends BaseMapper<SyUserLog> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
|
||||||
|
<mapper namespace="com.dsic.gj_erp.mapper.SyuserMapper">
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in new issue