zhangyang 2 gadi atpakaļ
vecāks
revīzija
6440b5f2c4

+ 97 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoOperLogController.java

@@ -0,0 +1,97 @@
+package com.ruoyi.web.controller.system;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.PoOperLog;
+import com.ruoyi.system.service.IPoOperLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 操作日志记录Controller
+ * @date 2023-01-15
+ */
+@RestController
+@RequestMapping("/post/operlog")
+public class PoOperLogController extends BaseController
+{
+    @Autowired
+    private IPoOperLogService poOperLogService;
+
+    /**
+     * 查询操作日志记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(PoOperLog poOperLog)
+    {
+        startPage();
+        List<PoOperLog> list = poOperLogService.selectPoOperLogList(poOperLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出操作日志记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:export')")
+    @Log(title = "操作日志记录", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, PoOperLog poOperLog)
+    {
+        List<PoOperLog> list = poOperLogService.selectPoOperLogList(poOperLog);
+        ExcelUtil<PoOperLog> util = new ExcelUtil<PoOperLog>(PoOperLog.class);
+        util.exportExcel(response, list, "操作日志记录数据");
+    }
+
+    /**
+     * 获取操作日志记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:query')")
+    @GetMapping(value = "/{operId}")
+    public AjaxResult getInfo(@PathVariable("operId") Long operId)
+    {
+        return success(poOperLogService.selectPoOperLogByOperId(operId));
+    }
+
+    /**
+     * 新增操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:add')")
+    @Log(title = "操作日志记录", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody PoOperLog poOperLog)
+    {
+        return toAjax(poOperLogService.insertPoOperLog(poOperLog));
+    }
+
+    /**
+     * 修改操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:edit')")
+    @Log(title = "操作日志记录", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit")
+    public AjaxResult edit(@RequestBody PoOperLog poOperLog)
+    {
+        return toAjax(poOperLogService.updatePoOperLog(poOperLog));
+    }
+
+    /**
+     * 删除操作日志记录
+     */
+    @PreAuthorize("@ss.hasPermi('post:operlog:remove')")
+    @Log(title = "操作日志记录", businessType = BusinessType.DELETE)
+    @DeleteMapping("/remove/{operIds}")
+    public AjaxResult remove(@PathVariable Long[] operIds)
+    {
+        return toAjax(poOperLogService.deletePoOperLogByOperIds(operIds));
+    }
+}
+

+ 263 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/PoOperLog.java

@@ -0,0 +1,263 @@
+package com.ruoyi.system.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 操作日志记录对象 po_oper_log
+ * @date 2023-01-15
+ */
+public class PoOperLog extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 日志主键 */
+    private Long operId;
+
+    /** 模块标题 */
+    @Excel(name = "模块标题")
+    private String title;
+
+    /** 业务类型(0其它 1新增 2修改 3删除) */
+    @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除")
+    private Long businessType;
+
+    /** 方法名称 */
+    @Excel(name = "方法名称")
+    private String method;
+
+    /** 请求方式 */
+    @Excel(name = "请求方式")
+    private String requestMethod;
+
+    /** 操作类别(0其它 1后台用户 2手机端用户) */
+    @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
+    private Long operatorType;
+
+    /** 操作人员 */
+    @Excel(name = "操作人员")
+    private String operName;
+
+    /** 部门名称 */
+    @Excel(name = "部门名称")
+    private String deptName;
+
+    /** 请求URL */
+    @Excel(name = "请求URL")
+    private String operUrl;
+
+    /** 主机地址 */
+    @Excel(name = "主机地址")
+    private String operIp;
+
+    /** 操作地点 */
+    @Excel(name = "操作地点")
+    private String operLocation;
+
+    /** 请求参数 */
+    @Excel(name = "请求参数")
+    private String operParam;
+
+    /** 返回参数 */
+    @Excel(name = "返回参数")
+    private String jsonResult;
+
+    /** 操作状态(0正常 1异常) */
+    @Excel(name = "操作状态", readConverterExp = "0=正常,1=异常")
+    private Long status;
+
+    /** 错误消息 */
+    @Excel(name = "错误消息")
+    private String errorMsg;
+
+    /** 操作时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date operTime;
+
+    /** 排序 */
+    @Excel(name = "排序")
+    private Long sort;
+
+    public void setOperId(Long operId)
+    {
+        this.operId = operId;
+    }
+
+    public Long getOperId()
+    {
+        return operId;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setBusinessType(Long businessType)
+    {
+        this.businessType = businessType;
+    }
+
+    public Long getBusinessType()
+    {
+        return businessType;
+    }
+    public void setMethod(String method)
+    {
+        this.method = method;
+    }
+
+    public String getMethod()
+    {
+        return method;
+    }
+    public void setRequestMethod(String requestMethod)
+    {
+        this.requestMethod = requestMethod;
+    }
+
+    public String getRequestMethod()
+    {
+        return requestMethod;
+    }
+    public void setOperatorType(Long operatorType)
+    {
+        this.operatorType = operatorType;
+    }
+
+    public Long getOperatorType()
+    {
+        return operatorType;
+    }
+    public void setOperName(String operName)
+    {
+        this.operName = operName;
+    }
+
+    public String getOperName()
+    {
+        return operName;
+    }
+    public void setDeptName(String deptName)
+    {
+        this.deptName = deptName;
+    }
+
+    public String getDeptName()
+    {
+        return deptName;
+    }
+    public void setOperUrl(String operUrl)
+    {
+        this.operUrl = operUrl;
+    }
+
+    public String getOperUrl()
+    {
+        return operUrl;
+    }
+    public void setOperIp(String operIp)
+    {
+        this.operIp = operIp;
+    }
+
+    public String getOperIp()
+    {
+        return operIp;
+    }
+    public void setOperLocation(String operLocation)
+    {
+        this.operLocation = operLocation;
+    }
+
+    public String getOperLocation()
+    {
+        return operLocation;
+    }
+    public void setOperParam(String operParam)
+    {
+        this.operParam = operParam;
+    }
+
+    public String getOperParam()
+    {
+        return operParam;
+    }
+    public void setJsonResult(String jsonResult)
+    {
+        this.jsonResult = jsonResult;
+    }
+
+    public String getJsonResult()
+    {
+        return jsonResult;
+    }
+    public void setStatus(Long status)
+    {
+        this.status = status;
+    }
+
+    public Long getStatus()
+    {
+        return status;
+    }
+    public void setErrorMsg(String errorMsg)
+    {
+        this.errorMsg = errorMsg;
+    }
+
+    public String getErrorMsg()
+    {
+        return errorMsg;
+    }
+    public void setOperTime(Date operTime)
+    {
+        this.operTime = operTime;
+    }
+
+    public Date getOperTime()
+    {
+        return operTime;
+    }
+    public void setSort(Long sort)
+    {
+        this.sort = sort;
+    }
+
+    public Long getSort()
+    {
+        return sort;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+                .append("operId", getOperId())
+                .append("title", getTitle())
+                .append("businessType", getBusinessType())
+                .append("method", getMethod())
+                .append("requestMethod", getRequestMethod())
+                .append("operatorType", getOperatorType())
+                .append("operName", getOperName())
+                .append("deptName", getDeptName())
+                .append("operUrl", getOperUrl())
+                .append("operIp", getOperIp())
+                .append("operLocation", getOperLocation())
+                .append("operParam", getOperParam())
+                .append("jsonResult", getJsonResult())
+                .append("status", getStatus())
+                .append("errorMsg", getErrorMsg())
+                .append("operTime", getOperTime())
+                .append("sort", getSort())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PoOperLogMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.PoOperLog;
+
+import java.util.List;
+
+/**
+ * 操作日志记录Mapper接口
+ * @date 2023-01-15
+ */
+public interface PoOperLogMapper
+{
+    /**
+     * 查询操作日志记录
+     *
+     * @param operId 操作日志记录主键
+     * @return 操作日志记录
+     */
+    public PoOperLog selectPoOperLogByOperId(Long operId);
+
+    /**
+     * 查询操作日志记录列表
+     *
+     * @param poOperLog 操作日志记录
+     * @return 操作日志记录集合
+     */
+    public List<PoOperLog> selectPoOperLogList(PoOperLog poOperLog);
+
+    /**
+     * 新增操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    public int insertPoOperLog(PoOperLog poOperLog);
+
+    /**
+     * 修改操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    public int updatePoOperLog(PoOperLog poOperLog);
+
+    /**
+     * 删除操作日志记录
+     *
+     * @param operId 操作日志记录主键
+     * @return 结果
+     */
+    public int deletePoOperLogByOperId(Long operId);
+
+    /**
+     * 批量删除操作日志记录
+     *
+     * @param operIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deletePoOperLogByOperIds(Long[] operIds);
+}
+

+ 60 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPoOperLogService.java

@@ -0,0 +1,60 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.PoOperLog;
+
+import java.util.List;
+
+/**
+ * 操作日志记录Service接口
+ * @date 2023-01-15
+ */
+public interface IPoOperLogService
+{
+    /**
+     * 查询操作日志记录
+     *
+     * @param operId 操作日志记录主键
+     * @return 操作日志记录
+     */
+    public PoOperLog selectPoOperLogByOperId(Long operId);
+
+    /**
+     * 查询操作日志记录列表
+     *
+     * @param poOperLog 操作日志记录
+     * @return 操作日志记录集合
+     */
+    public List<PoOperLog> selectPoOperLogList(PoOperLog poOperLog);
+
+    /**
+     * 新增操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    public int insertPoOperLog(PoOperLog poOperLog);
+
+    /**
+     * 修改操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    public int updatePoOperLog(PoOperLog poOperLog);
+
+    /**
+     * 批量删除操作日志记录
+     *
+     * @param operIds 需要删除的操作日志记录主键集合
+     * @return 结果
+     */
+    public int deletePoOperLogByOperIds(Long[] operIds);
+
+    /**
+     * 删除操作日志记录信息
+     *
+     * @param operId 操作日志记录主键
+     * @return 结果
+     */
+    public int deletePoOperLogByOperId(Long operId);
+}

+ 93 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoOperLogServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.system.service.impl;
+
+import com.ruoyi.system.domain.PoOperLog;
+import com.ruoyi.system.mapper.PoOperLogMapper;
+import com.ruoyi.system.service.IPoOperLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 操作日志记录Service业务层处理
+ * @date 2023-01-15
+ */
+@Service
+public class PoOperLogServiceImpl implements IPoOperLogService
+{
+    @Autowired
+    private PoOperLogMapper poOperLogMapper;
+
+    /**
+     * 查询操作日志记录
+     *
+     * @param operId 操作日志记录主键
+     * @return 操作日志记录
+     */
+    @Override
+    public PoOperLog selectPoOperLogByOperId(Long operId)
+    {
+        return poOperLogMapper.selectPoOperLogByOperId(operId);
+    }
+
+    /**
+     * 查询操作日志记录列表
+     *
+     * @param poOperLog 操作日志记录
+     * @return 操作日志记录
+     */
+    @Override
+    public List<PoOperLog> selectPoOperLogList(PoOperLog poOperLog)
+    {
+        return poOperLogMapper.selectPoOperLogList(poOperLog);
+    }
+
+    /**
+     * 新增操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    @Override
+    public int insertPoOperLog(PoOperLog poOperLog)
+    {
+        return poOperLogMapper.insertPoOperLog(poOperLog);
+    }
+
+    /**
+     * 修改操作日志记录
+     *
+     * @param poOperLog 操作日志记录
+     * @return 结果
+     */
+    @Override
+    public int updatePoOperLog(PoOperLog poOperLog)
+    {
+        return poOperLogMapper.updatePoOperLog(poOperLog);
+    }
+
+    /**
+     * 批量删除操作日志记录
+     *
+     * @param operIds 需要删除的操作日志记录主键
+     * @return 结果
+     */
+    @Override
+    public int deletePoOperLogByOperIds(Long[] operIds)
+    {
+        return poOperLogMapper.deletePoOperLogByOperIds(operIds);
+    }
+
+    /**
+     * 删除操作日志记录信息
+     *
+     * @param operId 操作日志记录主键
+     * @return 结果
+     */
+    @Override
+    public int deletePoOperLogByOperId(Long operId)
+    {
+        return poOperLogMapper.deletePoOperLogByOperId(operId);
+    }
+}
+

+ 138 - 0
ruoyi-system/src/main/resources/mapper/system/PoOperLogMapper.xml

@@ -0,0 +1,138 @@
+<?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.ruoyi.system.mapper.PoOperLogMapper">
+
+    <resultMap type="PoOperLog" id="PoOperLogResult">
+        <result property="operId"    column="oper_id"    />
+        <result property="title"    column="title"    />
+        <result property="businessType"    column="business_type"    />
+        <result property="method"    column="method"    />
+        <result property="requestMethod"    column="request_method"    />
+        <result property="operatorType"    column="operator_type"    />
+        <result property="operName"    column="oper_name"    />
+        <result property="deptName"    column="dept_name"    />
+        <result property="operUrl"    column="oper_url"    />
+        <result property="operIp"    column="oper_ip"    />
+        <result property="operLocation"    column="oper_location"    />
+        <result property="operParam"    column="oper_param"    />
+        <result property="jsonResult"    column="json_result"    />
+        <result property="status"    column="status"    />
+        <result property="errorMsg"    column="error_msg"    />
+        <result property="operTime"    column="oper_time"    />
+        <result property="sort"    column="sort"    />
+    </resultMap>
+<!--查询po_oper_log表所有-->
+    <sql id="selectPoOperLogVo">
+        select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, sort from po_oper_log
+    </sql>
+
+<!--    分页查询-->
+    <select id="selectPoOperLogList" parameterType="PoOperLog" resultMap="PoOperLogResult">
+        <include refid="selectPoOperLogVo"/>
+        <where>
+            <if test="title != null  and title != ''"> and title = #{title}</if>
+            <if test="businessType != null "> and business_type = #{businessType}</if>
+            <if test="method != null  and method != ''"> and method = #{method}</if>
+            <if test="requestMethod != null  and requestMethod != ''"> and request_method = #{requestMethod}</if>
+            <if test="operatorType != null "> and operator_type = #{operatorType}</if>
+            <if test="operName != null  and operName != ''"> and oper_name like concat('%', #{operName}, '%')</if>
+            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="operUrl != null  and operUrl != ''"> and oper_url = #{operUrl}</if>
+            <if test="operIp != null  and operIp != ''"> and oper_ip = #{operIp}</if>
+            <if test="operLocation != null  and operLocation != ''"> and oper_location = #{operLocation}</if>
+            <if test="operParam != null  and operParam != ''"> and oper_param = #{operParam}</if>
+            <if test="jsonResult != null  and jsonResult != ''"> and json_result = #{jsonResult}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="errorMsg != null  and errorMsg != ''"> and error_msg = #{errorMsg}</if>
+            <if test="operTime != null "> and oper_time = #{operTime}</if>
+            <if test="sort != null "> and sort = #{sort}</if>
+        </where>
+    </select>
+
+<!--    根据Id查询-->
+    <select id="selectPoOperLogByOperId" parameterType="Long" resultMap="PoOperLogResult">
+        <include refid="selectPoOperLogVo"/>
+        where oper_id = #{operId}
+    </select>
+
+<!--    增加-->
+    <insert id="insertPoOperLog" parameterType="PoOperLog" useGeneratedKeys="true" keyProperty="operId">
+        insert into po_oper_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="title != null">title,</if>
+            <if test="businessType != null">business_type,</if>
+            <if test="method != null and method != ''">method,</if>
+            <if test="requestMethod != null">request_method,</if>
+            <if test="operatorType != null">operator_type,</if>
+            <if test="operName != null">oper_name,</if>
+            <if test="deptName != null">dept_name,</if>
+            <if test="operUrl != null">oper_url,</if>
+            <if test="operIp != null">oper_ip,</if>
+            <if test="operLocation != null">oper_location,</if>
+            <if test="operParam != null">oper_param,</if>
+            <if test="jsonResult != null">json_result,</if>
+            <if test="status != null">status,</if>
+            <if test="errorMsg != null">error_msg,</if>
+            <if test="operTime != null">oper_time,</if>
+            <if test="sort != null">sort,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="title != null">#{title},</if>
+            <if test="businessType != null">#{businessType},</if>
+            <if test="method != null and method != ''">#{method},</if>
+            <if test="requestMethod != null">#{requestMethod},</if>
+            <if test="operatorType != null">#{operatorType},</if>
+            <if test="operName != null">#{operName},</if>
+            <if test="deptName != null">#{deptName},</if>
+            <if test="operUrl != null">#{operUrl},</if>
+            <if test="operIp != null">#{operIp},</if>
+            <if test="operLocation != null">#{operLocation},</if>
+            <if test="operParam != null">#{operParam},</if>
+            <if test="jsonResult != null">#{jsonResult},</if>
+            <if test="status != null">#{status},</if>
+            <if test="errorMsg != null">#{errorMsg},</if>
+            <if test="operTime != null">#{operTime},</if>
+            <if test="sort != null">#{sort},</if>
+        </trim>
+    </insert>
+
+<!--    修改-->
+    <update id="updatePoOperLog" parameterType="PoOperLog">
+        update po_oper_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="title != null">title = #{title},</if>
+            <if test="businessType != null">business_type = #{businessType},</if>
+            <if test="method != null and method != ''">method = #{method},</if>
+            <if test="requestMethod != null">request_method = #{requestMethod},</if>
+            <if test="operatorType != null">operator_type = #{operatorType},</if>
+            <if test="operName != null">oper_name = #{operName},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="operUrl != null">oper_url = #{operUrl},</if>
+            <if test="operIp != null">oper_ip = #{operIp},</if>
+            <if test="operLocation != null">oper_location = #{operLocation},</if>
+            <if test="operParam != null">oper_param = #{operParam},</if>
+            <if test="jsonResult != null">json_result = #{jsonResult},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="errorMsg != null">error_msg = #{errorMsg},</if>
+            <if test="operTime != null">oper_time = #{operTime},</if>
+            <if test="sort != null">sort = #{sort},</if>
+        </trim>
+        where oper_id = #{operId}
+    </update>
+
+<!--    删除-->
+    <delete id="deletePoOperLogByOperId" parameterType="Long">
+        delete from po_oper_log where oper_id = #{operId}
+    </delete>
+
+<!--    批量删除-->
+    <delete id="deletePoOperLogByOperIds" parameterType="String">
+        delete from po_oper_log where oper_id in
+        <foreach item="operId" collection="array" open="(" separator="," close=")">
+            #{operId}
+        </foreach>
+    </delete>
+</mapper>
+