| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("查询字典类型列表") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysDictType> list(SysDictType dictType) { |
| | | return dictTypeService.selectPageDictTypeList(dictType); |
| | | public TableDataInfo<SysDictType> list(SysDictType dictType, PageQuery pageQuery) { |
| | | return dictTypeService.selectPageDictTypeList(dictType, pageQuery); |
| | | } |
| | | |
| | | @ApiOperation("导出字典类型列表") |
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysDictType dictType, HttpServletResponse response) { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); |
| | |
| | | @ApiOperation("查询字典类型详细") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult<SysDictType> getInfo(@PathVariable Long dictId) { |
| | | public AjaxResult<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) { |
| | | return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | | |
| | |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] dictIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |