整理 dict data 模块的 url

pull/2/head
YunaiV 2021-03-14 21:28:17 +08:00
parent 78e847a81a
commit 9f9c63a221
10 changed files with 172 additions and 276 deletions

View File

@ -38,7 +38,7 @@ export function addData(data) {
export function updateData(data) { export function updateData(data) {
return request({ return request({
url: '/system/dict-data/update', url: '/system/dict-data/update',
method: 'post', method: 'put',
data: data data: data
}) })
} }
@ -47,7 +47,7 @@ export function updateData(data) {
export function delData(dictCode) { export function delData(dictCode) {
return request({ return request({
url: '/system/dict-data/delete?id=' + dictCode, url: '/system/dict-data/delete?id=' + dictCode,
method: 'post' method: 'delete'
}) })
} }

View File

@ -30,7 +30,7 @@ export function addType(data) {
export function updateType(data) { export function updateType(data) {
return request({ return request({
url: '/system/dict-type/update', url: '/system/dict-type/update',
method: 'post', method: 'put',
data: data data: data
}) })
} }
@ -39,7 +39,7 @@ export function updateType(data) {
export function delType(dictId) { export function delType(dictId) {
return request({ return request({
url: '/system/dict-type/delete?id=' + dictId, url: '/system/dict-type/delete?id=' + dictId,
method: 'post' method: 'delete'
}) })
} }

View File

@ -3,31 +3,15 @@
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="dictType"> <el-form-item label="字典名称" prop="dictType">
<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" :key="item.id" :label="item.name" :value="item.type"/>
v-for="item in typeOptions"
:key="item.id"
:label="item.name"
:value="item.type"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字典标签" prop="label"> <el-form-item label="字典标签" prop="label">
<el-input <el-input v-model="queryParams.label" placeholder="请输入字典标签" clearable size="small" @keyup.enter.native="handleQuery"/>
v-model="queryParams.label"
placeholder="请输入字典标签"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<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" :key="dict.value" :label="dict.label" :value="dict.value"/>
v-for="dict in statusOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -38,22 +22,12 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
type="primary" v-hasPermi="['system:dict:create']">新增</el-button>
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dict:add']"
>新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
type="warning" v-hasPermi="['system:dict:export']">导出</el-button>
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -72,31 +46,16 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
size="mini" v-hasPermi="['system:dict:update']">修改</el-button>
type="text" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
icon="el-icon-edit" v-hasPermi="['system:dict:delete']">删除</el-button>
@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>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList"/>
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@ -115,11 +74,7 @@
</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 statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
v-for="dict in statusDictDatas"
:key="parseInt(dict.value)"
:label="parseInt(dict.value)"
>{{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">

View File

@ -2,52 +2,19 @@
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="name"> <el-form-item label="字典名称" prop="name">
<el-input <el-input v-model="queryParams.name" placeholder="请输入字典名称" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery"/>
v-model="queryParams.name"
placeholder="请输入字典名称"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="字典类型" prop="type"> <el-form-item label="字典类型" prop="type">
<el-input <el-input v-model="queryParams.type" placeholder="请输入字典类型" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery"/>
v-model="queryParams.type"
placeholder="请输入字典类型"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select <el-select v-model="queryParams.status" placeholder="字典状态" clearable size="small" style="width: 240px">
v-model="queryParams.status" <el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
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-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
v-model="dateRangeCreateTime" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
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-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <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-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
type="primary" v-hasPermi="['system:dict:create']">新增</el-button>
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dict:add']"
>新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
type="warning" v-hasPermi="['system:dict:export']">导出</el-button>
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -96,31 +53,16 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
size="mini" v-hasPermi="['system:dict:update']">修改</el-button>
type="text" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
icon="el-icon-edit" v-hasPermi="['system:dict:delete']">删除</el-button>
@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>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
v-show="total>0" @pagination="getList"/>
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@ -133,11 +75,7 @@
</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 statusDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
v-for="dict in statusDictDatas"
:key="parseInt(dict.value)"
:label="parseInt(dict.value)"
>{{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">

View File

@ -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.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 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.controller.dict.vo.data.*;
import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert; import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert;
import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictDataDO; 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.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; 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 javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success; import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "字典数据") @Api(tags = "字典数据")
@RestController @RestController
@RequestMapping("/system/dict-data") @RequestMapping("/system/dict-data")
@Validated
public class SysDictDataController { public class SysDictDataController {
@Resource @Resource
private SysDictDataService dictDataService; 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") @PostMapping("/create")
// @PreAuthorize("@ss.hasPermi('system:dict:add')") @ApiOperation("新增字典数据")
// @Log(title = "字典数据", businessData = BusinessData.INSERT) @PreAuthorize("@ss.hasPermission('system:dict:create')")
public CommonResult<Long> createDictData(@Validated @RequestBody SysDictDataCreateReqVO reqVO) { public CommonResult<Long> createDictData(@Valid @RequestBody SysDictDataCreateReqVO reqVO) {
Long dictDataId = dictDataService.createDictData(reqVO); Long dictDataId = dictDataService.createDictData(reqVO);
return success(dictDataId); return success(dictDataId);
} }
@PutMapping("update")
@ApiOperation("修改字典数据") @ApiOperation("修改字典数据")
@PostMapping("update") @PreAuthorize("@ss.hasPermission('system:dict:update')")
// @PreAuthorize("@ss.hasPermi('system:dict:edit')") public CommonResult<Boolean> updateDictData(@Valid @RequestBody SysDictDataUpdateReqVO reqVO) {
// @Log(title = "字典数据", businessData = BusinessData.UPDATE)
public CommonResult<Boolean> updateDictData(@Validated @RequestBody SysDictDataUpdateReqVO reqVO) {
dictDataService.updateDictData(reqVO); dictDataService.updateDictData(reqVO);
return success(true); return success(true);
} }
@DeleteMapping("/delete")
@ApiOperation("删除字典数据") @ApiOperation("删除字典数据")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PostMapping("/delete") @PreAuthorize("@ss.hasPermission('system:dict:delete')")
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
public CommonResult<Boolean> deleteDictData(Long id) { public CommonResult<Boolean> deleteDictData(Long id) {
dictDataService.deleteDictData(id); dictDataService.deleteDictData(id);
return success(true); 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") @GetMapping("/export")
// @Log(title = "字典类型", businessType = BusinessType.EXPORT) @ApiOperation("导出字典数据")
// @PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermission('system:dict:export')")
public void export(HttpServletResponse response, @Validated SysDictDataExportReqVO reqVO) throws IOException { @OperateLog(type = EXPORT)
List<SysDictDataDO> list = dictDataService.getDictDataList(reqVO); public void export(HttpServletResponse response, @Valid SysDictDataExportReqVO reqVO) throws IOException {
List<SysDictDataExcelVO> excelDataList = SysDictDataConvert.INSTANCE.convertList02(list); List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
List<SysDictDataExcelVO> data = SysDictDataConvert.INSTANCE.convertList02(list);
// 输出 // 输出
ExcelUtils.write(response, "字典数据.xls", "数据列表", ExcelUtils.write(response, "字典数据.xls", "数据列表", SysDictDataExcelVO.class, data);
SysDictDataExcelVO.class, excelDataList);
} }
} }

View File

@ -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.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 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.controller.dict.vo.type.*;
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.dataobject.dict.SysDictTypeDO; 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.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; 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 javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success; import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "字典类型") @Api(tags = "字典类型")
@RestController @RestController
@RequestMapping("/system/dict-type") @RequestMapping("/system/dict-type")
@Validated
public class SysDictTypeController { public class SysDictTypeController {
@Resource @Resource
private SysDictTypeService dictTypeService; 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("/获得字典类型的分页列表") @ApiOperation("/获得字典类型的分页列表")
@GetMapping("/page") @GetMapping("/page")
// @PreAuthorize("@ss.hasPermi('system:dict:list')") @PreAuthorize("@ss.hasPermission('system:dict:quey')")
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Validated SysDictTypePageReqVO reqVO) { public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Valid SysDictTypePageReqVO reqVO) {
return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO))); return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO)));
} }
@ApiOperation("/查询字典类型详细") @ApiOperation("/查询字典类型详细")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@GetMapping(value = "/get") @GetMapping(value = "/get")
// @PreAuthorize("@ss.hasPermi('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:quey')")
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) { public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(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") @GetMapping("/list-all-simple")
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") @ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
// 无需添加权限认证,因为前端全局都需要 // 无需添加权限认证,因为前端全局都需要
@ -81,14 +83,13 @@ public class SysDictTypeController {
@ApiOperation("导出数据类型") @ApiOperation("导出数据类型")
@GetMapping("/export") @GetMapping("/export")
// @Log(title = "字典类型", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermission('system:dict:quey')")
// @PreAuthorize("@ss.hasPermi('system:dict:export')") @OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Validated SysDictTypeExportReqVO reqVO) throws IOException { public void export(HttpServletResponse response, @Valid SysDictTypeExportReqVO reqVO) throws IOException {
List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO); List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO);
List<SysDictTypeExcelVO> excelTypeList = SysDictTypeConvert.INSTANCE.convertList02(list); List<SysDictTypeExcelVO> data = SysDictTypeConvert.INSTANCE.convertList02(list);
// 输出 // 输出
ExcelUtils.write(response, "字典类型.xls", "类型列表", ExcelUtils.write(response, "字典类型.xls", "类型列表", SysDictTypeExcelVO.class, data);
SysDictTypeExcelVO.class, excelTypeList);
} }
} }

View File

@ -22,37 +22,6 @@ public interface SysDictDataService extends DictDataFrameworkService {
*/ */
void initLocalCache(); 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); 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);
/** /**
* *
* *

View File

@ -16,6 +16,28 @@ import java.util.List;
*/ */
public interface SysDictTypeService { 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); SysDictTypeDO getDictType(String type);
/**
*
*
* @param reqVO
* @return
*/
Long createDictType(SysDictTypeCreateReqVO reqVO);
/**
*
*
* @param reqVO
*/
void updateDictType(SysDictTypeUpdateReqVO reqVO);
/**
*
*
* @param id
*/
void deleteDictType(Long id);
/** /**
* *
* *

View File

@ -131,7 +131,7 @@ public class SysDictDataServiceImpl implements SysDictDataService {
} }
@Override @Override
public List<SysDictDataDO> getDictDataList() { public List<SysDictDataDO> getDictDatas() {
List<SysDictDataDO> list = dictDataMapper.selectList(); List<SysDictDataDO> list = dictDataMapper.selectList();
list.sort(COMPARATOR_TYPE_AND_SORT); list.sort(COMPARATOR_TYPE_AND_SORT);
return list; return list;
@ -143,7 +143,7 @@ public class SysDictDataServiceImpl implements SysDictDataService {
} }
@Override @Override
public List<SysDictDataDO> getDictDataList(SysDictDataExportReqVO reqVO) { public List<SysDictDataDO> getDictDatas(SysDictDataExportReqVO reqVO) {
List<SysDictDataDO> list = dictDataMapper.selectList(reqVO); List<SysDictDataDO> list = dictDataMapper.selectList(reqVO);
list.sort(COMPARATOR_TYPE_AND_SORT); list.sort(COMPARATOR_TYPE_AND_SORT);
return list; return list;

View File

@ -133,7 +133,7 @@ public class SysDictDataServiceTest extends BaseDbUnitTest {
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
// 调用 // 调用
List<SysDictDataDO> list = dictDataService.getDictDataList(reqVO); List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
// 断言 // 断言
assertEquals(1, list.size()); assertEquals(1, list.size());
assertPojoEquals(dbDictData, list.get(0)); assertPojoEquals(dbDictData, list.get(0));