Commit fbf45cd6fef6ebc4f8354ab4a32e416d3311ed47
1 parent
6984eb5d
错误码的前端完成
Showing
28 changed files
with
519 additions
and
200 deletions
ruoyi-ui/src/api/system/errorCode.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 创建错误码 | ||
| 4 | +export function createErrorCode(data) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/system/error-code/create', | ||
| 7 | + method: 'post', | ||
| 8 | + data: data | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +// 更新错误码 | ||
| 13 | +export function updateErrorCode(data) { | ||
| 14 | + return request({ | ||
| 15 | + url: '/system/error-code/update', | ||
| 16 | + method: 'put', | ||
| 17 | + data: data | ||
| 18 | + }) | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +// 删除错误码 | ||
| 22 | +export function deleteErrorCode(id) { | ||
| 23 | + return request({ | ||
| 24 | + url: '/system/error-code/delete?id=' + id, | ||
| 25 | + method: 'delete' | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// 获得错误码 | ||
| 30 | +export function getErrorCode(id) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/system/error-code/get?id=' + id, | ||
| 33 | + method: 'get' | ||
| 34 | + }) | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// 获得错误码分页 | ||
| 38 | +export function getErrorCodePage(query) { | ||
| 39 | + return request({ | ||
| 40 | + url: '/system/error-code/page', | ||
| 41 | + method: 'get', | ||
| 42 | + params: query | ||
| 43 | + }) | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +// 导出错误码 Excel | ||
| 47 | +export function exportErrorCodeExcel(query) { | ||
| 48 | + return request({ | ||
| 49 | + url: '/system/error-code/export-excel', | ||
| 50 | + method: 'get', | ||
| 51 | + params: query, | ||
| 52 | + responseType: 'blob' | ||
| 53 | + }) | ||
| 54 | +} |
ruoyi-ui/src/utils/dict.js
| @@ -21,6 +21,7 @@ export const DICT_TYPE = { | @@ -21,6 +21,7 @@ export const DICT_TYPE = { | ||
| 21 | SYS_SMS_TEMPLATE_TYPE: 'sys_sms_template_type', | 21 | SYS_SMS_TEMPLATE_TYPE: 'sys_sms_template_type', |
| 22 | SYS_SMS_SEND_STATUS: 'sys_sms_send_status', | 22 | SYS_SMS_SEND_STATUS: 'sys_sms_send_status', |
| 23 | SYS_SMS_RECEIVE_STATUS: 'sys_sms_receive_status', | 23 | SYS_SMS_RECEIVE_STATUS: 'sys_sms_receive_status', |
| 24 | + SYS_ERROR_CODE_TYPE: 'sys_error_code_type', | ||
| 24 | 25 | ||
| 25 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', | 26 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', |
| 26 | INF_JOB_STATUS: 'inf_job_status', | 27 | INF_JOB_STATUS: 'inf_job_status', |
ruoyi-ui/src/views/system/errorCode/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + | ||
| 4 | + <!-- 搜索工作栏 --> | ||
| 5 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px"> | ||
| 6 | + <el-form-item label="错误码类型" prop="type"> | ||
| 7 | + <el-select v-model="queryParams.type" placeholder="请选择错误码类型" clearable size="small"> | ||
| 8 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_ERROR_CODE_TYPE)" | ||
| 9 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 10 | + </el-select> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item label="应用名" prop="applicationName"> | ||
| 13 | + <el-input v-model="queryParams.applicationName" placeholder="请输入应用名" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item label="错误码编码" prop="code"> | ||
| 16 | + <el-input v-model="queryParams.code" placeholder="请输入错误码编码" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item label="错误码提示" prop="message"> | ||
| 19 | + <el-input v-model="queryParams.message" placeholder="请输入错误码提示" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item label="创建时间"> | ||
| 22 | + <el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 23 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | ||
| 24 | + </el-form-item> | ||
| 25 | + <el-form-item> | ||
| 26 | + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||
| 27 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||
| 28 | + </el-form-item> | ||
| 29 | + </el-form> | ||
| 30 | + | ||
| 31 | + <!-- 操作工具栏 --> | ||
| 32 | + <el-row :gutter="10" class="mb8"> | ||
| 33 | + <el-col :span="1.5"> | ||
| 34 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 35 | + v-hasPermi="['system:error-code:create']">新增</el-button> | ||
| 36 | + </el-col> | ||
| 37 | + <el-col :span="1.5"> | ||
| 38 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 39 | + v-hasPermi="['system:error-code:export']">导出</el-button> | ||
| 40 | + </el-col> | ||
| 41 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 42 | + </el-row> | ||
| 43 | + | ||
| 44 | + <!-- 列表 --> | ||
| 45 | + <el-table v-loading="loading" :data="list"> | ||
| 46 | + <el-table-column label="错误码编号" align="center" prop="id" /> | ||
| 47 | + <el-table-column label="错误码类型" align="center" prop="type" width="80"> | ||
| 48 | + <template slot-scope="scope"> | ||
| 49 | + <span>{{ getDictDataLabel(DICT_TYPE.SYS_ERROR_CODE_TYPE, scope.row.type) }}</span> | ||
| 50 | + </template> | ||
| 51 | + </el-table-column> | ||
| 52 | + <el-table-column label="应用名" align="center" prop="applicationName" width="200" /> | ||
| 53 | + <el-table-column label="错误码编码" align="center" prop="code" width="100" /> | ||
| 54 | + <el-table-column label="错误码提示" align="center" prop="message" width="300" /> | ||
| 55 | + <el-table-column label="备注" align="center" prop="memo" width="200" /> | ||
| 56 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 57 | + <template slot-scope="scope"> | ||
| 58 | + <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 59 | + </template> | ||
| 60 | + </el-table-column> | ||
| 61 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 62 | + <template slot-scope="scope"> | ||
| 63 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 64 | + v-hasPermi="['system:error-code:update']">修改</el-button> | ||
| 65 | + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 66 | + v-hasPermi="['system:error-code:delete']">删除</el-button> | ||
| 67 | + </template> | ||
| 68 | + </el-table-column> | ||
| 69 | + </el-table> | ||
| 70 | + <!-- 分页组件 --> | ||
| 71 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 72 | + @pagination="getList"/> | ||
| 73 | + | ||
| 74 | + <!-- 对话框(添加 / 修改) --> | ||
| 75 | + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 76 | + <el-form ref="form" :model="form" :rules="rules" label-width="100px"> | ||
| 77 | + <el-form-item label="应用名" prop="applicationName"> | ||
| 78 | + <el-input v-model="form.applicationName" placeholder="请输入应用名" /> | ||
| 79 | + </el-form-item> | ||
| 80 | + <el-form-item label="错误码编码" prop="code"> | ||
| 81 | + <el-input v-model="form.code" placeholder="请输入错误码编码" /> | ||
| 82 | + </el-form-item> | ||
| 83 | + <el-form-item label="错误码提示" prop="message"> | ||
| 84 | + <el-input v-model="form.message" placeholder="请输入错误码提示" /> | ||
| 85 | + </el-form-item> | ||
| 86 | + <el-form-item label="备注" prop="memo"> | ||
| 87 | + <el-input v-model="form.memo" placeholder="请输入备注" /> | ||
| 88 | + </el-form-item> | ||
| 89 | + </el-form> | ||
| 90 | + <div slot="footer" class="dialog-footer"> | ||
| 91 | + <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 92 | + <el-button @click="cancel">取 消</el-button> | ||
| 93 | + </div> | ||
| 94 | + </el-dialog> | ||
| 95 | + </div> | ||
| 96 | +</template> | ||
| 97 | + | ||
| 98 | +<script> | ||
| 99 | +import { createErrorCode, updateErrorCode, deleteErrorCode, getErrorCode, getErrorCodePage, exportErrorCodeExcel } from "@/api/system/errorCode"; | ||
| 100 | + | ||
| 101 | +export default { | ||
| 102 | + name: "ErrorCode", | ||
| 103 | + components: { | ||
| 104 | + }, | ||
| 105 | + data() { | ||
| 106 | + return { | ||
| 107 | + // 遮罩层 | ||
| 108 | + loading: true, | ||
| 109 | + // 显示搜索条件 | ||
| 110 | + showSearch: true, | ||
| 111 | + // 总条数 | ||
| 112 | + total: 0, | ||
| 113 | + // 错误码列表 | ||
| 114 | + list: [], | ||
| 115 | + // 弹出层标题 | ||
| 116 | + title: "", | ||
| 117 | + // 是否显示弹出层 | ||
| 118 | + open: false, | ||
| 119 | + dateRangeCreateTime: [], | ||
| 120 | + // 查询参数 | ||
| 121 | + queryParams: { | ||
| 122 | + pageNo: 1, | ||
| 123 | + pageSize: 10, | ||
| 124 | + type: null, | ||
| 125 | + applicationName: null, | ||
| 126 | + code: null, | ||
| 127 | + message: null, | ||
| 128 | + }, | ||
| 129 | + // 表单参数 | ||
| 130 | + form: {}, | ||
| 131 | + // 表单校验 | ||
| 132 | + rules: { | ||
| 133 | + applicationName: [{ required: true, message: "应用名不能为空", trigger: "blur" }], | ||
| 134 | + code: [{ required: true, message: "错误码编码不能为空", trigger: "blur" }], | ||
| 135 | + message: [{ required: true, message: "错误码提示不能为空", trigger: "blur" }], | ||
| 136 | + } | ||
| 137 | + }; | ||
| 138 | + }, | ||
| 139 | + created() { | ||
| 140 | + this.getList(); | ||
| 141 | + }, | ||
| 142 | + methods: { | ||
| 143 | + /** 查询列表 */ | ||
| 144 | + getList() { | ||
| 145 | + this.loading = true; | ||
| 146 | + // 处理查询参数 | ||
| 147 | + let params = {...this.queryParams}; | ||
| 148 | + this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 149 | + // 执行查询 | ||
| 150 | + getErrorCodePage(params).then(response => { | ||
| 151 | + this.list = response.data.list; | ||
| 152 | + this.total = response.data.total; | ||
| 153 | + this.loading = false; | ||
| 154 | + }); | ||
| 155 | + }, | ||
| 156 | + /** 取消按钮 */ | ||
| 157 | + cancel() { | ||
| 158 | + this.open = false; | ||
| 159 | + this.reset(); | ||
| 160 | + }, | ||
| 161 | + /** 表单重置 */ | ||
| 162 | + reset() { | ||
| 163 | + this.form = { | ||
| 164 | + id: undefined, | ||
| 165 | + applicationName: undefined, | ||
| 166 | + code: undefined, | ||
| 167 | + message: undefined, | ||
| 168 | + memo: undefined, | ||
| 169 | + }; | ||
| 170 | + this.resetForm("form"); | ||
| 171 | + }, | ||
| 172 | + /** 搜索按钮操作 */ | ||
| 173 | + handleQuery() { | ||
| 174 | + this.queryParams.pageNo = 1; | ||
| 175 | + this.getList(); | ||
| 176 | + }, | ||
| 177 | + /** 重置按钮操作 */ | ||
| 178 | + resetQuery() { | ||
| 179 | + this.dateRangeCreateTime = []; | ||
| 180 | + this.resetForm("queryForm"); | ||
| 181 | + this.handleQuery(); | ||
| 182 | + }, | ||
| 183 | + /** 新增按钮操作 */ | ||
| 184 | + handleAdd() { | ||
| 185 | + this.reset(); | ||
| 186 | + this.open = true; | ||
| 187 | + this.title = "添加错误码"; | ||
| 188 | + }, | ||
| 189 | + /** 修改按钮操作 */ | ||
| 190 | + handleUpdate(row) { | ||
| 191 | + this.reset(); | ||
| 192 | + const id = row.id; | ||
| 193 | + getErrorCode(id).then(response => { | ||
| 194 | + this.form = response.data; | ||
| 195 | + this.open = true; | ||
| 196 | + this.title = "修改错误码"; | ||
| 197 | + }); | ||
| 198 | + }, | ||
| 199 | + /** 提交按钮 */ | ||
| 200 | + submitForm() { | ||
| 201 | + this.$refs["form"].validate(valid => { | ||
| 202 | + if (!valid) { | ||
| 203 | + return; | ||
| 204 | + } | ||
| 205 | + // 修改的提交 | ||
| 206 | + if (this.form.id != null) { | ||
| 207 | + updateErrorCode(this.form).then(response => { | ||
| 208 | + this.msgSuccess("修改成功"); | ||
| 209 | + this.open = false; | ||
| 210 | + this.getList(); | ||
| 211 | + }); | ||
| 212 | + return; | ||
| 213 | + } | ||
| 214 | + // 添加的提交 | ||
| 215 | + createErrorCode(this.form).then(response => { | ||
| 216 | + this.msgSuccess("新增成功"); | ||
| 217 | + this.open = false; | ||
| 218 | + this.getList(); | ||
| 219 | + }); | ||
| 220 | + }); | ||
| 221 | + }, | ||
| 222 | + /** 删除按钮操作 */ | ||
| 223 | + handleDelete(row) { | ||
| 224 | + const id = row.id; | ||
| 225 | + this.$confirm('是否确认删除错误码编号为"' + id + '"的数据项?', "警告", { | ||
| 226 | + confirmButtonText: "确定", | ||
| 227 | + cancelButtonText: "取消", | ||
| 228 | + type: "warning" | ||
| 229 | + }).then(function() { | ||
| 230 | + return deleteErrorCode(id); | ||
| 231 | + }).then(() => { | ||
| 232 | + this.getList(); | ||
| 233 | + this.msgSuccess("删除成功"); | ||
| 234 | + }) | ||
| 235 | + }, | ||
| 236 | + /** 导出按钮操作 */ | ||
| 237 | + handleExport() { | ||
| 238 | + // 处理查询参数 | ||
| 239 | + let params = {...this.queryParams}; | ||
| 240 | + params.pageNo = undefined; | ||
| 241 | + params.pageSize = undefined; | ||
| 242 | + this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | ||
| 243 | + // 执行导出 | ||
| 244 | + this.$confirm('是否确认导出所有错误码数据项?', "警告", { | ||
| 245 | + confirmButtonText: "确定", | ||
| 246 | + cancelButtonText: "取消", | ||
| 247 | + type: "warning" | ||
| 248 | + }).then(function() { | ||
| 249 | + return exportErrorCodeExcel(params); | ||
| 250 | + }).then(response => { | ||
| 251 | + this.downloadExcel(response, '错误码.xls'); | ||
| 252 | + }) | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | +}; | ||
| 256 | +</script> |
src/main/java/cn/iocoder/dashboard/modules/infra/convert/errorcode/InfErrorCodeConvert.java deleted
| 1 | -package cn.iocoder.dashboard.modules.infra.convert.errorcode; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 4 | -import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; | ||
| 5 | -import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO; | ||
| 6 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO; | ||
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExcelVO; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeRespVO; | ||
| 9 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO; | ||
| 10 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | ||
| 11 | -import org.mapstruct.Mapper; | ||
| 12 | -import org.mapstruct.factory.Mappers; | ||
| 13 | - | ||
| 14 | -import java.util.List; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * 错误码 Convert | ||
| 18 | - * | ||
| 19 | - * @author 芋道源码 | ||
| 20 | - */ | ||
| 21 | -@Mapper | ||
| 22 | -public interface InfErrorCodeConvert { | ||
| 23 | - | ||
| 24 | - InfErrorCodeConvert INSTANCE = Mappers.getMapper(InfErrorCodeConvert.class); | ||
| 25 | - | ||
| 26 | - InfErrorCodeDO convert(InfErrorCodeCreateReqVO bean); | ||
| 27 | - | ||
| 28 | - InfErrorCodeDO convert(InfErrorCodeUpdateReqVO bean); | ||
| 29 | - | ||
| 30 | - InfErrorCodeRespVO convert(InfErrorCodeDO bean); | ||
| 31 | - | ||
| 32 | - List<InfErrorCodeRespVO> convertList(List<InfErrorCodeDO> list); | ||
| 33 | - | ||
| 34 | - PageResult<InfErrorCodeRespVO> convertPage(PageResult<InfErrorCodeDO> page); | ||
| 35 | - | ||
| 36 | - List<InfErrorCodeExcelVO> convertList02(List<InfErrorCodeDO> list); | ||
| 37 | - | ||
| 38 | - InfErrorCodeDO convert(ErrorCodeAutoGenerateReqDTO bean); | ||
| 39 | - | ||
| 40 | - List<ErrorCodeRespDTO> convertList03(List<InfErrorCodeDO> list); | ||
| 41 | - | ||
| 42 | -} |
src/main/java/cn/iocoder/dashboard/modules/infra/enums/InfErrorCodeConstants.java
| @@ -30,9 +30,4 @@ public interface InfErrorCodeConstants { | @@ -30,9 +30,4 @@ public interface InfErrorCodeConstants { | ||
| 30 | // ========== 文件 1001003000 ========== | 30 | // ========== 文件 1001003000 ========== |
| 31 | ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003000, "文件不存在"); | 31 | ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003000, "文件不存在"); |
| 32 | 32 | ||
| 33 | - // ========== 错误码模块 1001004000 ========== | ||
| 34 | - ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1001004000, "错误码不存在"); | ||
| 35 | - ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1001004001, "已经存在编码为【{}}】的错误码"); | ||
| 36 | - ErrorCode ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR = new ErrorCode(1001004002, "不能修改类型为系统内置的错误码"); | ||
| 37 | - | ||
| 38 | } | 33 | } |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExportReqVO.java
| @@ -8,6 +8,9 @@ import lombok.Data; | @@ -8,6 +8,9 @@ import lombok.Data; | ||
| 8 | @Data | 8 | @Data |
| 9 | public class SysPostExportReqVO { | 9 | public class SysPostExportReqVO { |
| 10 | 10 | ||
| 11 | + @ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配") | ||
| 12 | + private String code; | ||
| 13 | + | ||
| 11 | @ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配") | 14 | @ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配") |
| 12 | private String name; | 15 | private String name; |
| 13 | 16 |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostPageReqVO.java
| @@ -11,6 +11,9 @@ import lombok.EqualsAndHashCode; | @@ -11,6 +11,9 @@ import lombok.EqualsAndHashCode; | ||
| 11 | @EqualsAndHashCode(callSuper = true) | 11 | @EqualsAndHashCode(callSuper = true) |
| 12 | public class SysPostPageReqVO extends PageParam { | 12 | public class SysPostPageReqVO extends PageParam { |
| 13 | 13 | ||
| 14 | + @ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配") | ||
| 15 | + private String code; | ||
| 16 | + | ||
| 14 | @ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配") | 17 | @ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配") |
| 15 | private String name; | 18 | private String name; |
| 16 | 19 |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/InfErrorCodeController.http renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/SysErrorCodeController.http
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/InfErrorCodeController.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/SysErrorCodeController.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.pojo.CommonResult; | 3 | import cn.iocoder.dashboard.common.pojo.CommonResult; |
| 4 | import cn.iocoder.dashboard.common.pojo.PageResult; | 4 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 5 | import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; | 5 | import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; |
| 6 | import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; | 6 | import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; |
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.*; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.convert.errorcode.InfErrorCodeConvert; | ||
| 9 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | ||
| 10 | -import cn.iocoder.dashboard.modules.infra.service.errorcode.InfErrorCodeService; | 7 | +import cn.iocoder.dashboard.modules.system.convert.errorcode.SysErrorCodeConvert; |
| 8 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.*; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.service.errorcode.SysErrorCodeService; | ||
| 11 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiImplicitParam; | 12 | import io.swagger.annotations.ApiImplicitParam; |
| 13 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
| @@ -26,24 +26,24 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat | @@ -26,24 +26,24 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat | ||
| 26 | 26 | ||
| 27 | @Api(tags = "错误码") | 27 | @Api(tags = "错误码") |
| 28 | @RestController | 28 | @RestController |
| 29 | -@RequestMapping("/infra/error-code") | 29 | +@RequestMapping("/system/error-code") |
| 30 | @Validated | 30 | @Validated |
| 31 | -public class InfErrorCodeController { | 31 | +public class SysErrorCodeController { |
| 32 | 32 | ||
| 33 | @Resource | 33 | @Resource |
| 34 | - private InfErrorCodeService errorCodeService; | 34 | + private SysErrorCodeService errorCodeService; |
| 35 | 35 | ||
| 36 | @PostMapping("/create") | 36 | @PostMapping("/create") |
| 37 | @ApiOperation("创建错误码") | 37 | @ApiOperation("创建错误码") |
| 38 | - @PreAuthorize("@ss.hasPermission('infra:error-code:create')") | ||
| 39 | - public CommonResult<Long> createErrorCode(@Valid @RequestBody InfErrorCodeCreateReqVO createReqVO) { | 38 | + @PreAuthorize("@ss.hasPermission('system:error-code:create')") |
| 39 | + public CommonResult<Long> createErrorCode(@Valid @RequestBody SysErrorCodeCreateReqVO createReqVO) { | ||
| 40 | return success(errorCodeService.createErrorCode(createReqVO)); | 40 | return success(errorCodeService.createErrorCode(createReqVO)); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | @PutMapping("/update") | 43 | @PutMapping("/update") |
| 44 | @ApiOperation("更新错误码") | 44 | @ApiOperation("更新错误码") |
| 45 | - @PreAuthorize("@ss.hasPermission('infra:error-code:update')") | ||
| 46 | - public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody InfErrorCodeUpdateReqVO updateReqVO) { | 45 | + @PreAuthorize("@ss.hasPermission('system:error-code:update')") |
| 46 | + public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody SysErrorCodeUpdateReqVO updateReqVO) { | ||
| 47 | errorCodeService.updateErrorCode(updateReqVO); | 47 | errorCodeService.updateErrorCode(updateReqVO); |
| 48 | return success(true); | 48 | return success(true); |
| 49 | } | 49 | } |
| @@ -51,7 +51,7 @@ public class InfErrorCodeController { | @@ -51,7 +51,7 @@ public class InfErrorCodeController { | ||
| 51 | @DeleteMapping("/delete") | 51 | @DeleteMapping("/delete") |
| 52 | @ApiOperation("删除错误码") | 52 | @ApiOperation("删除错误码") |
| 53 | @ApiImplicitParam(name = "id", value = "编号", required = true) | 53 | @ApiImplicitParam(name = "id", value = "编号", required = true) |
| 54 | - @PreAuthorize("@ss.hasPermission('infra:error-code:delete')") | 54 | + @PreAuthorize("@ss.hasPermission('system:error-code:delete')") |
| 55 | public CommonResult<Boolean> deleteErrorCode(@RequestParam("id") Long id) { | 55 | public CommonResult<Boolean> deleteErrorCode(@RequestParam("id") Long id) { |
| 56 | errorCodeService.deleteErrorCode(id); | 56 | errorCodeService.deleteErrorCode(id); |
| 57 | return success(true); | 57 | return success(true); |
| @@ -60,30 +60,30 @@ public class InfErrorCodeController { | @@ -60,30 +60,30 @@ public class InfErrorCodeController { | ||
| 60 | @GetMapping("/get") | 60 | @GetMapping("/get") |
| 61 | @ApiOperation("获得错误码") | 61 | @ApiOperation("获得错误码") |
| 62 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 62 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 63 | - @PreAuthorize("@ss.hasPermission('infra:error-code:query')") | ||
| 64 | - public CommonResult<InfErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) { | ||
| 65 | - InfErrorCodeDO errorCode = errorCodeService.getErrorCode(id); | ||
| 66 | - return success(InfErrorCodeConvert.INSTANCE.convert(errorCode)); | 63 | + @PreAuthorize("@ss.hasPermission('system:error-code:query')") |
| 64 | + public CommonResult<SysErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) { | ||
| 65 | + SysErrorCodeDO errorCode = errorCodeService.getErrorCode(id); | ||
| 66 | + return success(SysErrorCodeConvert.INSTANCE.convert(errorCode)); | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @GetMapping("/page") | 69 | @GetMapping("/page") |
| 70 | @ApiOperation("获得错误码分页") | 70 | @ApiOperation("获得错误码分页") |
| 71 | - @PreAuthorize("@ss.hasPermission('infra:error-code:query')") | ||
| 72 | - public CommonResult<PageResult<InfErrorCodeRespVO>> getErrorCodePage(@Valid InfErrorCodePageReqVO pageVO) { | ||
| 73 | - PageResult<InfErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO); | ||
| 74 | - return success(InfErrorCodeConvert.INSTANCE.convertPage(pageResult)); | 71 | + @PreAuthorize("@ss.hasPermission('system:error-code:query')") |
| 72 | + public CommonResult<PageResult<SysErrorCodeRespVO>> getErrorCodePage(@Valid SysErrorCodePageReqVO pageVO) { | ||
| 73 | + PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO); | ||
| 74 | + return success(SysErrorCodeConvert.INSTANCE.convertPage(pageResult)); | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | @GetMapping("/export-excel") | 77 | @GetMapping("/export-excel") |
| 78 | @ApiOperation("导出错误码 Excel") | 78 | @ApiOperation("导出错误码 Excel") |
| 79 | - @PreAuthorize("@ss.hasPermission('infra:error-code:export')") | 79 | + @PreAuthorize("@ss.hasPermission('system:error-code:export')") |
| 80 | @OperateLog(type = EXPORT) | 80 | @OperateLog(type = EXPORT) |
| 81 | - public void exportErrorCodeExcel(@Valid InfErrorCodeExportReqVO exportReqVO, | 81 | + public void exportErrorCodeExcel(@Valid SysErrorCodeExportReqVO exportReqVO, |
| 82 | HttpServletResponse response) throws IOException { | 82 | HttpServletResponse response) throws IOException { |
| 83 | - List<InfErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO); | 83 | + List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO); |
| 84 | // 导出 Excel | 84 | // 导出 Excel |
| 85 | - List<InfErrorCodeExcelVO> datas = InfErrorCodeConvert.INSTANCE.convertList02(list); | ||
| 86 | - ExcelUtils.write(response, "错误码.xls", "数据", InfErrorCodeExcelVO.class, datas); | 85 | + List<SysErrorCodeExcelVO> datas = SysErrorCodeConvert.INSTANCE.convertList02(list); |
| 86 | + ExcelUtils.write(response, "错误码.xls", "数据", SysErrorCodeExcelVO.class, datas); | ||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | } | 89 | } |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeBaseVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeBaseVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModelProperty; | 3 | import io.swagger.annotations.ApiModelProperty; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; | @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; | ||
| 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 10 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 11 | */ | 11 | */ |
| 12 | @Data | 12 | @Data |
| 13 | -public class InfErrorCodeBaseVO { | 13 | +public class SysErrorCodeBaseVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "应用名", required = true, example = "dashboard") | 15 | @ApiModelProperty(value = "应用名", required = true, example = "dashboard") |
| 16 | @NotNull(message = "应用名不能为空") | 16 | @NotNull(message = "应用名不能为空") |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeCreateReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeCreateReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| @@ -9,6 +9,6 @@ import lombok.ToString; | @@ -9,6 +9,6 @@ import lombok.ToString; | ||
| 9 | @Data | 9 | @Data |
| 10 | @EqualsAndHashCode(callSuper = true) | 10 | @EqualsAndHashCode(callSuper = true) |
| 11 | @ToString(callSuper = true) | 11 | @ToString(callSuper = true) |
| 12 | -public class InfErrorCodeCreateReqVO extends InfErrorCodeBaseVO { | 12 | +public class SysErrorCodeCreateReqVO extends SysErrorCodeBaseVO { |
| 13 | 13 | ||
| 14 | } | 14 | } |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeExcelVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeExcelVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; | 3 | import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; | 4 | import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; |
| @@ -7,7 +7,7 @@ import lombok.Data; | @@ -7,7 +7,7 @@ import lombok.Data; | ||
| 7 | 7 | ||
| 8 | import java.util.Date; | 8 | import java.util.Date; |
| 9 | 9 | ||
| 10 | -import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF_ERROR_CODE_TYPE; | 10 | +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.SYS_ERROR_CODE_TYPE; |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * 错误码 Excel VO | 13 | * 错误码 Excel VO |
| @@ -15,13 +15,13 @@ import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF | @@ -15,13 +15,13 @@ import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.INF | ||
| 15 | * @author 芋道源码 | 15 | * @author 芋道源码 |
| 16 | */ | 16 | */ |
| 17 | @Data | 17 | @Data |
| 18 | -public class InfErrorCodeExcelVO { | 18 | +public class SysErrorCodeExcelVO { |
| 19 | 19 | ||
| 20 | @ExcelProperty("错误码编号") | 20 | @ExcelProperty("错误码编号") |
| 21 | private Long id; | 21 | private Long id; |
| 22 | 22 | ||
| 23 | @ExcelProperty(value = "错误码类型", converter = DictConvert.class) | 23 | @ExcelProperty(value = "错误码类型", converter = DictConvert.class) |
| 24 | - @DictFormat(INF_ERROR_CODE_TYPE) | 24 | + @DictFormat(SYS_ERROR_CODE_TYPE) |
| 25 | private Integer type; | 25 | private Integer type; |
| 26 | 26 | ||
| 27 | @ExcelProperty("应用名") | 27 | @ExcelProperty("应用名") |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeExportReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeExportReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| @@ -11,7 +11,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU | @@ -11,7 +11,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU | ||
| 11 | 11 | ||
| 12 | @ApiModel(value = "错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的") | 12 | @ApiModel(value = "错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的") |
| 13 | @Data | 13 | @Data |
| 14 | -public class InfErrorCodeExportReqVO { | 14 | +public class SysErrorCodeExportReqVO { |
| 15 | 15 | ||
| 16 | @ApiModelProperty(value = "错误码类型", example = "1") | 16 | @ApiModelProperty(value = "错误码类型", example = "1") |
| 17 | private Integer type; | 17 | private Integer type; |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodePageReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodePageReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.pojo.PageParam; | 3 | import cn.iocoder.dashboard.common.pojo.PageParam; |
| 4 | import io.swagger.annotations.ApiModel; | 4 | import io.swagger.annotations.ApiModel; |
| @@ -16,7 +16,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU | @@ -16,7 +16,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU | ||
| 16 | @Data | 16 | @Data |
| 17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | @ToString(callSuper = true) | 18 | @ToString(callSuper = true) |
| 19 | -public class InfErrorCodePageReqVO extends PageParam { | 19 | +public class SysErrorCodePageReqVO extends PageParam { |
| 20 | 20 | ||
| 21 | @ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类") | 21 | @ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类") |
| 22 | private Integer type; | 22 | private Integer type; |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeRespVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| @@ -12,7 +12,7 @@ import java.util.Date; | @@ -12,7 +12,7 @@ import java.util.Date; | ||
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfErrorCodeRespVO extends InfErrorCodeBaseVO { | 15 | +public class SysErrorCodeRespVO extends SysErrorCodeBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "错误码编号", required = true, example = "1024") | 17 | @ApiModelProperty(value = "错误码编号", required = true, example = "1024") |
| 18 | private Long id; | 18 | private Long id; |
src/main/java/cn/iocoder/dashboard/modules/infra/controller/errorcode/vo/InfErrorCodeUpdateReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/errorcode/vo/SysErrorCodeUpdateReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.controller.errorcode.vo; | 1 | +package cn.iocoder.dashboard.modules.system.controller.errorcode.vo; |
| 2 | 2 | ||
| 3 | import io.swagger.annotations.ApiModel; | 3 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
| @@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull; | @@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull; | ||
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class InfErrorCodeUpdateReqVO extends InfErrorCodeBaseVO { | 15 | +public class SysErrorCodeUpdateReqVO extends SysErrorCodeBaseVO { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "错误码编号", required = true, example = "1024") | 17 | @ApiModelProperty(value = "错误码编号", required = true, example = "1024") |
| 18 | @NotNull(message = "错误码编号不能为空") | 18 | @NotNull(message = "错误码编号不能为空") |
src/main/java/cn/iocoder/dashboard/modules/system/convert/errorcode/SysErrorCodeConvert.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.modules.system.convert.errorcode; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; | ||
| 5 | +import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO; | ||
| 6 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExcelVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeRespVO; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 11 | +import org.mapstruct.Mapper; | ||
| 12 | +import org.mapstruct.factory.Mappers; | ||
| 13 | + | ||
| 14 | +import java.util.List; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 错误码 Convert | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 21 | +@Mapper | ||
| 22 | +public interface SysErrorCodeConvert { | ||
| 23 | + | ||
| 24 | + SysErrorCodeConvert INSTANCE = Mappers.getMapper(SysErrorCodeConvert.class); | ||
| 25 | + | ||
| 26 | + SysErrorCodeDO convert(SysErrorCodeCreateReqVO bean); | ||
| 27 | + | ||
| 28 | + SysErrorCodeDO convert(SysErrorCodeUpdateReqVO bean); | ||
| 29 | + | ||
| 30 | + SysErrorCodeRespVO convert(SysErrorCodeDO bean); | ||
| 31 | + | ||
| 32 | + List<SysErrorCodeRespVO> convertList(List<SysErrorCodeDO> list); | ||
| 33 | + | ||
| 34 | + PageResult<SysErrorCodeRespVO> convertPage(PageResult<SysErrorCodeDO> page); | ||
| 35 | + | ||
| 36 | + List<SysErrorCodeExcelVO> convertList02(List<SysErrorCodeDO> list); | ||
| 37 | + | ||
| 38 | + SysErrorCodeDO convert(ErrorCodeAutoGenerateReqDTO bean); | ||
| 39 | + | ||
| 40 | + List<ErrorCodeRespDTO> convertList03(List<SysErrorCodeDO> list); | ||
| 41 | + | ||
| 42 | +} |
src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/errorcode/InfErrorCodeDO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/errorcode/SysErrorCodeDO.java
| 1 | -package cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum; | 4 | +import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -13,11 +13,11 @@ import lombok.ToString; | @@ -13,11 +13,11 @@ import lombok.ToString; | ||
| 13 | * | 13 | * |
| 14 | * @author 芋道源码 | 14 | * @author 芋道源码 |
| 15 | */ | 15 | */ |
| 16 | -@TableName(value = "inf_error_code") | 16 | +@TableName(value = "sys_error_code") |
| 17 | @Data | 17 | @Data |
| 18 | @EqualsAndHashCode(callSuper = true) | 18 | @EqualsAndHashCode(callSuper = true) |
| 19 | @ToString(callSuper = true) | 19 | @ToString(callSuper = true) |
| 20 | -public class InfErrorCodeDO extends BaseDO { | 20 | +public class SysErrorCodeDO extends BaseDO { |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 错误码编号,自增 | 23 | * 错误码编号,自增 |
| @@ -27,7 +27,7 @@ public class InfErrorCodeDO extends BaseDO { | @@ -27,7 +27,7 @@ public class InfErrorCodeDO extends BaseDO { | ||
| 27 | /** | 27 | /** |
| 28 | * 错误码类型 | 28 | * 错误码类型 |
| 29 | * | 29 | * |
| 30 | - * 枚举 {@link InfErrorCodeTypeEnum} | 30 | + * 枚举 {@link SysErrorCodeTypeEnum} |
| 31 | */ | 31 | */ |
| 32 | private Integer type; | 32 | private Integer type; |
| 33 | /** | 33 | /** |
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dept/SysPostMapper.java
| @@ -22,12 +22,15 @@ public interface SysPostMapper extends BaseMapperX<SysPostDO> { | @@ -22,12 +22,15 @@ public interface SysPostMapper extends BaseMapperX<SysPostDO> { | ||
| 22 | 22 | ||
| 23 | default PageResult<SysPostDO> selectPage(SysPostPageReqVO reqVO) { | 23 | default PageResult<SysPostDO> selectPage(SysPostPageReqVO reqVO) { |
| 24 | return selectPage(reqVO, new QueryWrapperX<SysPostDO>() | 24 | return selectPage(reqVO, new QueryWrapperX<SysPostDO>() |
| 25 | + .likeIfPresent("code", reqVO.getCode()) | ||
| 25 | .likeIfPresent("name", reqVO.getName()) | 26 | .likeIfPresent("name", reqVO.getName()) |
| 26 | .eqIfPresent("status", reqVO.getStatus())); | 27 | .eqIfPresent("status", reqVO.getStatus())); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | default List<SysPostDO> selectList(SysPostExportReqVO reqVO) { | 30 | default List<SysPostDO> selectList(SysPostExportReqVO reqVO) { |
| 30 | - return selectList(new QueryWrapperX<SysPostDO>().likeIfPresent("name", reqVO.getName()) | 31 | + return selectList(new QueryWrapperX<SysPostDO>() |
| 32 | + .likeIfPresent("code", reqVO.getCode()) | ||
| 33 | + .likeIfPresent("name", reqVO.getName()) | ||
| 31 | .eqIfPresent("status", reqVO.getStatus())); | 34 | .eqIfPresent("status", reqVO.getStatus())); |
| 32 | } | 35 | } |
| 33 | 36 |
src/main/java/cn/iocoder/dashboard/modules/infra/dal/mysql/errorcode/InfErrorCodeMapper.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/errorcode/SysErrorCodeMapper.java
| 1 | -package cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.dal.mysql.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.pojo.PageResult; | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; | 5 | import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; |
| 6 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO; | ||
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | 6 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO; |
| 7 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 10 | import org.apache.ibatis.annotations.Mapper; | 10 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 11 | ||
| @@ -14,10 +14,10 @@ import java.util.Date; | @@ -14,10 +14,10 @@ import java.util.Date; | ||
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | 15 | ||
| 16 | @Mapper | 16 | @Mapper |
| 17 | -public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> { | 17 | +public interface SysErrorCodeMapper extends BaseMapperX<SysErrorCodeDO> { |
| 18 | 18 | ||
| 19 | - default PageResult<InfErrorCodeDO> selectPage(InfErrorCodePageReqVO reqVO) { | ||
| 20 | - return selectPage(reqVO, new QueryWrapperX<InfErrorCodeDO>() | 19 | + default PageResult<SysErrorCodeDO> selectPage(SysErrorCodePageReqVO reqVO) { |
| 20 | + return selectPage(reqVO, new QueryWrapperX<SysErrorCodeDO>() | ||
| 21 | .eqIfPresent("type", reqVO.getType()) | 21 | .eqIfPresent("type", reqVO.getType()) |
| 22 | .likeIfPresent("application_name", reqVO.getApplicationName()) | 22 | .likeIfPresent("application_name", reqVO.getApplicationName()) |
| 23 | .eqIfPresent("code", reqVO.getCode()) | 23 | .eqIfPresent("code", reqVO.getCode()) |
| @@ -26,8 +26,8 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> { | @@ -26,8 +26,8 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> { | ||
| 26 | .orderByAsc("application_name", "code")); | 26 | .orderByAsc("application_name", "code")); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | - default List<InfErrorCodeDO> selectList(InfErrorCodeExportReqVO reqVO) { | ||
| 30 | - return selectList(new QueryWrapperX<InfErrorCodeDO>() | 29 | + default List<SysErrorCodeDO> selectList(SysErrorCodeExportReqVO reqVO) { |
| 30 | + return selectList(new QueryWrapperX<SysErrorCodeDO>() | ||
| 31 | .eqIfPresent("type", reqVO.getType()) | 31 | .eqIfPresent("type", reqVO.getType()) |
| 32 | .likeIfPresent("application_name", reqVO.getApplicationName()) | 32 | .likeIfPresent("application_name", reqVO.getApplicationName()) |
| 33 | .eqIfPresent("code", reqVO.getCode()) | 33 | .eqIfPresent("code", reqVO.getCode()) |
| @@ -36,16 +36,16 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> { | @@ -36,16 +36,16 @@ public interface InfErrorCodeMapper extends BaseMapperX<InfErrorCodeDO> { | ||
| 36 | .orderByAsc("application_name", "code")); | 36 | .orderByAsc("application_name", "code")); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | - default List<InfErrorCodeDO> selectListByCodes(Collection<Integer> codes) { | ||
| 40 | - return selectList(new QueryWrapper<InfErrorCodeDO>().in("code", codes)); | 39 | + default List<SysErrorCodeDO> selectListByCodes(Collection<Integer> codes) { |
| 40 | + return selectList(new QueryWrapper<SysErrorCodeDO>().in("code", codes)); | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | - default InfErrorCodeDO selectByCode(Integer code) { | ||
| 44 | - return selectOne(new QueryWrapper<InfErrorCodeDO>().eq("code", code)); | 43 | + default SysErrorCodeDO selectByCode(Integer code) { |
| 44 | + return selectOne(new QueryWrapper<SysErrorCodeDO>().eq("code", code)); | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | - default List<InfErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) { | ||
| 48 | - return selectList(new QueryWrapperX<InfErrorCodeDO>().eq("application_name", applicationName) | 47 | + default List<SysErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) { |
| 48 | + return selectList(new QueryWrapperX<SysErrorCodeDO>().eq("application_name", applicationName) | ||
| 49 | .gtIfPresent("update_time", minUpdateTime)); | 49 | .gtIfPresent("update_time", minUpdateTime)); |
| 50 | } | 50 | } |
| 51 | 51 |
src/main/java/cn/iocoder/dashboard/modules/system/enums/SysErrorCodeConstants.java
| @@ -91,4 +91,8 @@ public interface SysErrorCodeConstants { | @@ -91,4 +91,8 @@ public interface SysErrorCodeConstants { | ||
| 91 | ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1002012000, "手机号不存在"); | 91 | ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1002012000, "手机号不存在"); |
| 92 | ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1002012001, "模板参数({})缺失"); | 92 | ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1002012001, "模板参数({})缺失"); |
| 93 | 93 | ||
| 94 | + // ========== 错误码模块 1002013000 ========== | ||
| 95 | + ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1002013000, "错误码不存在"); | ||
| 96 | + ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1002013001, "已经存在编码为【{}】的错误码"); | ||
| 97 | + | ||
| 94 | } | 98 | } |
src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/SysDictTypeEnum.java
| @@ -22,12 +22,12 @@ public enum SysDictTypeEnum { | @@ -22,12 +22,12 @@ public enum SysDictTypeEnum { | ||
| 22 | SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型 | 22 | SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型 |
| 23 | SYS_SMS_SEND_STATUS("sys_sms_send_status"), // 短信发送状态 | 23 | SYS_SMS_SEND_STATUS("sys_sms_send_status"), // 短信发送状态 |
| 24 | SYS_SMS_RECEIVE_STATUS("sys_sms_receive_status"), // 短信接收状态 | 24 | SYS_SMS_RECEIVE_STATUS("sys_sms_receive_status"), // 短信接收状态 |
| 25 | + SYS_ERROR_CODE_TYPE("inf_error_code_type"), // 错误码的类型枚举 | ||
| 25 | 26 | ||
| 26 | INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型 | 27 | INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型 |
| 27 | INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举 | 28 | INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举 |
| 28 | INF_JOB_LOG_STATUS("inf_job_log_status"), // 定时任务日志状态的枚举 | 29 | INF_JOB_LOG_STATUS("inf_job_log_status"), // 定时任务日志状态的枚举 |
| 29 | INF_API_ERROR_LOG_PROCESS_STATUS("inf_api_error_log_process_status"), // API 错误日志的处理状态的枚举 | 30 | INF_API_ERROR_LOG_PROCESS_STATUS("inf_api_error_log_process_status"), // API 错误日志的处理状态的枚举 |
| 30 | - INF_ERROR_CODE_TYPE("inf_error_code_type"), // 错误码的类型枚举 | ||
| 31 | ; | 31 | ; |
| 32 | 32 | ||
| 33 | 33 |
src/main/java/cn/iocoder/dashboard/modules/infra/enums/errorcode/InfErrorCodeTypeEnum.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/enums/errorcode/SysErrorCodeTypeEnum.java
| 1 | -package cn.iocoder.dashboard.modules.infra.enums.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.enums.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.core.IntArrayValuable; | 3 | import cn.iocoder.dashboard.common.core.IntArrayValuable; |
| 4 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| @@ -13,7 +13,7 @@ import java.util.Arrays; | @@ -13,7 +13,7 @@ import java.util.Arrays; | ||
| 13 | */ | 13 | */ |
| 14 | @AllArgsConstructor | 14 | @AllArgsConstructor |
| 15 | @Getter | 15 | @Getter |
| 16 | -public enum InfErrorCodeTypeEnum implements IntArrayValuable { | 16 | +public enum SysErrorCodeTypeEnum implements IntArrayValuable { |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * 自动生成 | 19 | * 自动生成 |
| @@ -24,7 +24,7 @@ public enum InfErrorCodeTypeEnum implements IntArrayValuable { | @@ -24,7 +24,7 @@ public enum InfErrorCodeTypeEnum implements IntArrayValuable { | ||
| 24 | */ | 24 | */ |
| 25 | MANUAL_OPERATION(2); | 25 | MANUAL_OPERATION(2); |
| 26 | 26 | ||
| 27 | - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InfErrorCodeTypeEnum::getType).toArray(); | 27 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SysErrorCodeTypeEnum::getType).toArray(); |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * 类型 | 30 | * 类型 |
src/main/java/cn/iocoder/dashboard/modules/infra/service/errorcode/InfErrorCodeService.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/service/errorcode/SysErrorCodeService.java
| 1 | -package cn.iocoder.dashboard.modules.infra.service.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.service.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.pojo.PageResult; | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | import cn.iocoder.dashboard.framework.errorcode.core.service.ErrorCodeFrameworkService; | 4 | import cn.iocoder.dashboard.framework.errorcode.core.service.ErrorCodeFrameworkService; |
| 5 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO; | ||
| 6 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO; | ||
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO; | ||
| 9 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | 5 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO; |
| 6 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 10 | 10 | ||
| 11 | import javax.validation.Valid; | 11 | import javax.validation.Valid; |
| 12 | import java.util.List; | 12 | import java.util.List; |
| @@ -16,7 +16,7 @@ import java.util.List; | @@ -16,7 +16,7 @@ import java.util.List; | ||
| 16 | * | 16 | * |
| 17 | * @author 芋道源码 | 17 | * @author 芋道源码 |
| 18 | */ | 18 | */ |
| 19 | -public interface InfErrorCodeService extends ErrorCodeFrameworkService { | 19 | +public interface SysErrorCodeService extends ErrorCodeFrameworkService { |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * 创建错误码 | 22 | * 创建错误码 |
| @@ -24,14 +24,14 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | @@ -24,14 +24,14 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | ||
| 24 | * @param createReqVO 创建信息 | 24 | * @param createReqVO 创建信息 |
| 25 | * @return 编号 | 25 | * @return 编号 |
| 26 | */ | 26 | */ |
| 27 | - Long createErrorCode(@Valid InfErrorCodeCreateReqVO createReqVO); | 27 | + Long createErrorCode(@Valid SysErrorCodeCreateReqVO createReqVO); |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * 更新错误码 | 30 | * 更新错误码 |
| 31 | * | 31 | * |
| 32 | * @param updateReqVO 更新信息 | 32 | * @param updateReqVO 更新信息 |
| 33 | */ | 33 | */ |
| 34 | - void updateErrorCode(@Valid InfErrorCodeUpdateReqVO updateReqVO); | 34 | + void updateErrorCode(@Valid SysErrorCodeUpdateReqVO updateReqVO); |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * 删除错误码 | 37 | * 删除错误码 |
| @@ -46,7 +46,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | @@ -46,7 +46,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | ||
| 46 | * @param id 编号 | 46 | * @param id 编号 |
| 47 | * @return 错误码 | 47 | * @return 错误码 |
| 48 | */ | 48 | */ |
| 49 | - InfErrorCodeDO getErrorCode(Long id); | 49 | + SysErrorCodeDO getErrorCode(Long id); |
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | * 获得错误码分页 | 52 | * 获得错误码分页 |
| @@ -54,7 +54,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | @@ -54,7 +54,7 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | ||
| 54 | * @param pageReqVO 分页查询 | 54 | * @param pageReqVO 分页查询 |
| 55 | * @return 错误码分页 | 55 | * @return 错误码分页 |
| 56 | */ | 56 | */ |
| 57 | - PageResult<InfErrorCodeDO> getErrorCodePage(InfErrorCodePageReqVO pageReqVO); | 57 | + PageResult<SysErrorCodeDO> getErrorCodePage(SysErrorCodePageReqVO pageReqVO); |
| 58 | 58 | ||
| 59 | /** | 59 | /** |
| 60 | * 获得错误码列表, 用于 Excel 导出 | 60 | * 获得错误码列表, 用于 Excel 导出 |
| @@ -62,6 +62,6 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | @@ -62,6 +62,6 @@ public interface InfErrorCodeService extends ErrorCodeFrameworkService { | ||
| 62 | * @param exportReqVO 查询条件 | 62 | * @param exportReqVO 查询条件 |
| 63 | * @return 错误码列表 | 63 | * @return 错误码列表 |
| 64 | */ | 64 | */ |
| 65 | - List<InfErrorCodeDO> getErrorCodeList(InfErrorCodeExportReqVO exportReqVO); | 65 | + List<SysErrorCodeDO> getErrorCodeList(SysErrorCodeExportReqVO exportReqVO); |
| 66 | 66 | ||
| 67 | } | 67 | } |
src/main/java/cn/iocoder/dashboard/modules/infra/service/errorcode/impl/InfErrorCodeServiceImpl.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/service/errorcode/impl/SysErrorCodeServiceImpl.java
| 1 | -package cn.iocoder.dashboard.modules.infra.service.errorcode.impl; | 1 | +package cn.iocoder.dashboard.modules.system.service.errorcode.impl; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.iocoder.dashboard.common.pojo.PageResult; | 4 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 5 | import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; | 5 | import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeAutoGenerateReqDTO; |
| 6 | import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO; | 6 | import cn.iocoder.dashboard.framework.errorcode.core.dto.ErrorCodeRespDTO; |
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO; | ||
| 9 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO; | ||
| 10 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO; | ||
| 11 | -import cn.iocoder.dashboard.modules.infra.convert.errorcode.InfErrorCodeConvert; | ||
| 12 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | ||
| 13 | -import cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode.InfErrorCodeMapper; | ||
| 14 | -import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum; | ||
| 15 | -import cn.iocoder.dashboard.modules.infra.service.errorcode.InfErrorCodeService; | 7 | +import cn.iocoder.dashboard.modules.system.convert.errorcode.SysErrorCodeConvert; |
| 8 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO; | ||
| 11 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO; | ||
| 12 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 13 | +import cn.iocoder.dashboard.modules.system.dal.mysql.errorcode.SysErrorCodeMapper; | ||
| 14 | +import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum; | ||
| 15 | +import cn.iocoder.dashboard.modules.system.service.errorcode.SysErrorCodeService; | ||
| 16 | import com.google.common.annotations.VisibleForTesting; | 16 | import com.google.common.annotations.VisibleForTesting; |
| 17 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 18 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| @@ -25,45 +25,46 @@ import java.util.List; | @@ -25,45 +25,46 @@ import java.util.List; | ||
| 25 | import java.util.Map; | 25 | import java.util.Map; |
| 26 | 26 | ||
| 27 | import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception; | 27 | import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception; |
| 28 | -import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_DUPLICATE; | ||
| 29 | -import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_NOT_EXISTS; | 28 | +import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*; |
| 30 | import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertMap; | 29 | import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertMap; |
| 31 | import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet; | 30 | import static cn.iocoder.dashboard.util.collection.CollectionUtils.convertSet; |
| 32 | 31 | ||
| 33 | /** | 32 | /** |
| 34 | * 错误码 Service 实现类 | 33 | * 错误码 Service 实现类 |
| 34 | + * | ||
| 35 | + * @author dlyan | ||
| 35 | */ | 36 | */ |
| 36 | @Service | 37 | @Service |
| 37 | @Validated | 38 | @Validated |
| 38 | @Slf4j | 39 | @Slf4j |
| 39 | -public class InfErrorCodeServiceImpl implements InfErrorCodeService { | 40 | +public class SysErrorCodeServiceImpl implements SysErrorCodeService { |
| 40 | 41 | ||
| 41 | @Resource | 42 | @Resource |
| 42 | - private InfErrorCodeMapper errorCodeMapper; | 43 | + private SysErrorCodeMapper errorCodeMapper; |
| 43 | 44 | ||
| 44 | @Override | 45 | @Override |
| 45 | - public Long createErrorCode(InfErrorCodeCreateReqVO createReqVO) { | 46 | + public Long createErrorCode(SysErrorCodeCreateReqVO createReqVO) { |
| 46 | // 校验 code 重复 | 47 | // 校验 code 重复 |
| 47 | validateCodeDuplicate(createReqVO.getCode(), null); | 48 | validateCodeDuplicate(createReqVO.getCode(), null); |
| 48 | 49 | ||
| 49 | // 插入 | 50 | // 插入 |
| 50 | - InfErrorCodeDO errorCode = InfErrorCodeConvert.INSTANCE.convert(createReqVO) | ||
| 51 | - .setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType()); | 51 | + SysErrorCodeDO errorCode = SysErrorCodeConvert.INSTANCE.convert(createReqVO) |
| 52 | + .setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType()); | ||
| 52 | errorCodeMapper.insert(errorCode); | 53 | errorCodeMapper.insert(errorCode); |
| 53 | // 返回 | 54 | // 返回 |
| 54 | return errorCode.getId(); | 55 | return errorCode.getId(); |
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | @Override | 58 | @Override |
| 58 | - public void updateErrorCode(InfErrorCodeUpdateReqVO updateReqVO) { | 59 | + public void updateErrorCode(SysErrorCodeUpdateReqVO updateReqVO) { |
| 59 | // 校验存在 | 60 | // 校验存在 |
| 60 | this.validateErrorCodeExists(updateReqVO.getId()); | 61 | this.validateErrorCodeExists(updateReqVO.getId()); |
| 61 | // 校验 code 重复 | 62 | // 校验 code 重复 |
| 62 | validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId()); | 63 | validateCodeDuplicate(updateReqVO.getCode(), updateReqVO.getId()); |
| 63 | 64 | ||
| 64 | // 更新 | 65 | // 更新 |
| 65 | - InfErrorCodeDO updateObj = InfErrorCodeConvert.INSTANCE.convert(updateReqVO) | ||
| 66 | - .setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType()); | 66 | + SysErrorCodeDO updateObj = SysErrorCodeConvert.INSTANCE.convert(updateReqVO) |
| 67 | + .setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType()); | ||
| 67 | errorCodeMapper.updateById(updateObj); | 68 | errorCodeMapper.updateById(updateObj); |
| 68 | } | 69 | } |
| 69 | 70 | ||
| @@ -85,7 +86,7 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | @@ -85,7 +86,7 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | ||
| 85 | */ | 86 | */ |
| 86 | @VisibleForTesting | 87 | @VisibleForTesting |
| 87 | public void validateCodeDuplicate(Integer code, Long id) { | 88 | public void validateCodeDuplicate(Integer code, Long id) { |
| 88 | - InfErrorCodeDO errorCodeDO = errorCodeMapper.selectByCode(code); | 89 | + SysErrorCodeDO errorCodeDO = errorCodeMapper.selectByCode(code); |
| 89 | if (errorCodeDO == null) { | 90 | if (errorCodeDO == null) { |
| 90 | return; | 91 | return; |
| 91 | } | 92 | } |
| @@ -106,17 +107,17 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | @@ -106,17 +107,17 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | ||
| 106 | } | 107 | } |
| 107 | 108 | ||
| 108 | @Override | 109 | @Override |
| 109 | - public InfErrorCodeDO getErrorCode(Long id) { | 110 | + public SysErrorCodeDO getErrorCode(Long id) { |
| 110 | return errorCodeMapper.selectById(id); | 111 | return errorCodeMapper.selectById(id); |
| 111 | } | 112 | } |
| 112 | 113 | ||
| 113 | @Override | 114 | @Override |
| 114 | - public PageResult<InfErrorCodeDO> getErrorCodePage(InfErrorCodePageReqVO pageReqVO) { | 115 | + public PageResult<SysErrorCodeDO> getErrorCodePage(SysErrorCodePageReqVO pageReqVO) { |
| 115 | return errorCodeMapper.selectPage(pageReqVO); | 116 | return errorCodeMapper.selectPage(pageReqVO); |
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | @Override | 119 | @Override |
| 119 | - public List<InfErrorCodeDO> getErrorCodeList(InfErrorCodeExportReqVO exportReqVO) { | 120 | + public List<SysErrorCodeDO> getErrorCodeList(SysErrorCodeExportReqVO exportReqVO) { |
| 120 | return errorCodeMapper.selectList(exportReqVO); | 121 | return errorCodeMapper.selectList(exportReqVO); |
| 121 | } | 122 | } |
| 122 | 123 | ||
| @@ -127,23 +128,23 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | @@ -127,23 +128,23 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | ||
| 127 | return; | 128 | return; |
| 128 | } | 129 | } |
| 129 | // 获得错误码 | 130 | // 获得错误码 |
| 130 | - List<InfErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByCodes( | 131 | + List<SysErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByCodes( |
| 131 | convertSet(autoGenerateDTOs, ErrorCodeAutoGenerateReqDTO::getCode)); | 132 | convertSet(autoGenerateDTOs, ErrorCodeAutoGenerateReqDTO::getCode)); |
| 132 | - Map<Integer, InfErrorCodeDO> errorCodeDOMap = convertMap(errorCodeDOs, InfErrorCodeDO::getCode); | 133 | + Map<Integer, SysErrorCodeDO> errorCodeDOMap = convertMap(errorCodeDOs, SysErrorCodeDO::getCode); |
| 133 | 134 | ||
| 134 | // 遍历 autoGenerateBOs 数组,逐个插入或更新。考虑到每次量级不大,就不走批量了 | 135 | // 遍历 autoGenerateBOs 数组,逐个插入或更新。考虑到每次量级不大,就不走批量了 |
| 135 | autoGenerateDTOs.forEach(autoGenerateDTO -> { | 136 | autoGenerateDTOs.forEach(autoGenerateDTO -> { |
| 136 | - InfErrorCodeDO errorCodeDO = errorCodeDOMap.get(autoGenerateDTO.getCode()); | 137 | + SysErrorCodeDO errorCodeDO = errorCodeDOMap.get(autoGenerateDTO.getCode()); |
| 137 | // 不存在,则进行新增 | 138 | // 不存在,则进行新增 |
| 138 | if (errorCodeDO == null) { | 139 | if (errorCodeDO == null) { |
| 139 | - errorCodeDO = InfErrorCodeConvert.INSTANCE.convert(autoGenerateDTO) | ||
| 140 | - .setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType()); | 140 | + errorCodeDO = SysErrorCodeConvert.INSTANCE.convert(autoGenerateDTO) |
| 141 | + .setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType()); | ||
| 141 | errorCodeMapper.insert(errorCodeDO); | 142 | errorCodeMapper.insert(errorCodeDO); |
| 142 | return; | 143 | return; |
| 143 | } | 144 | } |
| 144 | // 存在,则进行更新。更新有三个前置条件: | 145 | // 存在,则进行更新。更新有三个前置条件: |
| 145 | // 条件 1. 只更新自动生成的错误码,即 Type 为 ErrorCodeTypeEnum.AUTO_GENERATION | 146 | // 条件 1. 只更新自动生成的错误码,即 Type 为 ErrorCodeTypeEnum.AUTO_GENERATION |
| 146 | - if (!InfErrorCodeTypeEnum.AUTO_GENERATION.getType().equals(errorCodeDO.getType())) { | 147 | + if (!SysErrorCodeTypeEnum.AUTO_GENERATION.getType().equals(errorCodeDO.getType())) { |
| 147 | return; | 148 | return; |
| 148 | } | 149 | } |
| 149 | // 条件 2. 分组 group 必须匹配,避免存在错误码冲突的情况 | 150 | // 条件 2. 分组 group 必须匹配,避免存在错误码冲突的情况 |
| @@ -158,15 +159,15 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | @@ -158,15 +159,15 @@ public class InfErrorCodeServiceImpl implements InfErrorCodeService { | ||
| 158 | return; | 159 | return; |
| 159 | } | 160 | } |
| 160 | // 最终匹配,进行更新 | 161 | // 最终匹配,进行更新 |
| 161 | - errorCodeMapper.updateById(new InfErrorCodeDO().setId(errorCodeDO.getId()).setMessage(autoGenerateDTO.getMessage())); | 162 | + errorCodeMapper.updateById(new SysErrorCodeDO().setId(errorCodeDO.getId()).setMessage(autoGenerateDTO.getMessage())); |
| 162 | }); | 163 | }); |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | @Override | 166 | @Override |
| 166 | public List<ErrorCodeRespDTO> getErrorCodeList(String applicationName, Date minUpdateTime) { | 167 | public List<ErrorCodeRespDTO> getErrorCodeList(String applicationName, Date minUpdateTime) { |
| 167 | - List<InfErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByApplicationNameAndUpdateTimeGt( | 168 | + List<SysErrorCodeDO> errorCodeDOs = errorCodeMapper.selectListByApplicationNameAndUpdateTimeGt( |
| 168 | applicationName, minUpdateTime); | 169 | applicationName, minUpdateTime); |
| 169 | - return InfErrorCodeConvert.INSTANCE.convertList03(errorCodeDOs); | 170 | + return SysErrorCodeConvert.INSTANCE.convertList03(errorCodeDOs); |
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | } | 173 | } |
src/test/java/cn/iocoder/dashboard/modules/infra/service/errorcode/InfErrorCodeServiceTest.java renamed to src/test/java/cn/iocoder/dashboard/modules/system/service/errorcode/SysErrorCodeServiceTest.java
| 1 | -package cn.iocoder.dashboard.modules.infra.service.errorcode; | 1 | +package cn.iocoder.dashboard.modules.system.service.errorcode; |
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.BaseDbUnitTest; | 3 | import cn.iocoder.dashboard.BaseDbUnitTest; |
| 4 | import cn.iocoder.dashboard.common.pojo.PageResult; | 4 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 5 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeCreateReqVO; | ||
| 6 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeExportReqVO; | ||
| 7 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodePageReqVO; | ||
| 8 | -import cn.iocoder.dashboard.modules.infra.controller.errorcode.vo.InfErrorCodeUpdateReqVO; | ||
| 9 | -import cn.iocoder.dashboard.modules.infra.dal.dataobject.errorcode.InfErrorCodeDO; | ||
| 10 | -import cn.iocoder.dashboard.modules.infra.dal.mysql.errorcode.InfErrorCodeMapper; | 5 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeCreateReqVO; |
| 6 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeExportReqVO; | ||
| 7 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodePageReqVO; | ||
| 8 | +import cn.iocoder.dashboard.modules.system.controller.errorcode.vo.SysErrorCodeUpdateReqVO; | ||
| 9 | +import cn.iocoder.dashboard.modules.system.dal.dataobject.errorcode.SysErrorCodeDO; | ||
| 10 | +import cn.iocoder.dashboard.modules.system.dal.mysql.errorcode.SysErrorCodeMapper; | ||
| 11 | import cn.iocoder.dashboard.modules.infra.enums.config.InfConfigTypeEnum; | 11 | import cn.iocoder.dashboard.modules.infra.enums.config.InfConfigTypeEnum; |
| 12 | -import cn.iocoder.dashboard.modules.infra.enums.errorcode.InfErrorCodeTypeEnum; | ||
| 13 | -import cn.iocoder.dashboard.modules.infra.service.errorcode.impl.InfErrorCodeServiceImpl; | 12 | +import cn.iocoder.dashboard.modules.system.enums.errorcode.SysErrorCodeTypeEnum; |
| 13 | +import cn.iocoder.dashboard.modules.system.service.errorcode.impl.SysErrorCodeServiceImpl; | ||
| 14 | import cn.iocoder.dashboard.util.collection.ArrayUtils; | 14 | import cn.iocoder.dashboard.util.collection.ArrayUtils; |
| 15 | import cn.iocoder.dashboard.util.object.ObjectUtils; | 15 | import cn.iocoder.dashboard.util.object.ObjectUtils; |
| 16 | import org.junit.jupiter.api.Test; | 16 | import org.junit.jupiter.api.Test; |
| @@ -21,8 +21,7 @@ import java.util.List; | @@ -21,8 +21,7 @@ import java.util.List; | ||
| 21 | import java.util.function.Consumer; | 21 | import java.util.function.Consumer; |
| 22 | 22 | ||
| 23 | import static cn.hutool.core.util.RandomUtil.randomEle; | 23 | import static cn.hutool.core.util.RandomUtil.randomEle; |
| 24 | -import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_DUPLICATE; | ||
| 25 | -import static cn.iocoder.dashboard.modules.infra.enums.InfErrorCodeConstants.ERROR_CODE_NOT_EXISTS; | 24 | +import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*; |
| 26 | import static cn.iocoder.dashboard.util.AssertUtils.assertPojoEquals; | 25 | import static cn.iocoder.dashboard.util.AssertUtils.assertPojoEquals; |
| 27 | import static cn.iocoder.dashboard.util.AssertUtils.assertServiceException; | 26 | import static cn.iocoder.dashboard.util.AssertUtils.assertServiceException; |
| 28 | import static cn.iocoder.dashboard.util.RandomUtils.*; | 27 | import static cn.iocoder.dashboard.util.RandomUtils.*; |
| @@ -30,56 +29,56 @@ import static cn.iocoder.dashboard.util.date.DateUtils.buildTime; | @@ -30,56 +29,56 @@ import static cn.iocoder.dashboard.util.date.DateUtils.buildTime; | ||
| 30 | import static org.junit.jupiter.api.Assertions.*; | 29 | import static org.junit.jupiter.api.Assertions.*; |
| 31 | 30 | ||
| 32 | /** | 31 | /** |
| 33 | -* {@link InfErrorCodeServiceImpl} 的单元测试类 | 32 | +* {@link SysErrorCodeServiceImpl} 的单元测试类 |
| 34 | * | 33 | * |
| 35 | * @author 芋道源码 | 34 | * @author 芋道源码 |
| 36 | */ | 35 | */ |
| 37 | -@Import(InfErrorCodeServiceImpl.class) | ||
| 38 | -public class InfErrorCodeServiceTest extends BaseDbUnitTest { | 36 | +@Import(SysErrorCodeServiceImpl.class) |
| 37 | +public class SysErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 39 | 38 | ||
| 40 | @Resource | 39 | @Resource |
| 41 | - private InfErrorCodeServiceImpl errorCodeService; | 40 | + private SysErrorCodeServiceImpl errorCodeService; |
| 42 | 41 | ||
| 43 | @Resource | 42 | @Resource |
| 44 | - private InfErrorCodeMapper errorCodeMapper; | 43 | + private SysErrorCodeMapper errorCodeMapper; |
| 45 | 44 | ||
| 46 | @Test | 45 | @Test |
| 47 | public void testCreateErrorCode_success() { | 46 | public void testCreateErrorCode_success() { |
| 48 | // 准备参数 | 47 | // 准备参数 |
| 49 | - InfErrorCodeCreateReqVO reqVO = randomPojo(InfErrorCodeCreateReqVO.class); | 48 | + SysErrorCodeCreateReqVO reqVO = randomPojo(SysErrorCodeCreateReqVO.class); |
| 50 | 49 | ||
| 51 | // 调用 | 50 | // 调用 |
| 52 | Long errorCodeId = errorCodeService.createErrorCode(reqVO); | 51 | Long errorCodeId = errorCodeService.createErrorCode(reqVO); |
| 53 | // 断言 | 52 | // 断言 |
| 54 | assertNotNull(errorCodeId); | 53 | assertNotNull(errorCodeId); |
| 55 | // 校验记录的属性是否正确 | 54 | // 校验记录的属性是否正确 |
| 56 | - InfErrorCodeDO errorCode = errorCodeMapper.selectById(errorCodeId); | 55 | + SysErrorCodeDO errorCode = errorCodeMapper.selectById(errorCodeId); |
| 57 | assertPojoEquals(reqVO, errorCode); | 56 | assertPojoEquals(reqVO, errorCode); |
| 58 | - assertEquals(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType()); | 57 | + assertEquals(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType()); |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | @Test | 60 | @Test |
| 62 | public void testUpdateErrorCode_success() { | 61 | public void testUpdateErrorCode_success() { |
| 63 | // mock 数据 | 62 | // mock 数据 |
| 64 | - InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO(); | 63 | + SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO(); |
| 65 | errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据 | 64 | errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据 |
| 66 | // 准备参数 | 65 | // 准备参数 |
| 67 | - InfErrorCodeUpdateReqVO reqVO = randomPojo(InfErrorCodeUpdateReqVO.class, o -> { | 66 | + SysErrorCodeUpdateReqVO reqVO = randomPojo(SysErrorCodeUpdateReqVO.class, o -> { |
| 68 | o.setId(dbErrorCode.getId()); // 设置更新的 ID | 67 | o.setId(dbErrorCode.getId()); // 设置更新的 ID |
| 69 | }); | 68 | }); |
| 70 | 69 | ||
| 71 | // 调用 | 70 | // 调用 |
| 72 | errorCodeService.updateErrorCode(reqVO); | 71 | errorCodeService.updateErrorCode(reqVO); |
| 73 | // 校验是否更新正确 | 72 | // 校验是否更新正确 |
| 74 | - InfErrorCodeDO errorCode = errorCodeMapper.selectById(reqVO.getId()); // 获取最新的 | 73 | + SysErrorCodeDO errorCode = errorCodeMapper.selectById(reqVO.getId()); // 获取最新的 |
| 75 | assertPojoEquals(reqVO, errorCode); | 74 | assertPojoEquals(reqVO, errorCode); |
| 76 | - assertEquals(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType()); | 75 | + assertEquals(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType(), errorCode.getType()); |
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | @Test | 78 | @Test |
| 80 | public void testDeleteErrorCode_success() { | 79 | public void testDeleteErrorCode_success() { |
| 81 | // mock 数据 | 80 | // mock 数据 |
| 82 | - InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO(); | 81 | + SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO(); |
| 83 | errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据 | 82 | errorCodeMapper.insert(dbErrorCode);// @Sql: 先插入出一条存在的数据 |
| 84 | // 准备参数 | 83 | // 准备参数 |
| 85 | Long id = dbErrorCode.getId(); | 84 | Long id = dbErrorCode.getId(); |
| @@ -93,10 +92,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -93,10 +92,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 93 | @Test | 92 | @Test |
| 94 | public void testGetErrorCodePage() { | 93 | public void testGetErrorCodePage() { |
| 95 | // mock 数据 | 94 | // mock 数据 |
| 96 | - InfErrorCodeDO dbErrorCode = initGetErrorCodePage(); | 95 | + SysErrorCodeDO dbErrorCode = initGetErrorCodePage(); |
| 97 | // 准备参数 | 96 | // 准备参数 |
| 98 | - InfErrorCodePageReqVO reqVO = new InfErrorCodePageReqVO(); | ||
| 99 | - reqVO.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType()); | 97 | + SysErrorCodePageReqVO reqVO = new SysErrorCodePageReqVO(); |
| 98 | + reqVO.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType()); | ||
| 100 | reqVO.setApplicationName("yudao"); | 99 | reqVO.setApplicationName("yudao"); |
| 101 | reqVO.setCode(1); | 100 | reqVO.setCode(1); |
| 102 | reqVO.setMessage("yu"); | 101 | reqVO.setMessage("yu"); |
| @@ -104,7 +103,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -104,7 +103,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 104 | reqVO.setEndCreateTime(buildTime(2020, 11, 30)); | 103 | reqVO.setEndCreateTime(buildTime(2020, 11, 30)); |
| 105 | 104 | ||
| 106 | // 调用 | 105 | // 调用 |
| 107 | - PageResult<InfErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO); | 106 | + PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO); |
| 108 | // 断言 | 107 | // 断言 |
| 109 | assertEquals(1, pageResult.getTotal()); | 108 | assertEquals(1, pageResult.getTotal()); |
| 110 | assertEquals(1, pageResult.getList().size()); | 109 | assertEquals(1, pageResult.getList().size()); |
| @@ -114,9 +113,9 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -114,9 +113,9 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 114 | /** | 113 | /** |
| 115 | * 初始化 getErrorCodePage 方法的测试数据 | 114 | * 初始化 getErrorCodePage 方法的测试数据 |
| 116 | */ | 115 | */ |
| 117 | - private InfErrorCodeDO initGetErrorCodePage() { | ||
| 118 | - InfErrorCodeDO dbErrorCode = randomInfErrorCodeDO(o -> { // 等会查询到 | ||
| 119 | - o.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType()); | 116 | + private SysErrorCodeDO initGetErrorCodePage() { |
| 117 | + SysErrorCodeDO dbErrorCode = randomInfErrorCodeDO(o -> { // 等会查询到 | ||
| 118 | + o.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType()); | ||
| 120 | o.setApplicationName("yudaoyuanma"); | 119 | o.setApplicationName("yudaoyuanma"); |
| 121 | o.setCode(1); | 120 | o.setCode(1); |
| 122 | o.setMessage("yudao"); | 121 | o.setMessage("yudao"); |
| @@ -124,7 +123,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -124,7 +123,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 124 | }); | 123 | }); |
| 125 | errorCodeMapper.insert(dbErrorCode); | 124 | errorCodeMapper.insert(dbErrorCode); |
| 126 | // 测试 type 不匹配 | 125 | // 测试 type 不匹配 |
| 127 | - errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setType(InfErrorCodeTypeEnum.MANUAL_OPERATION.getType()))); | 126 | + errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setType(SysErrorCodeTypeEnum.MANUAL_OPERATION.getType()))); |
| 128 | // 测试 applicationName 不匹配 | 127 | // 测试 applicationName 不匹配 |
| 129 | errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setApplicationName("yunai"))); | 128 | errorCodeMapper.insert(ObjectUtils.clone(dbErrorCode, o -> o.setApplicationName("yunai"))); |
| 130 | // 测试 code 不匹配 | 129 | // 测试 code 不匹配 |
| @@ -139,10 +138,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -139,10 +138,10 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 139 | @Test | 138 | @Test |
| 140 | public void testGetErrorCodeList() { | 139 | public void testGetErrorCodeList() { |
| 141 | // mock 数据 | 140 | // mock 数据 |
| 142 | - InfErrorCodeDO dbErrorCode = initGetErrorCodePage(); | 141 | + SysErrorCodeDO dbErrorCode = initGetErrorCodePage(); |
| 143 | // 准备参数 | 142 | // 准备参数 |
| 144 | - InfErrorCodeExportReqVO reqVO = new InfErrorCodeExportReqVO(); | ||
| 145 | - reqVO.setType(InfErrorCodeTypeEnum.AUTO_GENERATION.getType()); | 143 | + SysErrorCodeExportReqVO reqVO = new SysErrorCodeExportReqVO(); |
| 144 | + reqVO.setType(SysErrorCodeTypeEnum.AUTO_GENERATION.getType()); | ||
| 146 | reqVO.setApplicationName("yudao"); | 145 | reqVO.setApplicationName("yudao"); |
| 147 | reqVO.setCode(1); | 146 | reqVO.setCode(1); |
| 148 | reqVO.setMessage("yu"); | 147 | reqVO.setMessage("yu"); |
| @@ -150,7 +149,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -150,7 +149,7 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 150 | reqVO.setEndCreateTime(buildTime(2020, 11, 30)); | 149 | reqVO.setEndCreateTime(buildTime(2020, 11, 30)); |
| 151 | 150 | ||
| 152 | // 调用 | 151 | // 调用 |
| 153 | - List<InfErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO); | 152 | + List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(reqVO); |
| 154 | // 断言 | 153 | // 断言 |
| 155 | assertEquals(1, list.size()); | 154 | assertEquals(1, list.size()); |
| 156 | assertPojoEquals(dbErrorCode, list.get(0)); | 155 | assertPojoEquals(dbErrorCode, list.get(0)); |
| @@ -190,11 +189,11 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | @@ -190,11 +189,11 @@ public class InfErrorCodeServiceTest extends BaseDbUnitTest { | ||
| 190 | // ========== 随机对象 ========== | 189 | // ========== 随机对象 ========== |
| 191 | 190 | ||
| 192 | @SafeVarargs | 191 | @SafeVarargs |
| 193 | - private static InfErrorCodeDO randomInfErrorCodeDO(Consumer<InfErrorCodeDO>... consumers) { | ||
| 194 | - Consumer<InfErrorCodeDO> consumer = (o) -> { | 192 | + private static SysErrorCodeDO randomInfErrorCodeDO(Consumer<SysErrorCodeDO>... consumers) { |
| 193 | + Consumer<SysErrorCodeDO> consumer = (o) -> { | ||
| 195 | o.setType(randomEle(InfConfigTypeEnum.values()).getType()); // 保证 key 的范围 | 194 | o.setType(randomEle(InfConfigTypeEnum.values()).getType()); // 保证 key 的范围 |
| 196 | }; | 195 | }; |
| 197 | - return randomPojo(InfErrorCodeDO.class, ArrayUtils.append(consumer, consumers)); | 196 | + return randomPojo(SysErrorCodeDO.class, ArrayUtils.append(consumer, consumers)); |
| 198 | } | 197 | } |
| 199 | 198 | ||
| 200 | } | 199 | } |
src/test/resources/sql/clean.sql
| @@ -5,7 +5,6 @@ DELETE FROM "inf_job"; | @@ -5,7 +5,6 @@ DELETE FROM "inf_job"; | ||
| 5 | DELETE FROM "inf_job_log"; | 5 | DELETE FROM "inf_job_log"; |
| 6 | DELETE FROM "inf_api_access_log"; | 6 | DELETE FROM "inf_api_access_log"; |
| 7 | DELETE FROM "inf_api_error_log"; | 7 | DELETE FROM "inf_api_error_log"; |
| 8 | -DELETE FROM "inf_error_code"; | ||
| 9 | 8 | ||
| 10 | -- sys 开头的 DB | 9 | -- sys 开头的 DB |
| 11 | DELETE FROM "sys_dept"; | 10 | DELETE FROM "sys_dept"; |
| @@ -23,3 +22,4 @@ DELETE FROM "sys_user"; | @@ -23,3 +22,4 @@ DELETE FROM "sys_user"; | ||
| 23 | DELETE FROM "sys_sms_channel"; | 22 | DELETE FROM "sys_sms_channel"; |
| 24 | DELETE FROM "sys_sms_template"; | 23 | DELETE FROM "sys_sms_template"; |
| 25 | DELETE FROM "sys_sms_log"; | 24 | DELETE FROM "sys_sms_log"; |
| 25 | +DELETE FROM "sys_error_code"; |
src/test/resources/sql/create_tables.sql
| @@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS "sys_sms_log" ( | @@ -412,7 +412,7 @@ CREATE TABLE IF NOT EXISTS "sys_sms_log" ( | ||
| 412 | PRIMARY KEY ("id") | 412 | PRIMARY KEY ("id") |
| 413 | ) COMMENT '短信日志'; | 413 | ) COMMENT '短信日志'; |
| 414 | 414 | ||
| 415 | -CREATE TABLE IF NOT EXISTS "inf_error_code" ( | 415 | +CREATE TABLE IF NOT EXISTS "sys_error_code" ( |
| 416 | "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, | 416 | "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, |
| 417 | "type" tinyint NOT NULL DEFAULT '0', | 417 | "type" tinyint NOT NULL DEFAULT '0', |
| 418 | "application_name" varchar(50) NOT NULL, | 418 | "application_name" varchar(50) NOT NULL, |