mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
1. 完成字典数据的迁移
This commit is contained in:
parent
f6bb33863f
commit
ec00936532
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||||||
// 查询字典数据列表
|
// 查询字典数据列表
|
||||||
export function listData(query) {
|
export function listData(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data/list',
|
url: '/system/dict-data/page',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@ -12,7 +12,7 @@ export function listData(query) {
|
|||||||
// 查询字典数据详细
|
// 查询字典数据详细
|
||||||
export function getData(dictCode) {
|
export function getData(dictCode) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data/' + dictCode,
|
url: '/system/dict-data/get?id=' + dictCode,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ export function getData(dictCode) {
|
|||||||
// 根据字典类型查询字典数据信息
|
// 根据字典类型查询字典数据信息
|
||||||
export function getDicts(dictType) {
|
export function getDicts(dictType) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data/type/' + dictType,
|
url: '/system/dict-data/type/' + dictType,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ export function getDicts(dictType) {
|
|||||||
// 新增字典数据
|
// 新增字典数据
|
||||||
export function addData(data) {
|
export function addData(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data',
|
url: '/system/dict-data/create',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
@ -37,8 +37,8 @@ export function addData(data) {
|
|||||||
// 修改字典数据
|
// 修改字典数据
|
||||||
export function updateData(data) {
|
export function updateData(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data',
|
url: '/system/dict-data/update',
|
||||||
method: 'put',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -46,8 +46,8 @@ export function updateData(data) {
|
|||||||
// 删除字典数据
|
// 删除字典数据
|
||||||
export function delData(dictCode) {
|
export function delData(dictCode) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data/' + dictCode,
|
url: '/system/dict-data/delete?id=' + dictCode,
|
||||||
method: 'delete'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ export function exportType(query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取字典选择框列表
|
// 获取字典选择框列表
|
||||||
export function optionselect() {
|
export function listAllSimple() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict-type/optionselect',
|
url: '/system/dict-type/list-all-simple',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,15 @@
|
|||||||
<el-select v-model="queryParams.dictType" size="small">
|
<el-select v-model="queryParams.dictType" size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in typeOptions"
|
v-for="item in typeOptions"
|
||||||
:key="item.dictId"
|
:key="item.id"
|
||||||
:label="item.dictName"
|
:label="item.name"
|
||||||
:value="item.dictType"
|
:value="item.type"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字典标签" prop="dictLabel">
|
<el-form-item label="字典标签" prop="label">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.dictLabel"
|
v-model="queryParams.label"
|
||||||
placeholder="请输入字典标签"
|
placeholder="请输入字典标签"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
@ -24,9 +24,9 @@
|
|||||||
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in statusOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -46,26 +46,6 @@
|
|||||||
v-hasPermi="['system:dict:add']"
|
v-hasPermi="['system:dict:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['system:dict:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['system:dict:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@ -78,12 +58,11 @@
|
|||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="dataList" >
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="字典编码" align="center" prop="id" />
|
||||||
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
<el-table-column label="字典标签" align="center" prop="label" />
|
||||||
<el-table-column label="字典标签" align="center" prop="dictLabel" />
|
<el-table-column label="字典键值" align="center" prop="value" />
|
||||||
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
<el-table-column label="字典排序" align="center" prop="sort" />
|
||||||
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
|
||||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
@ -114,7 +93,7 @@
|
|||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNo"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
@ -125,22 +104,22 @@
|
|||||||
<el-form-item label="字典类型">
|
<el-form-item label="字典类型">
|
||||||
<el-input v-model="form.dictType" :disabled="true" />
|
<el-input v-model="form.dictType" :disabled="true" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据标签" prop="dictLabel">
|
<el-form-item label="数据标签" prop="label">
|
||||||
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
<el-input v-model="form.label" placeholder="请输入数据标签" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据键值" prop="dictValue">
|
<el-form-item label="数据键值" prop="value">
|
||||||
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
<el-input v-model="form.value" placeholder="请输入数据键值" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示排序" prop="dictSort">
|
<el-form-item label="显示排序" prop="sort">
|
||||||
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
|
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in statusDictDatas"
|
||||||
:key="dict.dictValue"
|
:key="parseInt(dict.value)"
|
||||||
:label="dict.dictValue"
|
:label="parseInt(dict.value)"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
@ -157,7 +136,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data";
|
import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data";
|
||||||
import { listType, getType } from "@/api/system/dict/type";
|
import { listAllSimple, getType } from "@/api/system/dict/type";
|
||||||
|
|
||||||
|
import { SysCommonStatusEnum } from '@/utils/constants'
|
||||||
|
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Data",
|
name: "Data",
|
||||||
@ -165,12 +147,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
@ -189,7 +165,7 @@ export default {
|
|||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
dictName: undefined,
|
dictName: undefined,
|
||||||
dictType: undefined,
|
dictType: undefined,
|
||||||
@ -199,53 +175,55 @@ export default {
|
|||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
dictLabel: [
|
label: [
|
||||||
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
dictValue: [
|
value: [
|
||||||
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
dictSort: [
|
sort: [
|
||||||
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// 枚举
|
||||||
|
CommonStatusEnum: SysCommonStatusEnum,
|
||||||
|
// 数据字典
|
||||||
|
statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const dictId = this.$route.params && this.$route.params.dictId;
|
const dictId = this.$route.params && this.$route.params.dictId;
|
||||||
this.getType(dictId);
|
this.getType(dictId);
|
||||||
this.getTypeList();
|
this.getTypeList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典类型详细 */
|
/** 查询字典类型详细 */
|
||||||
getType(dictId) {
|
getType(dictId) {
|
||||||
getType(dictId).then(response => {
|
getType(dictId).then(response => {
|
||||||
this.queryParams.dictType = response.data.dictType;
|
this.queryParams.dictType = response.data.type;
|
||||||
this.defaultDictType = response.data.dictType;
|
this.defaultDictType = response.data.type;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询字典类型列表 */
|
/** 查询字典类型列表 */
|
||||||
getTypeList() {
|
getTypeList() {
|
||||||
listType().then(response => {
|
listAllSimple().then(response => {
|
||||||
this.typeOptions = response.rows;
|
this.typeOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询字典数据列表 */
|
/** 查询字典数据列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listData(this.queryParams).then(response => {
|
listData(this.queryParams).then(response => {
|
||||||
this.dataList = response.rows;
|
this.dataList = response.data.list;
|
||||||
this.total = response.total;
|
this.total = response.data.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 数据状态字典翻译
|
// 数据状态字典翻译
|
||||||
statusFormat(row, column) {
|
statusFormat(row, column) {
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status)
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -255,18 +233,18 @@ export default {
|
|||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
dictCode: undefined,
|
id: undefined,
|
||||||
dictLabel: undefined,
|
label: undefined,
|
||||||
dictValue: undefined,
|
value: undefined,
|
||||||
dictSort: 0,
|
sort: 0,
|
||||||
status: "0",
|
status: SysCommonStatusEnum.ENABLE,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNo = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
@ -282,17 +260,11 @@ export default {
|
|||||||
this.title = "添加字典数据";
|
this.title = "添加字典数据";
|
||||||
this.form.dictType = this.queryParams.dictType;
|
this.form.dictType = this.queryParams.dictType;
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.dictCode)
|
|
||||||
this.single = selection.length!=1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const dictCode = row.dictCode || this.ids
|
const id = row.id || this.ids
|
||||||
getData(dictCode).then(response => {
|
getData(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改字典数据";
|
this.title = "修改字典数据";
|
||||||
@ -302,7 +274,7 @@ export default {
|
|||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictCode != undefined) {
|
if (this.form.id !== undefined) {
|
||||||
updateData(this.form).then(response => {
|
updateData(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -320,13 +292,13 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictCodes = row.dictCode || this.ids;
|
const ids = row.id;
|
||||||
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除字典编码为"' + ids + '"的数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
return delData(dictCodes);
|
return delData(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
@ -347,4 +319,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -314,12 +314,6 @@ export default {
|
|||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
})
|
})
|
||||||
},
|
|
||||||
/** 清理缓存按钮操作 */
|
|
||||||
handleClearCache() {
|
|
||||||
clearCache().then(response => {
|
|
||||||
this.msgSuccess("清理成功");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,11 +2,9 @@ package cn.iocoder.dashboard.modules.system.controller.dict;
|
|||||||
|
|
||||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.*;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
|
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO;
|
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO;
|
|
||||||
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert;
|
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
||||||
import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService;
|
import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
@ -15,6 +13,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@ -69,14 +68,13 @@ public class SysDictTypeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// /**
|
@GetMapping("/list-all-simple")
|
||||||
// * 获取字典选择框列表
|
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||||
// */
|
// 无需添加权限认证,因为前端全局都需要
|
||||||
// @GetMapping("/optionselect")
|
public CommonResult<List<SysDictTypeSimpleRespVO>> listSimpleDictTypes() {
|
||||||
// public AjaxResult optionselect() {
|
List<SysDictTypeDO> list = dictTypeService.listDictTypes();
|
||||||
// List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
return success(SysDictTypeConvert.INSTANCE.convertList(list));
|
||||||
// return AjaxResult.success(dictTypes);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@ -13,9 +13,12 @@ import lombok.NoArgsConstructor;
|
|||||||
public class SysDictTypeSimpleRespVO {
|
public class SysDictTypeSimpleRespVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
|
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
|
||||||
private Integer id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "字典类型名称", required = true, example = "芋道")
|
@ApiModelProperty(value = "字典类型名称", required = true, example = "芋道")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.convert.dict;
|
|||||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeSimpleRespVO;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@ -10,6 +11,8 @@ import org.mapstruct.Mapper;
|
|||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysDictTypeConvert {
|
public interface SysDictTypeConvert {
|
||||||
|
|
||||||
@ -26,4 +29,6 @@ public interface SysDictTypeConvert {
|
|||||||
|
|
||||||
SysDictTypeDO convert(SysDictTypeUpdateReqVO bean);
|
SysDictTypeDO convert(SysDictTypeUpdateReqVO bean);
|
||||||
|
|
||||||
|
List<SysDictTypeSimpleRespVO> convertList(List<SysDictTypeDO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,13 @@ import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
|||||||
import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils;
|
import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysDictTypeMapper extends BaseMapper<SysDictTypeDO> {
|
public interface SysDictTypeMapper extends BaseMapper<SysDictTypeDO> {
|
||||||
|
|
||||||
@ -27,4 +30,8 @@ public interface SysDictTypeMapper extends BaseMapper<SysDictTypeDO> {
|
|||||||
return selectOne(new QueryWrapperX<SysDictTypeDO>().eq("name", name));
|
return selectOne(new QueryWrapperX<SysDictTypeDO>().eq("name", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<SysDictTypeDO> selectList() {
|
||||||
|
return selectList(new QueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePa
|
|||||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型 Service 接口
|
* 字典类型 Service 接口
|
||||||
*
|
*
|
||||||
@ -59,4 +61,11 @@ public interface SysDictTypeService {
|
|||||||
*/
|
*/
|
||||||
void deleteDictType(Long id);
|
void deleteDictType(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得全部字典类型列表
|
||||||
|
*
|
||||||
|
* @return 字典类型列表
|
||||||
|
*/
|
||||||
|
List<SysDictTypeDO> listDictTypes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*;
|
import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,6 +76,11 @@ public class SysDictTypeServiceImpl implements SysDictTypeService {
|
|||||||
// TODO 发送 MQ 消息
|
// TODO 发送 MQ 消息
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysDictTypeDO> listDictTypes() {
|
||||||
|
return dictTypeMapper.selectList();
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteDictType0(Long id) {
|
public void deleteDictType0(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
|
Loading…
Reference in New Issue
Block a user