Commit ec00936532de83ac10166fca760022744eff10de
1 parent
f6bb3386
1. 完成字典数据的迁移
Showing
10 changed files
with
110 additions
and
115 deletions
ruoyi-ui/src/api/system/dict/data.js
| ... | ... | @@ -3,7 +3,7 @@ import request from '@/utils/request' |
| 3 | 3 | // 查询字典数据列表 |
| 4 | 4 | export function listData(query) { |
| 5 | 5 | return request({ |
| 6 | - url: '/system/dict/data/list', | |
| 6 | + url: '/system/dict-data/page', | |
| 7 | 7 | method: 'get', |
| 8 | 8 | params: query |
| 9 | 9 | }) |
| ... | ... | @@ -12,7 +12,7 @@ export function listData(query) { |
| 12 | 12 | // 查询字典数据详细 |
| 13 | 13 | export function getData(dictCode) { |
| 14 | 14 | return request({ |
| 15 | - url: '/system/dict/data/' + dictCode, | |
| 15 | + url: '/system/dict-data/get?id=' + dictCode, | |
| 16 | 16 | method: 'get' |
| 17 | 17 | }) |
| 18 | 18 | } |
| ... | ... | @@ -20,7 +20,7 @@ export function getData(dictCode) { |
| 20 | 20 | // 根据字典类型查询字典数据信息 |
| 21 | 21 | export function getDicts(dictType) { |
| 22 | 22 | return request({ |
| 23 | - url: '/system/dict/data/type/' + dictType, | |
| 23 | + url: '/system/dict-data/type/' + dictType, | |
| 24 | 24 | method: 'get' |
| 25 | 25 | }) |
| 26 | 26 | } |
| ... | ... | @@ -28,7 +28,7 @@ export function getDicts(dictType) { |
| 28 | 28 | // 新增字典数据 |
| 29 | 29 | export function addData(data) { |
| 30 | 30 | return request({ |
| 31 | - url: '/system/dict/data', | |
| 31 | + url: '/system/dict-data/create', | |
| 32 | 32 | method: 'post', |
| 33 | 33 | data: data |
| 34 | 34 | }) |
| ... | ... | @@ -37,8 +37,8 @@ export function addData(data) { |
| 37 | 37 | // 修改字典数据 |
| 38 | 38 | export function updateData(data) { |
| 39 | 39 | return request({ |
| 40 | - url: '/system/dict/data', | |
| 41 | - method: 'put', | |
| 40 | + url: '/system/dict-data/update', | |
| 41 | + method: 'post', | |
| 42 | 42 | data: data |
| 43 | 43 | }) |
| 44 | 44 | } |
| ... | ... | @@ -46,8 +46,8 @@ export function updateData(data) { |
| 46 | 46 | // 删除字典数据 |
| 47 | 47 | export function delData(dictCode) { |
| 48 | 48 | return request({ |
| 49 | - url: '/system/dict/data/' + dictCode, | |
| 50 | - method: 'delete' | |
| 49 | + url: '/system/dict-data/delete?id=' + dictCode, | |
| 50 | + method: 'post' | |
| 51 | 51 | }) |
| 52 | 52 | } |
| 53 | 53 | ... | ... |
ruoyi-ui/src/api/system/dict/type.js
| ... | ... | @@ -53,9 +53,9 @@ export function exportType(query) { |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // 获取字典选择框列表 |
| 56 | -export function optionselect() { | |
| 56 | +export function listAllSimple() { | |
| 57 | 57 | return request({ |
| 58 | - url: '/system/dict-type/optionselect', | |
| 58 | + url: '/system/dict-type/list-all-simple', | |
| 59 | 59 | method: 'get' |
| 60 | 60 | }) |
| 61 | 61 | } | ... | ... |
ruoyi-ui/src/views/system/dict/data.vue
| ... | ... | @@ -5,15 +5,15 @@ |
| 5 | 5 | <el-select v-model="queryParams.dictType" size="small"> |
| 6 | 6 | <el-option |
| 7 | 7 | v-for="item in typeOptions" |
| 8 | - :key="item.dictId" | |
| 9 | - :label="item.dictName" | |
| 10 | - :value="item.dictType" | |
| 8 | + :key="item.id" | |
| 9 | + :label="item.name" | |
| 10 | + :value="item.type" | |
| 11 | 11 | /> |
| 12 | 12 | </el-select> |
| 13 | 13 | </el-form-item> |
| 14 | - <el-form-item label="字典标签" prop="dictLabel"> | |
| 14 | + <el-form-item label="字典标签" prop="label"> | |
| 15 | 15 | <el-input |
| 16 | - v-model="queryParams.dictLabel" | |
| 16 | + v-model="queryParams.label" | |
| 17 | 17 | placeholder="请输入字典标签" |
| 18 | 18 | clearable |
| 19 | 19 | size="small" |
| ... | ... | @@ -24,9 +24,9 @@ |
| 24 | 24 | <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small"> |
| 25 | 25 | <el-option |
| 26 | 26 | v-for="dict in statusOptions" |
| 27 | - :key="dict.dictValue" | |
| 28 | - :label="dict.dictLabel" | |
| 29 | - :value="dict.dictValue" | |
| 27 | + :key="dict.value" | |
| 28 | + :label="dict.label" | |
| 29 | + :value="dict.value" | |
| 30 | 30 | /> |
| 31 | 31 | </el-select> |
| 32 | 32 | </el-form-item> |
| ... | ... | @@ -48,26 +48,6 @@ |
| 48 | 48 | </el-col> |
| 49 | 49 | <el-col :span="1.5"> |
| 50 | 50 | <el-button |
| 51 | - type="success" | |
| 52 | - icon="el-icon-edit" | |
| 53 | - size="mini" | |
| 54 | - :disabled="single" | |
| 55 | - @click="handleUpdate" | |
| 56 | - v-hasPermi="['system:dict:edit']" | |
| 57 | - >修改</el-button> | |
| 58 | - </el-col> | |
| 59 | - <el-col :span="1.5"> | |
| 60 | - <el-button | |
| 61 | - type="danger" | |
| 62 | - icon="el-icon-delete" | |
| 63 | - size="mini" | |
| 64 | - :disabled="multiple" | |
| 65 | - @click="handleDelete" | |
| 66 | - v-hasPermi="['system:dict:remove']" | |
| 67 | - >删除</el-button> | |
| 68 | - </el-col> | |
| 69 | - <el-col :span="1.5"> | |
| 70 | - <el-button | |
| 71 | 51 | type="warning" |
| 72 | 52 | icon="el-icon-download" |
| 73 | 53 | size="mini" |
| ... | ... | @@ -78,12 +58,11 @@ |
| 78 | 58 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 79 | 59 | </el-row> |
| 80 | 60 | |
| 81 | - <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> | |
| 82 | - <el-table-column type="selection" width="55" align="center" /> | |
| 83 | - <el-table-column label="字典编码" align="center" prop="dictCode" /> | |
| 84 | - <el-table-column label="字典标签" align="center" prop="dictLabel" /> | |
| 85 | - <el-table-column label="字典键值" align="center" prop="dictValue" /> | |
| 86 | - <el-table-column label="字典排序" align="center" prop="dictSort" /> | |
| 61 | + <el-table v-loading="loading" :data="dataList" > | |
| 62 | + <el-table-column label="字典编码" align="center" prop="id" /> | |
| 63 | + <el-table-column label="字典标签" align="center" prop="label" /> | |
| 64 | + <el-table-column label="字典键值" align="center" prop="value" /> | |
| 65 | + <el-table-column label="字典排序" align="center" prop="sort" /> | |
| 87 | 66 | <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" /> |
| 88 | 67 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
| 89 | 68 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| ... | ... | @@ -114,7 +93,7 @@ |
| 114 | 93 | <pagination |
| 115 | 94 | v-show="total>0" |
| 116 | 95 | :total="total" |
| 117 | - :page.sync="queryParams.pageNum" | |
| 96 | + :page.sync="queryParams.pageNo" | |
| 118 | 97 | :limit.sync="queryParams.pageSize" |
| 119 | 98 | @pagination="getList" |
| 120 | 99 | /> |
| ... | ... | @@ -125,22 +104,22 @@ |
| 125 | 104 | <el-form-item label="字典类型"> |
| 126 | 105 | <el-input v-model="form.dictType" :disabled="true" /> |
| 127 | 106 | </el-form-item> |
| 128 | - <el-form-item label="数据标签" prop="dictLabel"> | |
| 129 | - <el-input v-model="form.dictLabel" placeholder="请输入数据标签" /> | |
| 107 | + <el-form-item label="数据标签" prop="label"> | |
| 108 | + <el-input v-model="form.label" placeholder="请输入数据标签" /> | |
| 130 | 109 | </el-form-item> |
| 131 | - <el-form-item label="数据键值" prop="dictValue"> | |
| 132 | - <el-input v-model="form.dictValue" placeholder="请输入数据键值" /> | |
| 110 | + <el-form-item label="数据键值" prop="value"> | |
| 111 | + <el-input v-model="form.value" placeholder="请输入数据键值" /> | |
| 133 | 112 | </el-form-item> |
| 134 | - <el-form-item label="显示排序" prop="dictSort"> | |
| 135 | - <el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> | |
| 113 | + <el-form-item label="显示排序" prop="sort"> | |
| 114 | + <el-input-number v-model="form.sort" controls-position="right" :min="0" /> | |
| 136 | 115 | </el-form-item> |
| 137 | 116 | <el-form-item label="状态" prop="status"> |
| 138 | 117 | <el-radio-group v-model="form.status"> |
| 139 | 118 | <el-radio |
| 140 | - v-for="dict in statusOptions" | |
| 141 | - :key="dict.dictValue" | |
| 142 | - :label="dict.dictValue" | |
| 143 | - >{{dict.dictLabel}}</el-radio> | |
| 119 | + v-for="dict in statusDictDatas" | |
| 120 | + :key="parseInt(dict.value)" | |
| 121 | + :label="parseInt(dict.value)" | |
| 122 | + >{{dict.label}}</el-radio> | |
| 144 | 123 | </el-radio-group> |
| 145 | 124 | </el-form-item> |
| 146 | 125 | <el-form-item label="备注" prop="remark"> |
| ... | ... | @@ -157,7 +136,10 @@ |
| 157 | 136 | |
| 158 | 137 | <script> |
| 159 | 138 | import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data"; |
| 160 | -import { listType, getType } from "@/api/system/dict/type"; | |
| 139 | +import { listAllSimple, getType } from "@/api/system/dict/type"; | |
| 140 | + | |
| 141 | +import { SysCommonStatusEnum } from '@/utils/constants' | |
| 142 | +import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict' | |
| 161 | 143 | |
| 162 | 144 | export default { |
| 163 | 145 | name: "Data", |
| ... | ... | @@ -165,12 +147,6 @@ export default { |
| 165 | 147 | return { |
| 166 | 148 | // 遮罩层 |
| 167 | 149 | loading: true, |
| 168 | - // 选中数组 | |
| 169 | - ids: [], | |
| 170 | - // 非单个禁用 | |
| 171 | - single: true, | |
| 172 | - // 非多个禁用 | |
| 173 | - multiple: true, | |
| 174 | 150 | // 显示搜索条件 |
| 175 | 151 | showSearch: true, |
| 176 | 152 | // 总条数 |
| ... | ... | @@ -189,7 +165,7 @@ export default { |
| 189 | 165 | typeOptions: [], |
| 190 | 166 | // 查询参数 |
| 191 | 167 | queryParams: { |
| 192 | - pageNum: 1, | |
| 168 | + pageNo: 1, | |
| 193 | 169 | pageSize: 10, |
| 194 | 170 | dictName: undefined, |
| 195 | 171 | dictType: undefined, |
| ... | ... | @@ -199,53 +175,55 @@ export default { |
| 199 | 175 | form: {}, |
| 200 | 176 | // 表单校验 |
| 201 | 177 | rules: { |
| 202 | - dictLabel: [ | |
| 178 | + label: [ | |
| 203 | 179 | { required: true, message: "数据标签不能为空", trigger: "blur" } |
| 204 | 180 | ], |
| 205 | - dictValue: [ | |
| 181 | + value: [ | |
| 206 | 182 | { required: true, message: "数据键值不能为空", trigger: "blur" } |
| 207 | 183 | ], |
| 208 | - dictSort: [ | |
| 184 | + sort: [ | |
| 209 | 185 | { required: true, message: "数据顺序不能为空", trigger: "blur" } |
| 210 | 186 | ] |
| 211 | - } | |
| 187 | + }, | |
| 188 | + | |
| 189 | + // 枚举 | |
| 190 | + CommonStatusEnum: SysCommonStatusEnum, | |
| 191 | + // 数据字典 | |
| 192 | + statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS) | |
| 212 | 193 | }; |
| 213 | 194 | }, |
| 214 | 195 | created() { |
| 215 | 196 | const dictId = this.$route.params && this.$route.params.dictId; |
| 216 | 197 | this.getType(dictId); |
| 217 | 198 | this.getTypeList(); |
| 218 | - this.getDicts("sys_normal_disable").then(response => { | |
| 219 | - this.statusOptions = response.data; | |
| 220 | - }); | |
| 221 | 199 | }, |
| 222 | 200 | methods: { |
| 223 | 201 | /** 查询字典类型详细 */ |
| 224 | 202 | getType(dictId) { |
| 225 | 203 | getType(dictId).then(response => { |
| 226 | - this.queryParams.dictType = response.data.dictType; | |
| 227 | - this.defaultDictType = response.data.dictType; | |
| 204 | + this.queryParams.dictType = response.data.type; | |
| 205 | + this.defaultDictType = response.data.type; | |
| 228 | 206 | this.getList(); |
| 229 | 207 | }); |
| 230 | 208 | }, |
| 231 | 209 | /** 查询字典类型列表 */ |
| 232 | 210 | getTypeList() { |
| 233 | - listType().then(response => { | |
| 234 | - this.typeOptions = response.rows; | |
| 211 | + listAllSimple().then(response => { | |
| 212 | + this.typeOptions = response.data; | |
| 235 | 213 | }); |
| 236 | 214 | }, |
| 237 | 215 | /** 查询字典数据列表 */ |
| 238 | 216 | getList() { |
| 239 | 217 | this.loading = true; |
| 240 | 218 | listData(this.queryParams).then(response => { |
| 241 | - this.dataList = response.rows; | |
| 242 | - this.total = response.total; | |
| 219 | + this.dataList = response.data.list; | |
| 220 | + this.total = response.data.total; | |
| 243 | 221 | this.loading = false; |
| 244 | 222 | }); |
| 245 | 223 | }, |
| 246 | 224 | // 数据状态字典翻译 |
| 247 | 225 | statusFormat(row, column) { |
| 248 | - return this.selectDictLabel(this.statusOptions, row.status); | |
| 226 | + return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status) | |
| 249 | 227 | }, |
| 250 | 228 | // 取消按钮 |
| 251 | 229 | cancel() { |
| ... | ... | @@ -255,18 +233,18 @@ export default { |
| 255 | 233 | // 表单重置 |
| 256 | 234 | reset() { |
| 257 | 235 | this.form = { |
| 258 | - dictCode: undefined, | |
| 259 | - dictLabel: undefined, | |
| 260 | - dictValue: undefined, | |
| 261 | - dictSort: 0, | |
| 262 | - status: "0", | |
| 236 | + id: undefined, | |
| 237 | + label: undefined, | |
| 238 | + value: undefined, | |
| 239 | + sort: 0, | |
| 240 | + status: SysCommonStatusEnum.ENABLE, | |
| 263 | 241 | remark: undefined |
| 264 | 242 | }; |
| 265 | 243 | this.resetForm("form"); |
| 266 | 244 | }, |
| 267 | 245 | /** 搜索按钮操作 */ |
| 268 | 246 | handleQuery() { |
| 269 | - this.queryParams.pageNum = 1; | |
| 247 | + this.queryParams.pageNo = 1; | |
| 270 | 248 | this.getList(); |
| 271 | 249 | }, |
| 272 | 250 | /** 重置按钮操作 */ |
| ... | ... | @@ -282,17 +260,11 @@ export default { |
| 282 | 260 | this.title = "添加字典数据"; |
| 283 | 261 | this.form.dictType = this.queryParams.dictType; |
| 284 | 262 | }, |
| 285 | - // 多选框选中数据 | |
| 286 | - handleSelectionChange(selection) { | |
| 287 | - this.ids = selection.map(item => item.dictCode) | |
| 288 | - this.single = selection.length!=1 | |
| 289 | - this.multiple = !selection.length | |
| 290 | - }, | |
| 291 | 263 | /** 修改按钮操作 */ |
| 292 | 264 | handleUpdate(row) { |
| 293 | 265 | this.reset(); |
| 294 | - const dictCode = row.dictCode || this.ids | |
| 295 | - getData(dictCode).then(response => { | |
| 266 | + const id = row.id || this.ids | |
| 267 | + getData(id).then(response => { | |
| 296 | 268 | this.form = response.data; |
| 297 | 269 | this.open = true; |
| 298 | 270 | this.title = "修改字典数据"; |
| ... | ... | @@ -302,7 +274,7 @@ export default { |
| 302 | 274 | submitForm: function() { |
| 303 | 275 | this.$refs["form"].validate(valid => { |
| 304 | 276 | if (valid) { |
| 305 | - if (this.form.dictCode != undefined) { | |
| 277 | + if (this.form.id !== undefined) { | |
| 306 | 278 | updateData(this.form).then(response => { |
| 307 | 279 | this.msgSuccess("修改成功"); |
| 308 | 280 | this.open = false; |
| ... | ... | @@ -320,13 +292,13 @@ export default { |
| 320 | 292 | }, |
| 321 | 293 | /** 删除按钮操作 */ |
| 322 | 294 | handleDelete(row) { |
| 323 | - const dictCodes = row.dictCode || this.ids; | |
| 324 | - this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", { | |
| 295 | + const ids = row.id; | |
| 296 | + this.$confirm('是否确认删除字典编码为"' + ids + '"的数据项?', "警告", { | |
| 325 | 297 | confirmButtonText: "确定", |
| 326 | 298 | cancelButtonText: "取消", |
| 327 | 299 | type: "warning" |
| 328 | 300 | }).then(function() { |
| 329 | - return delData(dictCodes); | |
| 301 | + return delData(ids); | |
| 330 | 302 | }).then(() => { |
| 331 | 303 | this.getList(); |
| 332 | 304 | this.msgSuccess("删除成功"); |
| ... | ... | @@ -347,4 +319,4 @@ export default { |
| 347 | 319 | } |
| 348 | 320 | } |
| 349 | 321 | }; |
| 350 | -</script> | |
| 351 | 322 | \ No newline at end of file |
| 323 | +</script> | ... | ... |
ruoyi-ui/src/views/system/dict/index.vue
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java
| ... | ... | @@ -2,11 +2,9 @@ package cn.iocoder.dashboard.modules.system.controller.dict; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 5 | -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; | |
| 6 | -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; | |
| 7 | -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO; | |
| 8 | -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; | |
| 5 | +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.*; | |
| 9 | 6 | import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert; |
| 7 | +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; | |
| 10 | 8 | import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService; |
| 11 | 9 | import io.swagger.annotations.Api; |
| 12 | 10 | import io.swagger.annotations.ApiImplicitParam; |
| ... | ... | @@ -15,6 +13,7 @@ import org.springframework.validation.annotation.Validated; |
| 15 | 13 | import org.springframework.web.bind.annotation.*; |
| 16 | 14 | |
| 17 | 15 | import javax.annotation.Resource; |
| 16 | +import java.util.List; | |
| 18 | 17 | |
| 19 | 18 | import static cn.iocoder.dashboard.common.pojo.CommonResult.success; |
| 20 | 19 | |
| ... | ... | @@ -69,14 +68,13 @@ public class SysDictTypeController { |
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | |
| 72 | -// /** | |
| 73 | -// * 获取字典选择框列表 | |
| 74 | -// */ | |
| 75 | -// @GetMapping("/optionselect") | |
| 76 | -// public AjaxResult optionselect() { | |
| 77 | -// List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); | |
| 78 | -// return AjaxResult.success(dictTypes); | |
| 79 | -// } | |
| 71 | + @GetMapping("/list-all-simple") | |
| 72 | + @ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") | |
| 73 | + // 无需添加权限认证,因为前端全局都需要 | |
| 74 | + public CommonResult<List<SysDictTypeSimpleRespVO>> listSimpleDictTypes() { | |
| 75 | + List<SysDictTypeDO> list = dictTypeService.listDictTypes(); | |
| 76 | + return success(SysDictTypeConvert.INSTANCE.convertList(list)); | |
| 77 | + } | |
| 80 | 78 | |
| 81 | 79 | // |
| 82 | 80 | // @Log(title = "字典类型", businessType = BusinessType.EXPORT) | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeSimpleRespVO.java
| ... | ... | @@ -13,9 +13,12 @@ import lombok.NoArgsConstructor; |
| 13 | 13 | public class SysDictTypeSimpleRespVO { |
| 14 | 14 | |
| 15 | 15 | @ApiModelProperty(value = "字典类型编号", required = true, example = "1024") |
| 16 | - private Integer id; | |
| 16 | + private Long id; | |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "字典类型名称", required = true, example = "芋道") |
| 19 | 19 | private String name; |
| 20 | 20 | |
| 21 | + @ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex") | |
| 22 | + private String type; | |
| 23 | + | |
| 21 | 24 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictTypeConvert.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.convert.dict; |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; |
| 5 | 5 | import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO; |
| 6 | +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeSimpleRespVO; | |
| 6 | 7 | import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; |
| 7 | 8 | import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; |
| 8 | 9 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| ... | ... | @@ -10,6 +11,8 @@ import org.mapstruct.Mapper; |
| 10 | 11 | import org.mapstruct.Mapping; |
| 11 | 12 | import org.mapstruct.factory.Mappers; |
| 12 | 13 | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 13 | 16 | @Mapper |
| 14 | 17 | public interface SysDictTypeConvert { |
| 15 | 18 | |
| ... | ... | @@ -26,4 +29,6 @@ public interface SysDictTypeConvert { |
| 26 | 29 | |
| 27 | 30 | SysDictTypeDO convert(SysDictTypeUpdateReqVO bean); |
| 28 | 31 | |
| 32 | + List<SysDictTypeSimpleRespVO> convertList(List<SysDictTypeDO> list); | |
| 33 | + | |
| 29 | 34 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictTypeMapper.java
| ... | ... | @@ -4,10 +4,13 @@ import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; |
| 4 | 4 | import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; |
| 5 | 5 | import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; |
| 6 | 6 | import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; |
| 7 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 7 | 8 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 8 | 9 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 9 | 10 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 11 | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 11 | 14 | @Mapper |
| 12 | 15 | public interface SysDictTypeMapper extends BaseMapper<SysDictTypeDO> { |
| 13 | 16 | |
| ... | ... | @@ -27,4 +30,8 @@ public interface SysDictTypeMapper extends BaseMapper<SysDictTypeDO> { |
| 27 | 30 | return selectOne(new QueryWrapperX<SysDictTypeDO>().eq("name", name)); |
| 28 | 31 | } |
| 29 | 32 | |
| 33 | + default List<SysDictTypeDO> selectList() { | |
| 34 | + return selectList(new QueryWrapper<>()); | |
| 35 | + } | |
| 36 | + | |
| 30 | 37 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeService.java
| ... | ... | @@ -6,6 +6,8 @@ import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePa |
| 6 | 6 | import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; |
| 7 | 7 | import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; |
| 8 | 8 | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 9 | 11 | /** |
| 10 | 12 | * 字典类型 Service 接口 |
| 11 | 13 | * |
| ... | ... | @@ -59,4 +61,11 @@ public interface SysDictTypeService { |
| 59 | 61 | */ |
| 60 | 62 | void deleteDictType(Long id); |
| 61 | 63 | |
| 64 | + /** | |
| 65 | + * 获得全部字典类型列表 | |
| 66 | + * | |
| 67 | + * @return 字典类型列表 | |
| 68 | + */ | |
| 69 | + List<SysDictTypeDO> listDictTypes(); | |
| 70 | + | |
| 62 | 71 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictTypeServiceImpl.java
| ... | ... | @@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional; |
| 15 | 15 | |
| 16 | 16 | import javax.annotation.Resource; |
| 17 | 17 | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 18 | 20 | import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*; |
| 19 | 21 | |
| 20 | 22 | /** |
| ... | ... | @@ -74,6 +76,11 @@ public class SysDictTypeServiceImpl implements SysDictTypeService { |
| 74 | 76 | // TODO 发送 MQ 消息 |
| 75 | 77 | } |
| 76 | 78 | |
| 79 | + @Override | |
| 80 | + public List<SysDictTypeDO> listDictTypes() { | |
| 81 | + return dictTypeMapper.selectList(); | |
| 82 | + } | |
| 83 | + | |
| 77 | 84 | @Transactional |
| 78 | 85 | public void deleteDictType0(Long id) { |
| 79 | 86 | // 校验是否存在 | ... | ... |