parent
9ee9f820dc
commit
379281f949
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询日志列表
|
||||||
|
export function listLog(query) {
|
||||||
|
return request({
|
||||||
|
url: '/english/log/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询日志详细
|
||||||
|
export function getLog(id) {
|
||||||
|
return request({
|
||||||
|
url: '/english/log/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增日志
|
||||||
|
export function addLog(data) {
|
||||||
|
return request({
|
||||||
|
url: '/english/log',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改日志
|
||||||
|
export function updateLog(data) {
|
||||||
|
return request({
|
||||||
|
url: '/english/log',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除日志
|
||||||
|
export function delLog(id) {
|
||||||
|
return request({
|
||||||
|
url: '/english/log/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -0,0 +1,263 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="接口名称" prop="apiName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.apiName"
|
||||||
|
placeholder="请输入接口名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否请求成功" prop="isSuccess">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.isSuccess"
|
||||||
|
placeholder="请输入是否请求成功"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['english:log:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['english:log:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['english:log:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['english:log:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="${comment}" align="center" prop="id" />
|
||||||
|
<el-table-column label="接口名称" align="center" prop="apiName" />
|
||||||
|
<el-table-column label="请求API的url" align="center" prop="url" />
|
||||||
|
<el-table-column label="请求API的方法" align="center" prop="method" />
|
||||||
|
<el-table-column label="请求request" align="center" prop="request" />
|
||||||
|
<el-table-column label="响应体" align="center" prop="response" />
|
||||||
|
<el-table-column label="是否请求成功" align="center" prop="isSuccess" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['english:log:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['english:log:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改日志对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listLog, getLog, delLog, addLog, updateLog } from "@/api/english/log";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Log",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 日志表格数据
|
||||||
|
logList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
apiName: null,
|
||||||
|
isSuccess: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询日志列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listLog(this.queryParams).then(response => {
|
||||||
|
this.logList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
apiName: null,
|
||||||
|
url: null,
|
||||||
|
method: null,
|
||||||
|
request: null,
|
||||||
|
response: null,
|
||||||
|
isSuccess: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加日志";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getLog(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改日志";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateLog(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addLog(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除日志编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delLog(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('english/log/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `log_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.xjs.log.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.xjs.log.domain.ApiLog;
|
||||||
|
import com.xjs.log.service.IApiLogService;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志Controller
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @date 2021-12-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("log")
|
||||||
|
public class ApiLogController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IApiLogService apiLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("english:log:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ApiLog apiLog) {
|
||||||
|
startPage();
|
||||||
|
List<ApiLog> list = apiLogService.selectApiLogList(apiLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("english:log:export")
|
||||||
|
@Log(title = "API日志", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ApiLog apiLog) {
|
||||||
|
List<ApiLog> list = apiLogService.selectApiLogList(apiLog);
|
||||||
|
ExcelUtil<ApiLog> util = new ExcelUtil<ApiLog>(ApiLog.class);
|
||||||
|
util.exportExcel(response, list, "日志数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日志详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("english:log:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(apiLogService.selectApiLogById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("english:log:remove")
|
||||||
|
@Log(title = "API日志", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(apiLogService.deleteApiLogByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
package com.xjs.log.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志对象 api_log
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @date 2021-12-26
|
||||||
|
*/
|
||||||
|
public class ApiLog implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 接口名称 */
|
||||||
|
@Excel(name = "接口名称")
|
||||||
|
private String apiName;
|
||||||
|
|
||||||
|
/** 请求API的url */
|
||||||
|
@Excel(name = "请求API的url")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/** 请求API的方法 */
|
||||||
|
@Excel(name = "请求API的方法")
|
||||||
|
private String method;
|
||||||
|
|
||||||
|
/** 请求request */
|
||||||
|
@Excel(name = "请求request")
|
||||||
|
private String request;
|
||||||
|
|
||||||
|
/** 响应体 */
|
||||||
|
@Excel(name = "响应体")
|
||||||
|
private String response;
|
||||||
|
|
||||||
|
/** 是否请求成功 */
|
||||||
|
@Excel(name = "是否请求成功")
|
||||||
|
private Integer isSuccess;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setApiName(String apiName)
|
||||||
|
{
|
||||||
|
this.apiName = apiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiName()
|
||||||
|
{
|
||||||
|
return apiName;
|
||||||
|
}
|
||||||
|
public void setUrl(String url)
|
||||||
|
{
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl()
|
||||||
|
{
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
public void setMethod(String method)
|
||||||
|
{
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod()
|
||||||
|
{
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
public void setRequest(String request)
|
||||||
|
{
|
||||||
|
this.request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequest()
|
||||||
|
{
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
public void setResponse(String response)
|
||||||
|
{
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponse()
|
||||||
|
{
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
public void setIsSuccess(Integer isSuccess)
|
||||||
|
{
|
||||||
|
this.isSuccess = isSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSuccess()
|
||||||
|
{
|
||||||
|
return isSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("apiName", getApiName())
|
||||||
|
.append("url", getUrl())
|
||||||
|
.append("method", getMethod())
|
||||||
|
.append("request", getRequest())
|
||||||
|
.append("response", getResponse())
|
||||||
|
.append("isSuccess", getIsSuccess())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.xjs.log.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xjs.log.domain.ApiLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志Mapper接口
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @date 2021-12-26
|
||||||
|
*/
|
||||||
|
public interface ApiLogMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询日志
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 日志
|
||||||
|
*/
|
||||||
|
public ApiLog selectApiLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日志列表
|
||||||
|
*
|
||||||
|
* @param apiLog 日志
|
||||||
|
* @return 日志集合
|
||||||
|
*/
|
||||||
|
public List<ApiLog> selectApiLogList(ApiLog apiLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除日志
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteApiLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteApiLogByIds(Long[] ids);
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.xjs.log.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.xjs.log.domain.ApiLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志Service接口
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @date 2021-12-26
|
||||||
|
*/
|
||||||
|
public interface IApiLogService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询日志
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 日志
|
||||||
|
*/
|
||||||
|
public ApiLog selectApiLogById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日志列表
|
||||||
|
*
|
||||||
|
* @param apiLog 日志
|
||||||
|
* @return 日志集合
|
||||||
|
*/
|
||||||
|
public List<ApiLog> selectApiLogList(ApiLog apiLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的日志主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteApiLogByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除日志信息
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteApiLogById(Long id);
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.xjs.log.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.xjs.log.mapper.ApiLogMapper;
|
||||||
|
import com.xjs.log.domain.ApiLog;
|
||||||
|
import com.xjs.log.service.IApiLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @date 2021-12-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ApiLogServiceImpl implements IApiLogService {
|
||||||
|
@Autowired
|
||||||
|
private ApiLogMapper apiLogMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日志
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ApiLog selectApiLogById(Long id) {
|
||||||
|
return apiLogMapper.selectApiLogById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日志列表
|
||||||
|
*
|
||||||
|
* @param apiLog 日志
|
||||||
|
* @return 日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ApiLog> selectApiLogList(ApiLog apiLog) {
|
||||||
|
return apiLogMapper.selectApiLogList(apiLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除日志
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteApiLogByIds(Long[] ids) {
|
||||||
|
return apiLogMapper.deleteApiLogByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除日志信息
|
||||||
|
*
|
||||||
|
* @param id 日志主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteApiLogById(Long id) {
|
||||||
|
return apiLogMapper.deleteApiLogById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
<?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.xjs.log.mapper.ApiLogMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.xjs.log.domain.ApiLog" id="ApiLogResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="apiName" column="api_name" />
|
||||||
|
<result property="url" column="url" />
|
||||||
|
<result property="method" column="method" />
|
||||||
|
<result property="request" column="request" />
|
||||||
|
<result property="response" column="response" />
|
||||||
|
<result property="isSuccess" column="is_success" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectApiLogVo">
|
||||||
|
select id, api_name, url, method, request, response, is_success from api_log
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectApiLogList" parameterType="com.xjs.log.domain.ApiLog" resultMap="ApiLogResult">
|
||||||
|
<include refid="selectApiLogVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="apiName != null and apiName != ''"> and api_name like concat('%', #{apiName}, '%')</if>
|
||||||
|
<if test="isSuccess != null "> and is_success = #{isSuccess}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectApiLogById" parameterType="Long" resultMap="ApiLogResult">
|
||||||
|
<include refid="selectApiLogVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteApiLogById" parameterType="Long">
|
||||||
|
delete from api_log where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteApiLogByIds" parameterType="String">
|
||||||
|
delete from api_log where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in new issue