对比新文件 |
| | |
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.service.ISysDictDataService; |
| | | |
| | | /** |
| | | * 鏁版嵁瀛楀吀淇℃伅 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysDictDataService dictDataService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | public AjaxResult export(SysDictData dictData) |
| | | { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | return util.exportExcel(list, "瀛楀吀鏁版嵁"); |
| | | } |
| | | |
| | | /** |
| | | * 鏌ヨ瀛楀吀鏁版嵁璇︾粏 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * 鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅 |
| | | */ |
| | | @GetMapping(value = "/dictType/{dictType}") |
| | | public AjaxResult dictType(@PathVariable String dictType) |
| | | { |
| | | return AjaxResult.success(dictDataService.selectDictDataByType(dictType)); |
| | | } |
| | | |
| | | /** |
| | | * 鏂板瀛楀吀绫诲瀷 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(dictDataService.insertDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 淇敼淇濆瓨瀛楀吀绫诲瀷 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "瀛楀吀鏁版嵁", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(dictDataService.updateDictData(dict)); |
| | | } |
| | | |
| | | /** |
| | | * 鍒犻櫎瀛楀吀绫诲瀷 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | return toAjax(dictDataService.deleteDictDataByIds(dictCodes)); |
| | | } |
| | | } |