mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
错误码的前端完成
This commit is contained in:
parent
6984eb5db1
commit
fbf45cd6fe
54
ruoyi-ui/src/api/system/errorCode.js
Normal file
54
ruoyi-ui/src/api/system/errorCode.js
Normal file
@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 创建错误码
|
||||
export function createErrorCode(data) {
|
||||
return request({
|
||||
url: '/system/error-code/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新错误码
|
||||
export function updateErrorCode(data) {
|
||||
return request({
|
||||
url: '/system/error-code/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除错误码
|
||||
export function deleteErrorCode(id) {
|
||||
return request({
|
||||
url: '/system/error-code/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得错误码
|
||||
export function getErrorCode(id) {
|
||||
return request({
|
||||
url: '/system/error-code/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得错误码分页
|
||||
export function getErrorCodePage(query) {
|
||||
return request({
|
||||
url: '/system/error-code/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出错误码 Excel
|
||||
export function exportErrorCodeExcel(query) {
|
||||
return request({
|
||||
url: '/system/error-code/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
@ -21,6 +21,7 @@ export const DICT_TYPE = {
|
||||
SYS_SMS_TEMPLATE_TYPE: 'sys_sms_template_type',
|
||||
SYS_SMS_SEND_STATUS: 'sys_sms_send_status',
|
||||
SYS_SMS_RECEIVE_STATUS: 'sys_sms_receive_status',
|
||||
SYS_ERROR_CODE_TYPE: 'sys_error_code_type',
|
||||
|
||||
INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type',
|
||||
INF_JOB_STATUS: 'inf_job_status',
|
||||
|
256
ruoyi-ui/src/views/system/errorCode/index.vue
Normal file
256
ruoyi-ui/src/views/system/errorCode/index.vue
Normal file
@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="错误码类型" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择错误码类型" clearable size="small">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_ERROR_CODE_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用名" prop="applicationName">
|
||||
<el-input v-model="queryParams.applicationName" placeholder="请输入应用名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误码编码" prop="code">
|
||||
<el-input v-model="queryParams.code" placeholder="请输入错误码编码" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误码提示" prop="message">
|
||||
<el-input v-model="queryParams.message" placeholder="请输入错误码提示" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||
</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="['system:error-code:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
v-hasPermi="['system:error-code:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="错误码编号" align="center" prop="id" />
|
||||
<el-table-column label="错误码类型" align="center" prop="type" width="80">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getDictDataLabel(DICT_TYPE.SYS_ERROR_CODE_TYPE, scope.row.type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="应用名" align="center" prop="applicationName" width="200" />
|
||||
<el-table-column label="错误码编码" align="center" prop="code" width="100" />
|
||||
<el-table-column label="错误码提示" align="center" prop="message" width="300" />
|
||||
<el-table-column label="备注" align="center" prop="memo" width="200" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</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-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:error-code:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:error-code:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :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="100px">
|
||||
<el-form-item label="应用名" prop="applicationName">
|
||||
<el-input v-model="form.applicationName" placeholder="请输入应用名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="错误码编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入错误码编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="错误码提示" prop="message">
|
||||
<el-input v-model="form.message" placeholder="请输入错误码提示" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="memo">
|
||||
<el-input v-model="form.memo" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</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 { createErrorCode, updateErrorCode, deleteErrorCode, getErrorCode, getErrorCodePage, exportErrorCodeExcel } from "@/api/system/errorCode";
|
||||
|
||||
export default {
|
||||
name: "ErrorCode",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 错误码列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
dateRangeCreateTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
type: null,
|
||||
applicationName: null,
|
||||
code: null,
|
||||
message: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
applicationName: [{ required: true, message: "应用名不能为空", trigger: "blur" }],
|
||||
code: [{ required: true, message: "错误码编码不能为空", trigger: "blur" }],
|
||||
message: [{ required: true, message: "错误码提示不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
// 执行查询
|
||||
getErrorCodePage(params).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
applicationName: undefined,
|
||||
code: undefined,
|
||||
message: undefined,
|
||||
memo: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.dateRangeCreateTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加错误码";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getErrorCode(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改错误码";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updateErrorCode(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createErrorCode(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$confirm('是否确认删除错误码编号为"' + id + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return deleteErrorCode(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
// 执行导出
|
||||
this.$confirm('是否确认导出所有错误码数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return exportErrorCodeExcel(params);
|
||||
}).then(response => {
|
||||
this.downloadExcel(response, '错误码.xls');
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,42 +0,0 @@
|
||||
package cn.iocoder.dashboard.modules.infra.convert.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExcelVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeRespVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 错误码 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfErrorCodeConvert {
|
||||
|
||||
InfErrorCodeConvert INSTANCE = Mappers.getMapper(InfErrorCodeConvert.class);
|
||||
|
||||
InfErrorCodeDO convert(InfErrorCodeCreateReqVO bean);
|
||||
|
||||
InfErrorCodeDO convert(InfErrorCodeUpdateReqVO bean);
|
||||
|
||||
InfErrorCodeRespVO convert(InfErrorCodeDO bean);
|
||||
|
||||
List<InfErrorCodeRespVO> convertList(List<InfErrorCodeDO> list);
|
||||
|
||||
PageResult<InfErrorCodeRespVO> convertPage(PageResult<InfErrorCodeDO> page);
|
||||
|
||||
List<InfErrorCodeExcelVO> convertList02(List<InfErrorCodeDO> list);
|
||||
|
||||
InfErrorCodeDO convert(ErrorCodeAutoGenerateReqDTO bean);
|
||||
|
||||
List<ErrorCodeRespDTO> convertList03(List<InfErrorCodeDO> list);
|
||||
|
||||
}
|
@ -30,9 +30,4 @@ public interface InfErrorCodeConstants {
|
||||
// ========== 文件 1001003000 ==========
|
||||
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003000, "文件不存在");
|
||||
|
||||
// ========== 错误码模块 1001004000 ==========
|
||||
ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1001004000, "错误码不存在");
|
||||
ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1001004001, "已经存在编码为【{}}】的错误码");
|
||||
ErrorCode ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR = new ErrorCode(1001004002, "不能修改类型为系统内置的错误码");
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SysPostExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
|
@ -11,6 +11,9 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.*;
|
||||
import cn.iocoder.dashboard.modules.infra.convert.errorcode.InfErrorCodeConvert;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.infra.service.errorcode.InfErrorCodeService;
|
||||
import cn.iocoder.dashboard.modules.system.convert.errorcode.SysErrorCodeConvert;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.*;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.system.service.errorcode.SysErrorCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -26,24 +26,24 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
|
||||
|
||||
@Api(tags = "错误码")
|
||||
@RestController
|
||||
@RequestMapping("/infra/error-code")
|
||||
@RequestMapping("/system/error-code")
|
||||
@Validated
|
||||
public class InfErrorCodeController {
|
||||
public class SysErrorCodeController {
|
||||
|
||||
@Resource
|
||||
private InfErrorCodeService errorCodeService;
|
||||
private SysErrorCodeService errorCodeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建错误码")
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:create')")
|
||||
public CommonResult<Long> createErrorCode(@Valid @RequestBody InfErrorCodeCreateReqVO createReqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:create')")
|
||||
public CommonResult<Long> createErrorCode(@Valid @RequestBody SysErrorCodeCreateReqVO createReqVO) {
|
||||
return success(errorCodeService.createErrorCode(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新错误码")
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:update')")
|
||||
public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody InfErrorCodeUpdateReqVO updateReqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:update')")
|
||||
public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody SysErrorCodeUpdateReqVO updateReqVO) {
|
||||
errorCodeService.updateErrorCode(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
@ -51,7 +51,7 @@ public class InfErrorCodeController {
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除错误码")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:delete')")
|
||||
public CommonResult<Boolean> deleteErrorCode(@RequestParam("id") Long id) {
|
||||
errorCodeService.deleteErrorCode(id);
|
||||
return success(true);
|
||||
@ -60,30 +60,30 @@ public class InfErrorCodeController {
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得错误码")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:query')")
|
||||
public CommonResult<InfErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) {
|
||||
InfErrorCodeDO errorCode = errorCodeService.getErrorCode(id);
|
||||
return success(InfErrorCodeConvert.INSTANCE.convert(errorCode));
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:query')")
|
||||
public CommonResult<SysErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) {
|
||||
SysErrorCodeDO errorCode = errorCodeService.getErrorCode(id);
|
||||
return success(SysErrorCodeConvert.INSTANCE.convert(errorCode));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得错误码分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:query')")
|
||||
public CommonResult<PageResult<InfErrorCodeRespVO>> getErrorCodePage(@Valid InfErrorCodePageReqVO pageVO) {
|
||||
PageResult<InfErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO);
|
||||
return success(InfErrorCodeConvert.INSTANCE.convertPage(pageResult));
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:query')")
|
||||
public CommonResult<PageResult<SysErrorCodeRespVO>> getErrorCodePage(@Valid SysErrorCodePageReqVO pageVO) {
|
||||
PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO);
|
||||
return success(SysErrorCodeConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出错误码 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:error-code:export')")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportErrorCodeExcel(@Valid InfErrorCodeExportReqVO exportReqVO,
|
||||
public void exportErrorCodeExcel(@Valid SysErrorCodeExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO);
|
||||
List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfErrorCodeExcelVO> datas = InfErrorCodeConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "错误码.xls", "数据", InfErrorCodeExcelVO.class, datas);
|
||||
List<SysErrorCodeExcelVO> datas = SysErrorCodeConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "错误码.xls", "数据", SysErrorCodeExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfErrorCodeBaseVO {
|
||||
public class SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "应用名", required = true, example = "dashboard")
|
||||
@NotNull(message = "应用名不能为空")
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
@ -9,6 +9,6 @@ import lombok.ToString;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfErrorCodeCreateReqVO extends InfErrorCodeBaseVO {
|
||||
public class SysErrorCodeCreateReqVO extends SysErrorCodeBaseVO {
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
|
||||
@ -7,7 +7,7 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF_ERROR_CODE_TYPE;
|
||||
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_ERROR_CODE_TYPE;
|
||||
|
||||
/**
|
||||
* 错误码 Excel VO
|
||||
@ -15,13 +15,13 @@ import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfErrorCodeExcelVO {
|
||||
public class SysErrorCodeExcelVO {
|
||||
|
||||
@ExcelProperty("错误码编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty(value = "错误码类型", converter = DictConvert.class)
|
||||
@DictFormat(INF_ERROR_CODE_TYPE)
|
||||
@DictFormat(SYS_ERROR_CODE_TYPE)
|
||||
private Integer type;
|
||||
|
||||
@ExcelProperty("应用名")
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -11,7 +11,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU
|
||||
|
||||
@ApiModel(value = "错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfErrorCodeExportReqVO {
|
||||
public class SysErrorCodeExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码类型", example = "1")
|
||||
private Integer type;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -16,7 +16,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfErrorCodePageReqVO extends PageParam {
|
||||
public class SysErrorCodePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类")
|
||||
private Integer type;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -12,7 +12,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfErrorCodeRespVO extends InfErrorCodeBaseVO {
|
||||
public class SysErrorCodeRespVO extends SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码编号", required = true, example = "1024")
|
||||
private Long id;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo;
|
||||
package cn.iocoder.dashboard.modules.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfErrorCodeUpdateReqVO extends InfErrorCodeBaseVO {
|
||||
public class SysErrorCodeUpdateReqVO extends SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码编号", required = true, example = "1024")
|
||||
@NotNull(message = "错误码编号不能为空")
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.dashboard.modules.system.convert.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExcelVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeRespVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 错误码 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysErrorCodeConvert {
|
||||
|
||||
SysErrorCodeConvert INSTANCE = Mappers.getMapper(SysErrorCodeConvert.class);
|
||||
|
||||
SysErrorCodeDO convert(SysErrorCodeCreateReqVO bean);
|
||||
|
||||
SysErrorCodeDO convert(SysErrorCodeUpdateReqVO bean);
|
||||
|
||||
SysErrorCodeRespVO convert(SysErrorCodeDO bean);
|
||||
|
||||
List<SysErrorCodeRespVO> convertList(List<SysErrorCodeDO> list);
|
||||
|
||||
PageResult<SysErrorCodeRespVO> convertPage(PageResult<SysErrorCodeDO> page);
|
||||
|
||||
List<SysErrorCodeExcelVO> convertList02(List<SysErrorCodeDO> list);
|
||||
|
||||
SysErrorCodeDO convert(ErrorCodeAutoGenerateReqDTO bean);
|
||||
|
||||
List<ErrorCodeRespDTO> convertList03(List<SysErrorCodeDO> list);
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -13,11 +13,11 @@ import lombok.ToString;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName(value = "inf_error_code")
|
||||
@TableName(value = "sys_error_code")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfErrorCodeDO extends BaseDO {
|
||||
public class SysErrorCodeDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 错误码编号,自增
|
||||
@ -27,7 +27,7 @@ public class InfErrorCodeDO extends BaseDO {
|
||||
/**
|
||||
* 错误码类型
|
||||
*
|
||||
* 枚举 {@link InfErrorCodeTypeEnum}
|
||||
* 枚举 {@link SysErrorCodeTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
@ -22,12 +22,15 @@ public interface SysPostMapper extends BaseMapperX<SysPostDO> {
|
||||
|
||||
default PageResult<SysPostDO> selectPage(SysPostPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<SysPostDO>()
|
||||
.likeIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.eqIfPresent("status", reqVO.getStatus()));
|
||||
}
|
||||
|
||||
default List<SysPostDO> selectList(SysPostExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<SysPostDO>().likeIfPresent("name", reqVO.getName())
|
||||
return selectList(new QueryWrapperX<SysPostDO>()
|
||||
.likeIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.eqIfPresent("status", reqVO.getStatus()));
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.dal.mysql.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -14,10 +14,10 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> {
|
||||
public interface SysErrorCodeMapper extends BaseMapperX<SysErrorCodeDO> {
|
||||
|
||||
default PageResult<InfErrorCodeDO> selectPage(InfErrorCodePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfErrorCodeDO>()
|
||||
default PageResult<SysErrorCodeDO> selectPage(SysErrorCodePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<SysErrorCodeDO>()
|
||||
.eqIfPresent("type", reqVO.getType())
|
||||
.likeIfPresent("application_name", reqVO.getApplicationName())
|
||||
.eqIfPresent("code", reqVO.getCode())
|
||||
@ -26,8 +26,8 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> {
|
||||
.orderByAsc("application_name", "code"));
|
||||
}
|
||||
|
||||
default List<InfErrorCodeDO> selectList(InfErrorCodeExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<InfErrorCodeDO>()
|
||||
default List<SysErrorCodeDO> selectList(SysErrorCodeExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<SysErrorCodeDO>()
|
||||
.eqIfPresent("type", reqVO.getType())
|
||||
.likeIfPresent("application_name", reqVO.getApplicationName())
|
||||
.eqIfPresent("code", reqVO.getCode())
|
||||
@ -36,16 +36,16 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> {
|
||||
.orderByAsc("application_name", "code"));
|
||||
}
|
||||
|
||||
default List<InfErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
||||
return selectList(new QueryWrapper<InfErrorCodeDO>().in("code", codes));
|
||||
default List<SysErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
||||
return selectList(new QueryWrapper<SysErrorCodeDO>().in("code", codes));
|
||||
}
|
||||
|
||||
default InfErrorCodeDO selectByCode(Integer code) {
|
||||
return selectOne(new QueryWrapper<InfErrorCodeDO>().eq("code", code));
|
||||
default SysErrorCodeDO selectByCode(Integer code) {
|
||||
return selectOne(new QueryWrapper<SysErrorCodeDO>().eq("code", code));
|
||||
}
|
||||
|
||||
default List<InfErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) {
|
||||
return selectList(new QueryWrapperX<InfErrorCodeDO>().eq("application_name", applicationName)
|
||||
default List<SysErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) {
|
||||
return selectList(new QueryWrapperX<SysErrorCodeDO>().eq("application_name", applicationName)
|
||||
.gtIfPresent("update_time", minUpdateTime));
|
||||
}
|
||||
|
@ -91,4 +91,8 @@ public interface SysErrorCodeConstants {
|
||||
ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1002012000, "手机号不存在");
|
||||
ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1002012001, "模板参数({})缺失");
|
||||
|
||||
// ========== 错误码模块 1002013000 ==========
|
||||
ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1002013000, "错误码不存在");
|
||||
ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1002013001, "已经存在编码为【{}】的错误码");
|
||||
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ public enum SysDictTypeEnum {
|
||||
SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型
|
||||
SYS_SMS_SEND_STATUS("sys_sms_send_status"), // 短信发送状态
|
||||
SYS_SMS_RECEIVE_STATUS("sys_sms_receive_status"), // 短信接收状态
|
||||
SYS_ERROR_CODE_TYPE("inf_error_code_type"), // 错误码的类型枚举
|
||||
|
||||
INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型
|
||||
INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举
|
||||
INF_JOB_LOG_STATUS("inf_job_log_status"), // 定时任务日志状态的枚举
|
||||
INF_API_ERROR_LOG_PROCESS_STATUS("inf_api_error_log_process_status"), // API 错误日志的处理状态的枚举
|
||||
INF_ERROR_CODE_TYPE("inf_error_code_type"), // 错误码的类型枚举
|
||||
;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.dashboard.modules.infra.enums.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.enums.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -13,7 +13,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum InfErrorCodeTypeEnum implements IntArrayValuable {
|
||||
public enum SysErrorCodeTypeEnum implements IntArrayValuable {
|
||||
|
||||
/**
|
||||
* 自动生成
|
||||
@ -24,7 +24,7 @@ public enum InfErrorCodeTypeEnum implements IntArrayValuable {
|
||||
*/
|
||||
MANUAL_OPERATION(2);
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InfErrorCodeTypeEnum::getType).toArray();
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SysErrorCodeTypeEnum::getType).toArray();
|
||||
|
||||
/**
|
||||
* 类型
|
@ -1,12 +1,12 @@
|
||||
package cn.iocoder.dashboard.modules.infra.service.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.service.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.service.ErrorCodeFrameworkService;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
@ -16,7 +16,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfErrorCodeService extends ErrorCodeFrameworkService {
|
||||
public interface SysErrorCodeService extends ErrorCodeFrameworkService {
|
||||
|
||||
/**
|
||||
* 创建错误码
|
||||
@ -24,14 +24,14 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createErrorCode(@Valid InfErrorCodeCreateReqVO createReqVO);
|
||||
Long createErrorCode(@Valid SysErrorCodeCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新错误码
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateErrorCode(@Valid InfErrorCodeUpdateReqVO updateReqVO);
|
||||
void updateErrorCode(@Valid SysErrorCodeUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除错误码
|
||||
@ -46,7 +46,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService {
|
||||
* @param id 编号
|
||||
* @return 错误码
|
||||
*/
|
||||
InfErrorCodeDO getErrorCode(Long id);
|
||||
SysErrorCodeDO getErrorCode(Long id);
|
||||
|
||||
/**
|
||||
* 获得错误码分页
|
||||
@ -54,7 +54,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 错误码分页
|
||||
*/
|
||||
PageResult<InfErrorCodeDO> getErrorCodePage(InfErrorCodePageReqVO pageReqVO);
|
||||
PageResult<SysErrorCodeDO> getErrorCodePage(SysErrorCodePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得错误码列表, 用于 Excel 导出
|
||||
@ -62,6 +62,6 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService {
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 错误码列表
|
||||
*/
|
||||
List<InfErrorCodeDO> getErrorCodeList(InfErrorCodeExportReqVO exportReqVO);
|
||||
List<SysErrorCodeDO> getErrorCodeList(SysErrorCodeExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package cn.iocoder.dashboard.modules.infra.service.errorcode.impl;
|
||||
package cn.iocoder.dashboard.modules.system.service.errorcode.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO;
|
||||
import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.convert.errorcode.InfErrorCodeConvert;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode.InfErrorCodeMapper;
|
||||
import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.infra.service.errorcode.InfErrorCodeService;
|
||||
import cn.iocoder.dashboard.modules.system.convert.errorcode.SysErrorCodeConvert;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.mysql.errorcode.SysErrorCodeMapper;
|
||||
import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.system.service.errorcode.SysErrorCodeService;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -25,45 +25,46 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_DUPLICATE;
|
||||
import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_NOT_EXISTS;
|
||||
import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*;
|
||||
import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
/**
|
||||
* 错误码 Service 实现类
|
||||
*
|
||||
* @author dlyan
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class InfErrorCodeServiceImpl implements InfErrorCodeService {
|
||||
public class SysErrorCodeServiceImpl implements SysErrorCodeService {
|
||||
|
||||
@Resource
|
||||
private InfErrorCodeMapper errorCodeMapper;
|
||||
private SysErrorCodeMapper errorCodeMapper;
|
||||
|
||||
@Override
|
||||
public Long createErrorCode(InfErrorCodeCreateReqVO createReqVO) {
|
||||
public Long createErrorCode(SysErrorCodeCreateReqVO createReqVO) {
|
||||
// 校验 code 重复
|
||||
validateCodeDuplicate(createReqVO.getCode(), null);
|
||||
|
||||
// 插入
|
||||
InfErrorCodeDO errorCode = InfErrorCodeConvert.INSTANCE.convert(createReqVO)
|
||||
.setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType());
|
||||
SysErrorCodeDO errorCode = SysErrorCodeConvert.INSTANCE.convert(createReqVO)
|
||||
.setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType());
|
||||
errorCodeMapper.insert(errorCode);
|
||||
// 返回
|
||||
return errorCode.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateErrorCode(InfErrorCodeUpdateReqVO updateReqVO) {
|
||||
public void updateErrorCode(SysErrorCodeUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
this.validateErrorCodeExists(updateReqVO.getId());
|
||||
// 校验 code 重复
|
||||
validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId());
|
||||
|
||||
// 更新
|
||||
InfErrorCodeDO updateObj = InfErrorCodeConvert.INSTANCE.convert(updateReqVO)
|
||||
.setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType());
|
||||
SysErrorCodeDO updateObj = SysErrorCodeConvert.INSTANCE.convert(updateReqVO)
|
||||
.setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType());
|
||||
errorCodeMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@ -85,7 +86,7 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void validateCodeDuplicate(Integer code, Long id) {
|
||||
InfErrorCodeDO errorCodeDO = errorCodeMapper.selectByCode(code);
|
||||
SysErrorCodeDO errorCodeDO = errorCodeMapper.selectByCode(code);
|
||||
if (errorCodeDO == null) {
|
||||
return;
|
||||
}
|
||||
@ -106,17 +107,17 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfErrorCodeDO getErrorCode(Long id) {
|
||||
public SysErrorCodeDO getErrorCode(Long id) {
|
||||
return errorCodeMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfErrorCodeDO> getErrorCodePage(InfErrorCodePageReqVO pageReqVO) {
|
||||
public PageResult<SysErrorCodeDO> getErrorCodePage(SysErrorCodePageReqVO pageReqVO) {
|
||||
return errorCodeMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfErrorCodeDO> getErrorCodeList(InfErrorCodeExportReqVO exportReqVO) {
|
||||
public List<SysErrorCodeDO> getErrorCodeList(SysErrorCodeExportReqVO exportReqVO) {
|
||||
return errorCodeMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@ -127,23 +128,23 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService {
|
||||
return;
|
||||
}
|
||||
// 获得错误码
|
||||
List<InfErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByCodes(
|
||||
List<SysErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByCodes(
|
||||
convertSet(autoGenerateDTOs, ErrorCodeAutoGenerateReqDTO::getCode));
|
||||
Map<Integer, InfErrorCodeDO> errorCodeDOMap = convertMap(errorCodeDOs, InfErrorCodeDO::getCode);
|
||||
Map<Integer, SysErrorCodeDO> errorCodeDOMap = convertMap(errorCodeDOs, SysErrorCodeDO::getCode);
|
||||
|
||||
// 遍历 autoGenerateBOs 数组,逐个插入或更新。考虑到每次量级不大,就不走批量了
|
||||
autoGenerateDTOs.forEach(autoGenerateDTO -> {
|
||||
InfErrorCodeDO errorCodeDO = errorCodeDOMap.get(autoGenerateDTO.getCode());
|
||||
SysErrorCodeDO errorCodeDO = errorCodeDOMap.get(autoGenerateDTO.getCode());
|
||||
// 不存在,则进行新增
|
||||
if (errorCodeDO == null) {
|
||||
errorCodeDO = InfErrorCodeConvert.INSTANCE.convert(autoGenerateDTO)
|
||||
.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
errorCodeDO = SysErrorCodeConvert.INSTANCE.convert(autoGenerateDTO)
|
||||
.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
errorCodeMapper.insert(errorCodeDO);
|
||||
return;
|
||||
}
|
||||
// 存在,则进行更新。更新有三个前置条件:
|
||||
// 条件 1. 只更新自动生成的错误码,即 Type 为 ErrorCodeTypeEnum.AUTO_GENERATION
|
||||
if (!InfErrorCodeTypeEnum.AUTO_GENERATION.getType().equals(errorCodeDO.getType())) {
|
||||
if (!SysErrorCodeTypeEnum.AUTO_GENERATION.getType().equals(errorCodeDO.getType())) {
|
||||
return;
|
||||
}
|
||||
// 条件 2. 分组 group 必须匹配,避免存在错误码冲突的情况
|
||||
@ -158,15 +159,15 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService {
|
||||
return;
|
||||
}
|
||||
// 最终匹配,进行更新
|
||||
errorCodeMapper.updateById(new InfErrorCodeDO().setId(errorCodeDO.getId()).setMessage(autoGenerateDTO.getMessage()));
|
||||
errorCodeMapper.updateById(new SysErrorCodeDO().setId(errorCodeDO.getId()).setMessage(autoGenerateDTO.getMessage()));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErrorCodeRespDTO> getErrorCodeList(String applicationName, Date minUpdateTime) {
|
||||
List<InfErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByApplicationNameAndUpdateTimeGt(
|
||||
List<SysErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByApplicationNameAndUpdateTimeGt(
|
||||
applicationName, minUpdateTime);
|
||||
return InfErrorCodeConvert.INSTANCE.convertList03(errorCodeDOs);
|
||||
return SysErrorCodeConvert.INSTANCE.convertList03(errorCodeDOs);
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package cn.iocoder.dashboard.modules.infra.service.errorcode;
|
||||
package cn.iocoder.dashboard.modules.system.service.errorcode;
|
||||
|
||||
import cn.iocoder.dashboard.BaseDbUnitTest;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode.InfErrorCodeMapper;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import cn.iocoder.dashboard.modules.system.dal.mysql.errorcode.SysErrorCodeMapper;
|
||||
import cn.iocoder.dashboard.modules.infra.enums.config.InfConfigTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.infra.service.errorcode.impl.InfErrorCodeServiceImpl;
|
||||
import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum;
|
||||
import cn.iocoder.dashboard.modules.system.service.errorcode.impl.SysErrorCodeServiceImpl;
|
||||
import cn.iocoder.dashboard.util.collection.ArrayUtils;
|
||||
import cn.iocoder.dashboard.util.object.ObjectUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -21,8 +21,7 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.randomEle;
|
||||
import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_DUPLICATE;
|
||||
import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_NOT_EXISTS;
|
||||
import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*;
|
||||
import static cn.iocoder.dashboard.util.AssertUtils.assertPojoEquals;
|
||||
import static cn.iocoder.dashboard.util.AssertUtils.assertServiceException;
|
||||
import static cn.iocoder.dashboard.util.RandomUtils.*;
|
||||
@ -30,56 +29,56 @@ import static cn.iocoder.dashboard.util.date.DateUtils.buildTime;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* {@link InfErrorCodeServiceImpl} 的单元测试类
|
||||
* {@link SysErrorCodeServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(InfErrorCodeServiceImpl.class)
|
||||
public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
@Import(SysErrorCodeServiceImpl.class)
|
||||
public class SysErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private InfErrorCodeServiceImpl errorCodeService;
|
||||
private SysErrorCodeServiceImpl errorCodeService;
|
||||
|
||||
@Resource
|
||||
private InfErrorCodeMapper errorCodeMapper;
|
||||
private SysErrorCodeMapper errorCodeMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateErrorCode_success() {
|
||||
// 准备参数
|
||||
InfErrorCodeCreateReqVO reqVO = randomPojo(InfErrorCodeCreateReqVO.class);
|
||||
SysErrorCodeCreateReqVO reqVO = randomPojo(SysErrorCodeCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long errorCodeId = errorCodeService.createErrorCode(reqVO);
|
||||
// 断言
|
||||
assertNotNull(errorCodeId);
|
||||
// 校验记录的属性是否正确
|
||||
InfErrorCodeDO errorCode = errorCodeMapper.selectById(errorCodeId);
|
||||
SysErrorCodeDO errorCode = errorCodeMapper.selectById(errorCodeId);
|
||||
assertPojoEquals(reqVO, errorCode);
|
||||
assertEquals(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType());
|
||||
assertEquals(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateErrorCode_success() {
|
||||
// mock 数据
|
||||
InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO();
|
||||
SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO();
|
||||
errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
InfErrorCodeUpdateReqVO reqVO = randomPojo(InfErrorCodeUpdateReqVO.class, o -> {
|
||||
SysErrorCodeUpdateReqVO reqVO = randomPojo(SysErrorCodeUpdateReqVO.class, o -> {
|
||||
o.setId(dbErrorCode.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
errorCodeService.updateErrorCode(reqVO);
|
||||
// 校验是否更新正确
|
||||
InfErrorCodeDO errorCode = errorCodeMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
SysErrorCodeDO errorCode = errorCodeMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, errorCode);
|
||||
assertEquals(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType());
|
||||
assertEquals(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteErrorCode_success() {
|
||||
// mock 数据
|
||||
InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO();
|
||||
SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO();
|
||||
errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbErrorCode.getId();
|
||||
@ -93,10 +92,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
public void testGetErrorCodePage() {
|
||||
// mock 数据
|
||||
InfErrorCodeDO dbErrorCode = initGetErrorCodePage();
|
||||
SysErrorCodeDO dbErrorCode = initGetErrorCodePage();
|
||||
// 准备参数
|
||||
InfErrorCodePageReqVO reqVO = new InfErrorCodePageReqVO();
|
||||
reqVO.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
SysErrorCodePageReqVO reqVO = new SysErrorCodePageReqVO();
|
||||
reqVO.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
reqVO.setApplicationName("yudao");
|
||||
reqVO.setCode(1);
|
||||
reqVO.setMessage("yu");
|
||||
@ -104,7 +103,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
reqVO.setEndCreateTime(buildTime(2020, 11, 30));
|
||||
|
||||
// 调用
|
||||
PageResult<InfErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
|
||||
PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
@ -114,9 +113,9 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
/**
|
||||
* 初始化 getErrorCodePage 方法的测试数据
|
||||
*/
|
||||
private InfErrorCodeDO initGetErrorCodePage() {
|
||||
InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO(o -> { // 等会查询到
|
||||
o.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
private SysErrorCodeDO initGetErrorCodePage() {
|
||||
SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO(o -> { // 等会查询到
|
||||
o.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
o.setApplicationName("yudaoyuanma");
|
||||
o.setCode(1);
|
||||
o.setMessage("yudao");
|
||||
@ -124,7 +123,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
});
|
||||
errorCodeMapper.insert(dbErrorCode);
|
||||
// 测试 type 不匹配
|
||||
errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType())));
|
||||
errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType())));
|
||||
// 测试 applicationName 不匹配
|
||||
errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setApplicationName("yunai")));
|
||||
// 测试 code 不匹配
|
||||
@ -139,10 +138,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
public void testGetErrorCodeList() {
|
||||
// mock 数据
|
||||
InfErrorCodeDO dbErrorCode = initGetErrorCodePage();
|
||||
SysErrorCodeDO dbErrorCode = initGetErrorCodePage();
|
||||
// 准备参数
|
||||
InfErrorCodeExportReqVO reqVO = new InfErrorCodeExportReqVO();
|
||||
reqVO.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
SysErrorCodeExportReqVO reqVO = new SysErrorCodeExportReqVO();
|
||||
reqVO.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType());
|
||||
reqVO.setApplicationName("yudao");
|
||||
reqVO.setCode(1);
|
||||
reqVO.setMessage("yu");
|
||||
@ -150,7 +149,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
reqVO.setEndCreateTime(buildTime(2020, 11, 30));
|
||||
|
||||
// 调用
|
||||
List<InfErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO);
|
||||
List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbErrorCode, list.get(0));
|
||||
@ -190,11 +189,11 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest {
|
||||
// ========== 随机对象 ==========
|
||||
|
||||
@SafeVarargs
|
||||
private static InfErrorCodeDO randomInfErrorCodeDO(Consumer<InfErrorCodeDO>... consumers) {
|
||||
Consumer<InfErrorCodeDO> consumer = (o) -> {
|
||||
private static SysErrorCodeDO randomInfErrorCodeDO(Consumer<SysErrorCodeDO>... consumers) {
|
||||
Consumer<SysErrorCodeDO> consumer = (o) -> {
|
||||
o.setType(randomEle(InfConfigTypeEnum.values()).getType()); // 保证 key 的范围
|
||||
};
|
||||
return randomPojo(InfErrorCodeDO.class, ArrayUtils.append(consumer, consumers));
|
||||
return randomPojo(SysErrorCodeDO.class, ArrayUtils.append(consumer, consumers));
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@ DELETE FROM "inf_job";
|
||||
DELETE FROM "inf_job_log";
|
||||
DELETE FROM "inf_api_access_log";
|
||||
DELETE FROM "inf_api_error_log";
|
||||
DELETE FROM "inf_error_code";
|
||||
|
||||
-- sys 开头的 DB
|
||||
DELETE FROM "sys_dept";
|
||||
@ -23,3 +22,4 @@ DELETE FROM "sys_user";
|
||||
DELETE FROM "sys_sms_channel";
|
||||
DELETE FROM "sys_sms_template";
|
||||
DELETE FROM "sys_sms_log";
|
||||
DELETE FROM "sys_error_code";
|
||||
|
@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS "sys_sms_log" (
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '短信日志';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "inf_error_code" (
|
||||
CREATE TABLE IF NOT EXISTS "sys_error_code" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"type" tinyint NOT NULL DEFAULT '0',
|
||||
"application_name" varchar(50) NOT NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user