parent
de097be0e9
commit
6fd5a627ed
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询文案api,通过api获取文案信息列表
|
||||
export function listCopywriting(query) {
|
||||
return request({
|
||||
url: '/english/copywriting/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询文案api,通过api获取文案信息详细
|
||||
export function getCopywriting(id) {
|
||||
return request({
|
||||
url: '/english/copywriting/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增文案api,通过api获取文案信息
|
||||
export function addCopywriting(data) {
|
||||
return request({
|
||||
url: '/english/copywriting',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改文案api,通过api获取文案信息
|
||||
export function updateCopywriting(data) {
|
||||
return request({
|
||||
url: '/english/copywriting',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除文案api,通过api获取文案信息
|
||||
export function delCopywriting(id) {
|
||||
return request({
|
||||
url: '/english/copywriting/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
<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>
|
||||
<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="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="接口名称" align="center" prop="apiName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="请求URL" align="center" prop="url" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="请求方法" align="center" prop="method" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="请求参数" align="center" prop="request" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="响应参数" align="center" prop="response" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="是否请求成功" align="center" prop="isSuccess" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isSuccess==='成功'?'success':'danger'" size="small">{{ scope.row.isSuccess }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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-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"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listLog, getLog, delLog} from "@/api/business/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
|
||||
},
|
||||
// 表单参数
|
||||
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,
|
||||
createTime: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 = "修改日志";
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
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>
|
||||
|
|
@ -2,8 +2,12 @@ package com.xjs.copywriting.controller;
|
|||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.copywriting.domain.CopyWriting;
|
||||
|
|
@ -14,11 +18,11 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
|
@ -29,7 +33,7 @@ import java.util.Optional;
|
|||
@RestController
|
||||
@RequestMapping("copyWriting")
|
||||
@Api(tags = "业务模块-文案管理")
|
||||
public class CopyWritingController {
|
||||
public class CopyWritingController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CopyWritingFactory tianXingPYQCopyWritingFactory;
|
||||
|
|
@ -39,7 +43,6 @@ public class CopyWritingController {
|
|||
private CopyWritingService copyWritingService;
|
||||
|
||||
//todo 文案管理前端页面,
|
||||
// 天行数据整合一个菜单,
|
||||
// 实现其他天行数据接口,
|
||||
// 实现其他朋友圈文案api,
|
||||
|
||||
|
|
@ -47,7 +50,6 @@ public class CopyWritingController {
|
|||
@ApiOperation("文案接口")
|
||||
@Log(title = "获取文案")
|
||||
@RequiresLogin
|
||||
@RequiresPermissions("english:translation:api")
|
||||
public AjaxResult copyWriting(@Validated RequestBody requestBody) {
|
||||
requestBody = Optional.ofNullable(requestBody).orElseGet(RequestBody::new);
|
||||
CopyWritingFactory copyWritingFactory = this.randomApi();
|
||||
|
|
@ -64,9 +66,9 @@ public class CopyWritingController {
|
|||
return R.ok(copyWriting);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装随机调用api
|
||||
*
|
||||
* @return 文案工厂
|
||||
*/
|
||||
private CopyWritingFactory randomApi() {
|
||||
|
|
@ -82,8 +84,9 @@ public class CopyWritingController {
|
|||
|
||||
/**
|
||||
* 捕获apiException异常,直接从数据库查询值然后返回
|
||||
*
|
||||
* @param copyWritingFactory 工厂
|
||||
* @param requestBody 请求参数
|
||||
* @param requestBody 请求参数
|
||||
* @return 返回对象
|
||||
*/
|
||||
private CopyWriting handlerException(CopyWritingFactory copyWritingFactory, RequestBody requestBody) {
|
||||
|
|
@ -99,9 +102,53 @@ public class CopyWritingController {
|
|||
}
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息列表
|
||||
*/
|
||||
@ApiOperation("文案列表")
|
||||
@RequiresPermissions("system:copywriting:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CopyWriting copyWriting) {
|
||||
startPage();
|
||||
List<CopyWriting> list = copyWritingService.selectCopyWritingList(copyWriting);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出文案api,通过api获取文案信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:copywriting:export")
|
||||
@Log(title = "文案管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出文案")
|
||||
public void export(HttpServletResponse response, CopyWriting copyWriting) {
|
||||
List<CopyWriting> list = copyWritingService.selectCopyWritingList(copyWriting);
|
||||
ExcelUtil<CopyWriting> util = new ExcelUtil<>(CopyWriting.class);
|
||||
util.exportExcel(response, list, "文案api,通过api获取文案信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文案api,通过api获取文案信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:copywriting:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取文案根据ID")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(copyWritingService.selectCopyWritingById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文案api,通过api获取文案信息
|
||||
*/
|
||||
@RequiresPermissions("system:copywriting:remove")
|
||||
@Log(title = "文案管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除文案")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(copyWritingService.deleteCopyWritingByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ public class CopyWriting implements Serializable {
|
|||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@Excel(name = "文案类型")
|
||||
@Excel(name = "文案类型" ,readConverterExp = "1=、朋友圈文案2、网易云热评")
|
||||
private StatusEnum type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.xjs.copywriting.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjs.copywriting.domain.CopyWriting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc
|
||||
|
|
@ -21,4 +23,38 @@ public interface CopyWritingMapper extends BaseMapper<CopyWriting> {
|
|||
*/
|
||||
CopyWriting getOneToRandom();
|
||||
|
||||
|
||||
//---------------------代码自动生成-------------------------
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 文案api,通过api获取文案信息
|
||||
*/
|
||||
CopyWriting selectCopyWritingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息列表
|
||||
*
|
||||
* @param copyWriting 文案api,通过api获取文案信息
|
||||
* @return 文案api,通过api获取文案信息集合
|
||||
*/
|
||||
List<CopyWriting> selectCopyWritingList(CopyWriting copyWriting);
|
||||
|
||||
/**
|
||||
* 删除文案api,通过api获取文案信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCopyWritingById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除文案api,通过api获取文案信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCopyWritingByIds(Long[] ids);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.xjs.copywriting.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjs.copywriting.domain.CopyWriting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 文案服务接口
|
||||
|
|
@ -21,4 +23,38 @@ public interface CopyWritingService extends IService<CopyWriting> {
|
|||
* @return CopyWriting
|
||||
*/
|
||||
CopyWriting getOneToRandom();
|
||||
|
||||
|
||||
//-------------------------代码自动生成----------------------------------
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 文案api,通过api获取文案信息
|
||||
*/
|
||||
CopyWriting selectCopyWritingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息列表
|
||||
*
|
||||
* @param copyWriting 文案api,通过api获取文案信息
|
||||
* @return 文案api,通过api获取文案信息集合
|
||||
*/
|
||||
List<CopyWriting> selectCopyWritingList(CopyWriting copyWriting);
|
||||
|
||||
/**
|
||||
* 批量删除文案api,通过api获取文案信息
|
||||
*
|
||||
* @param ids 需要删除的文案api,通过api获取文案信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCopyWritingByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除文案api,通过api获取文案信息信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteCopyWritingById(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.xjs.copywriting.service.CopyWritingService;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
|
|
@ -27,4 +28,56 @@ public class CopyWritingServiceImpl extends ServiceImpl<CopyWritingMapper, CopyW
|
|||
public CopyWriting getOneToRandom() {
|
||||
return copyWritingMapper.getOneToRandom();
|
||||
}
|
||||
|
||||
|
||||
//----------------------代码自动生成------------------------------------
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 文案api,通过api获取文案信息
|
||||
*/
|
||||
@Override
|
||||
public CopyWriting selectCopyWritingById(Long id)
|
||||
{
|
||||
return copyWritingMapper.selectCopyWritingById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文案api,通过api获取文案信息列表
|
||||
*
|
||||
* @param copyWriting 文案api,通过api获取文案信息
|
||||
* @return 文案api,通过api获取文案信息
|
||||
*/
|
||||
@Override
|
||||
public List<CopyWriting> selectCopyWritingList(CopyWriting copyWriting)
|
||||
{
|
||||
return copyWritingMapper.selectCopyWritingList(copyWriting);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文案api,通过api获取文案信息
|
||||
*
|
||||
* @param ids 需要删除的文案api,通过api获取文案信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCopyWritingByIds(Long[] ids)
|
||||
{
|
||||
return copyWritingMapper.deleteCopyWritingByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文案api,通过api获取文案信息信息
|
||||
*
|
||||
* @param id 文案api,通过api获取文案信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCopyWritingById(Long id)
|
||||
{
|
||||
return copyWritingMapper.deleteCopyWritingById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
package com.xjs.log.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
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;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志Controller
|
||||
|
|
@ -35,6 +30,11 @@ public class ApiLogController extends BaseController {
|
|||
@Autowired
|
||||
private IApiLogService apiLogService;
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询日志列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.xjs.common.enums.StatusEnum;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
|
@ -51,7 +50,7 @@ public class ApiLog implements Serializable
|
|||
@Excel(name = "是否请求成功")
|
||||
private StatusEnum isSuccess;
|
||||
|
||||
@Excel(name = "创建时间")
|
||||
@Excel(name = "创建时间" ,dateFormat = "yyyy-MM-dd")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.xjs.log.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjs.log.domain.ApiLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志Mapper接口
|
||||
*
|
||||
|
|
@ -12,6 +12,9 @@ import com.xjs.log.domain.ApiLog;
|
|||
* @date 2021-12-26
|
||||
*/
|
||||
public interface ApiLogMapper extends BaseMapper<ApiLog> {
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询日志
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,19 +1,22 @@
|
|||
package com.xjs.log.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xjs.log.domain.ApiLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志Service接口
|
||||
*
|
||||
*
|
||||
* @author xjs
|
||||
* @date 2021-12-26
|
||||
*/
|
||||
public interface IApiLogService
|
||||
{
|
||||
public interface IApiLogService {
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询日志
|
||||
*
|
||||
*
|
||||
* @param id 日志主键
|
||||
* @return 日志
|
||||
*/
|
||||
|
|
@ -21,7 +24,7 @@ public interface IApiLogService
|
|||
|
||||
/**
|
||||
* 查询日志列表
|
||||
*
|
||||
*
|
||||
* @param apiLog 日志
|
||||
* @return 日志集合
|
||||
*/
|
||||
|
|
@ -29,7 +32,7 @@ public interface IApiLogService
|
|||
|
||||
/**
|
||||
* 批量删除日志
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -37,7 +40,7 @@ public interface IApiLogService
|
|||
|
||||
/**
|
||||
* 删除日志信息
|
||||
*
|
||||
*
|
||||
* @param id 日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.xjs.log.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xjs.log.domain.ApiLog;
|
||||
import com.xjs.log.mapper.ApiLogMapper;
|
||||
import com.xjs.log.service.IApiLogService;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志Service业务层处理
|
||||
|
|
@ -19,6 +19,8 @@ public class ApiLogServiceImpl implements IApiLogService {
|
|||
@Autowired
|
||||
private ApiLogMapper apiLogMapper;
|
||||
|
||||
//------------------------代码自动生成-----------------------------------
|
||||
|
||||
/**
|
||||
* 查询日志
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.xjs.translation.controller;
|
|||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.xjs.translation.domain.qo.translation.TranslationQo;
|
||||
import com.xjs.translation.domain.vo.translation.TranslationVo;
|
||||
import com.xjs.translation.factory.TranslationFactory;
|
||||
|
|
@ -11,7 +10,10 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.xjs.common.consts.TranslationTypeConst.BAIDU;
|
||||
import static com.xjs.common.consts.TranslationTypeConst.YOUDAO;
|
||||
|
|
@ -35,7 +37,6 @@ public class TranslationController {
|
|||
@ApiOperation("翻译接口")
|
||||
@Log(title = "获取翻译")
|
||||
@RequiresLogin
|
||||
@RequiresPermissions("english:translation:api")
|
||||
public AjaxResult translation(@Validated @RequestBody TranslationQo translationQo) {
|
||||
TranslationVo translationVo=new TranslationVo();
|
||||
if (BAIDU.equals(translationQo.getTranslationType())) {
|
||||
|
|
|
|||
|
|
@ -6,22 +6,63 @@
|
|||
|
||||
|
||||
<select id="getOneToNew" resultType="com.xjs.copywriting.domain.CopyWriting">
|
||||
SELECT
|
||||
id,
|
||||
content,
|
||||
source,
|
||||
mt create_time
|
||||
FROM
|
||||
( SELECT max( create_time ) mt FROM api_copywriting ) time,
|
||||
api_copywriting al
|
||||
WHERE
|
||||
time.mt = al.create_time
|
||||
SELECT id,
|
||||
content,
|
||||
source,
|
||||
mt create_time
|
||||
FROM (SELECT max(create_time) mt FROM api_copywriting) time,
|
||||
api_copywriting al
|
||||
WHERE time.mt = al.create_time
|
||||
</select>
|
||||
|
||||
<select id="getOneToRandom" resultType="com.xjs.copywriting.domain.CopyWriting">
|
||||
SELECT * FROM api_copywriting ORDER BY RAND() LIMIT 1
|
||||
SELECT *
|
||||
FROM api_copywriting
|
||||
ORDER BY RAND()
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!--////////////////////////代码自动生成/////////////////////////////-->
|
||||
<resultMap type="com.xjs.copywriting.domain.CopyWriting" id="CopyWritingResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="type" column="type"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCopyWritingVo">
|
||||
select id, content, source, create_time, type
|
||||
from api_copywriting
|
||||
</sql>
|
||||
|
||||
<select id="selectCopyWritingList" parameterType="com.xjs.copywriting.domain.CopyWriting"
|
||||
resultMap="CopyWritingResult">
|
||||
<include refid="selectCopyWritingVo"/>
|
||||
<where>
|
||||
<if test="content != null and content != ''">and content = #{content}</if>
|
||||
<if test="source != null and source != ''">and source = #{source}</if>
|
||||
<if test="type != null ">and type = #{type}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCopyWritingById" parameterType="Long" resultMap="CopyWritingResult">
|
||||
<include refid="selectCopyWritingVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteCopyWritingById" parameterType="Long">
|
||||
delete
|
||||
from api_copywriting
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCopyWritingByIds" parameterType="String">
|
||||
delete from api_copywriting where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue