整理 dict data 模块的 url
parent
78e847a81a
commit
9f9c63a221
|
@ -38,7 +38,7 @@ export function addData(data) {
|
|||
export function updateData(data) {
|
||||
return request({
|
||||
url: '/system/dict-data/update',
|
||||
method: 'post',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export function updateData(data) {
|
|||
export function delData(dictCode) {
|
||||
return request({
|
||||
url: '/system/dict-data/delete?id=' + dictCode,
|
||||
method: 'post'
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ export function addType(data) {
|
|||
export function updateType(data) {
|
||||
return request({
|
||||
url: '/system/dict-type/update',
|
||||
method: 'post',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export function updateType(data) {
|
|||
export function delType(dictId) {
|
||||
return request({
|
||||
url: '/system/dict-type/delete?id=' + dictId,
|
||||
method: 'post'
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -3,31 +3,15 @@
|
|||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="字典名称" prop="dictType">
|
||||
<el-select v-model="queryParams.dictType" size="small">
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.type"
|
||||
/>
|
||||
<el-option v-for="item in typeOptions" :key="item.id" :label="item.name" :value="item.type"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典标签" prop="label">
|
||||
<el-input
|
||||
v-model="queryParams.label"
|
||||
placeholder="请输入字典标签"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.label" placeholder="请输入字典标签" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in statusOptions"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
<el-option v-for="dict in statusOptions" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -38,22 +22,12 @@
|
|||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:dict:add']"
|
||||
>新增</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['system:dict:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:dict:export']"
|
||||
>导出</el-button>
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
|
||||
v-hasPermi="['system:dict:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
@ -72,31 +46,16 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dict:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:dict:remove']"
|
||||
>删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dict:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:dict:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 添加或修改参数配置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
|
@ -115,11 +74,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in statusDictDatas"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
>{{dict.label}}</el-radio>
|
||||
<el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
|
|
|
@ -2,52 +2,19 @@
|
|||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="字典名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入字典名称"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.name" placeholder="请输入字典名称" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典类型" prop="type">
|
||||
<el-input
|
||||
v-model="queryParams.type"
|
||||
placeholder="请输入字典类型"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.type" placeholder="请输入字典类型" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="字典状态"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in statusDictDatas"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
/>
|
||||
<el-select v-model="queryParams.status" placeholder="字典状态" clearable size="small" style="width: 240px">
|
||||
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="dateRangeCreateTime"
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
|
@ -57,22 +24,12 @@
|
|||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:dict:add']"
|
||||
>新增</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['system:dict:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:dict:export']"
|
||||
>导出</el-button>
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
|
||||
v-hasPermi="['system:dict:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
@ -96,31 +53,16 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dict:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:dict:remove']"
|
||||
>删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:dict:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:dict:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 添加或修改参数配置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
|
@ -133,11 +75,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in statusDictDatas"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
>{{dict.label}}</el-radio>
|
||||
<el-radio v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
|
|
|
@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.dict;
|
|||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.*;
|
||||
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictDataDO;
|
||||
|
@ -10,84 +11,85 @@ import cn.iocoder.dashboard.modules.system.service.dict.SysDictDataService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "字典数据")
|
||||
@RestController
|
||||
@RequestMapping("/system/dict-data")
|
||||
@Validated
|
||||
public class SysDictDataController {
|
||||
|
||||
@Resource
|
||||
private SysDictDataService dictDataService;
|
||||
|
||||
@ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地")
|
||||
@GetMapping("/list-all-simple")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<SysDictDataSimpleVO>> listSimpleDictDatas() {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDataList();
|
||||
return success(SysDictDataConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@ApiOperation("/获得字典类型的分页列表")
|
||||
@GetMapping("/page")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
public CommonResult<PageResult<SysDictDataRespVO>> pageDictTypes(@Validated SysDictDataPageReqVO reqVO) {
|
||||
return success(SysDictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO)));
|
||||
}
|
||||
|
||||
@ApiOperation("/查询字典数据详细")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@GetMapping(value = "/get")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) {
|
||||
return success(SysDictDataConvert.INSTANCE.convert(dictDataService.getDictData(id)));
|
||||
}
|
||||
|
||||
@ApiOperation("新增字典数据")
|
||||
@PostMapping("/create")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
// @Log(title = "字典数据", businessData = BusinessData.INSERT)
|
||||
public CommonResult<Long> createDictData(@Validated @RequestBody SysDictDataCreateReqVO reqVO) {
|
||||
@ApiOperation("新增字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
public CommonResult<Long> createDictData(@Valid @RequestBody SysDictDataCreateReqVO reqVO) {
|
||||
Long dictDataId = dictDataService.createDictData(reqVO);
|
||||
return success(dictDataId);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@ApiOperation("修改字典数据")
|
||||
@PostMapping("update")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
// @Log(title = "字典数据", businessData = BusinessData.UPDATE)
|
||||
public CommonResult<Boolean> updateDictData(@Validated @RequestBody SysDictDataUpdateReqVO reqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
public CommonResult<Boolean> updateDictData(@Valid @RequestBody SysDictDataUpdateReqVO reqVO) {
|
||||
dictDataService.updateDictData(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除字典数据")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PostMapping("/delete")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictData(Long id) {
|
||||
dictDataService.deleteDictData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ApiOperation("导出字典数据")
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<SysDictDataSimpleVO>> getSimpleDictDatas() {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDatas();
|
||||
return success(SysDictDataConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("/获得字典类型的分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<PageResult<SysDictDataRespVO>> getDictTypePage(@Valid SysDictDataPageReqVO reqVO) {
|
||||
return success(SysDictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO)));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get")
|
||||
@ApiOperation("/查询字典数据详细")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) {
|
||||
return success(SysDictDataConvert.INSTANCE.convert(dictDataService.getDictData(id)));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
public void export(HttpServletResponse response, @Validated SysDictDataExportReqVO reqVO) throws IOException {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDataList(reqVO);
|
||||
List<SysDictDataExcelVO> excelDataList = SysDictDataConvert.INSTANCE.convertList02(list);
|
||||
@ApiOperation("导出字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid SysDictDataExportReqVO reqVO) throws IOException {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
|
||||
List<SysDictDataExcelVO> data = SysDictDataConvert.INSTANCE.convertList02(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "字典数据.xls", "数据列表",
|
||||
SysDictDataExcelVO.class, excelDataList);
|
||||
ExcelUtils.write(response, "字典数据.xls", "数据列表", SysDictDataExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.dict;
|
|||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.*;
|
||||
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert;
|
||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictTypeDO;
|
||||
|
@ -10,67 +11,68 @@ import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "字典类型")
|
||||
@RestController
|
||||
@RequestMapping("/system/dict-type")
|
||||
@Validated
|
||||
public class SysDictTypeController {
|
||||
|
||||
@Resource
|
||||
private SysDictTypeService dictTypeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
public CommonResult<Long> createDictType(@Valid @RequestBody SysDictTypeCreateReqVO reqVO) {
|
||||
Long dictTypeId = dictTypeService.createDictType(reqVO);
|
||||
return success(dictTypeId);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
@ApiOperation("修改字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
public CommonResult<Boolean> updateDictType(@Valid @RequestBody SysDictTypeUpdateReqVO reqVO) {
|
||||
dictTypeService.updateDictType(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除字典类型")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictType(Long id) {
|
||||
dictTypeService.deleteDictType(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ApiOperation("/获得字典类型的分页列表")
|
||||
@GetMapping("/page")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Validated SysDictTypePageReqVO reqVO) {
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:quey')")
|
||||
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Valid SysDictTypePageReqVO reqVO) {
|
||||
return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO)));
|
||||
}
|
||||
|
||||
@ApiOperation("/查询字典类型详细")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@GetMapping(value = "/get")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:quey')")
|
||||
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
|
||||
return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id)));
|
||||
}
|
||||
|
||||
@ApiOperation("新增字典类型")
|
||||
@PostMapping("/create")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
// @Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
public CommonResult<Long> createDictType(@Validated @RequestBody SysDictTypeCreateReqVO reqVO) {
|
||||
Long dictTypeId = dictTypeService.createDictType(reqVO);
|
||||
return success(dictTypeId);
|
||||
}
|
||||
|
||||
@ApiOperation("修改字典类型")
|
||||
@PostMapping("update")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
// @Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
public CommonResult<Boolean> updateDictType(@Validated @RequestBody SysDictTypeUpdateReqVO reqVO) {
|
||||
dictTypeService.updateDictType(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ApiOperation("删除字典类型")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PostMapping("/delete")
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
public CommonResult<Boolean> deleteDictType(Long id) {
|
||||
dictTypeService.deleteDictType(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
|
@ -81,14 +83,13 @@ public class SysDictTypeController {
|
|||
|
||||
@ApiOperation("导出数据类型")
|
||||
@GetMapping("/export")
|
||||
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
// @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
public void export(HttpServletResponse response, @Validated SysDictTypeExportReqVO reqVO) throws IOException {
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:quey')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid SysDictTypeExportReqVO reqVO) throws IOException {
|
||||
List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO);
|
||||
List<SysDictTypeExcelVO> excelTypeList = SysDictTypeConvert.INSTANCE.convertList02(list);
|
||||
List<SysDictTypeExcelVO> data = SysDictTypeConvert.INSTANCE.convertList02(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "字典类型.xls", "类型列表",
|
||||
SysDictTypeExcelVO.class, excelTypeList);
|
||||
ExcelUtils.write(response, "字典类型.xls", "类型列表", SysDictTypeExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,37 +22,6 @@ public interface SysDictDataService extends DictDataFrameworkService {
|
|||
*/
|
||||
void initLocalCache();
|
||||
|
||||
/**
|
||||
* 获得字典数据列表
|
||||
*
|
||||
* @return 字典数据全列表
|
||||
*/
|
||||
List<SysDictDataDO> getDictDataList();
|
||||
|
||||
/**
|
||||
* 获得字典数据分页列表
|
||||
*
|
||||
* @param reqVO 分页请求
|
||||
* @return 字典数据分页列表
|
||||
*/
|
||||
PageResult<SysDictDataDO> getDictDataPage(SysDictDataPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得字典数据列表
|
||||
*
|
||||
* @param reqVO 列表请求
|
||||
* @return 字典数据列表
|
||||
*/
|
||||
List<SysDictDataDO> getDictDataList(SysDictDataExportReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得字典数据详情
|
||||
*
|
||||
* @param id 字典数据编号
|
||||
* @return 字典数据
|
||||
*/
|
||||
SysDictDataDO getDictData(Long id);
|
||||
|
||||
/**
|
||||
* 创建字典数据
|
||||
*
|
||||
|
@ -75,6 +44,37 @@ public interface SysDictDataService extends DictDataFrameworkService {
|
|||
*/
|
||||
void deleteDictData(Long id);
|
||||
|
||||
/**
|
||||
* 获得字典数据列表
|
||||
*
|
||||
* @return 字典数据全列表
|
||||
*/
|
||||
List<SysDictDataDO> getDictDatas();
|
||||
|
||||
/**
|
||||
* 获得字典数据分页列表
|
||||
*
|
||||
* @param reqVO 分页请求
|
||||
* @return 字典数据分页列表
|
||||
*/
|
||||
PageResult<SysDictDataDO> getDictDataPage(SysDictDataPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得字典数据列表
|
||||
*
|
||||
* @param reqVO 列表请求
|
||||
* @return 字典数据列表
|
||||
*/
|
||||
List<SysDictDataDO> getDictDatas(SysDictDataExportReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得字典数据详情
|
||||
*
|
||||
* @param id 字典数据编号
|
||||
* @return 字典数据
|
||||
*/
|
||||
SysDictDataDO getDictData(Long id);
|
||||
|
||||
/**
|
||||
* 获得指定字典类型的数据数量
|
||||
*
|
||||
|
|
|
@ -16,6 +16,28 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysDictTypeService {
|
||||
|
||||
/**
|
||||
* 创建字典类型
|
||||
*
|
||||
* @param reqVO 字典类型信息
|
||||
* @return 字典类型编号
|
||||
*/
|
||||
Long createDictType(SysDictTypeCreateReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 更新字典类型
|
||||
*
|
||||
* @param reqVO 字典类型信息
|
||||
*/
|
||||
void updateDictType(SysDictTypeUpdateReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*
|
||||
* @param id 字典类型编号
|
||||
*/
|
||||
void deleteDictType(Long id);
|
||||
|
||||
/**
|
||||
* 获得字典类型分页列表
|
||||
*
|
||||
|
@ -48,28 +70,6 @@ public interface SysDictTypeService {
|
|||
*/
|
||||
SysDictTypeDO getDictType(String type);
|
||||
|
||||
/**
|
||||
* 创建字典类型
|
||||
*
|
||||
* @param reqVO 字典类型信息
|
||||
* @return 字典类型编号
|
||||
*/
|
||||
Long createDictType(SysDictTypeCreateReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 更新字典类型
|
||||
*
|
||||
* @param reqVO 字典类型信息
|
||||
*/
|
||||
void updateDictType(SysDictTypeUpdateReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*
|
||||
* @param id 字典类型编号
|
||||
*/
|
||||
void deleteDictType(Long id);
|
||||
|
||||
/**
|
||||
* 获得全部字典类型列表
|
||||
*
|
||||
|
|
|
@ -131,7 +131,7 @@ public class SysDictDataServiceImpl implements SysDictDataService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysDictDataDO> getDictDataList() {
|
||||
public List<SysDictDataDO> getDictDatas() {
|
||||
List<SysDictDataDO> list = dictDataMapper.selectList();
|
||||
list.sort(COMPARATOR_TYPE_AND_SORT);
|
||||
return list;
|
||||
|
@ -143,7 +143,7 @@ public class SysDictDataServiceImpl implements SysDictDataService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysDictDataDO> getDictDataList(SysDictDataExportReqVO reqVO) {
|
||||
public List<SysDictDataDO> getDictDatas(SysDictDataExportReqVO reqVO) {
|
||||
List<SysDictDataDO> list = dictDataMapper.selectList(reqVO);
|
||||
list.sort(COMPARATOR_TYPE_AND_SORT);
|
||||
return list;
|
||||
|
|
|
@ -133,7 +133,7 @@ public class SysDictDataServiceTest extends BaseDbUnitTest {
|
|||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
|
||||
// 调用
|
||||
List<SysDictDataDO> list = dictDataService.getDictDataList(reqVO);
|
||||
List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbDictData, list.get(0));
|
||||
|
|
Loading…
Reference in New Issue