package com.gkhy.hazmat.admin.controller.system;
|
|
import com.gkhy.hazmat.common.annotation.Log;
|
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
|
import com.gkhy.hazmat.common.api.CommonResult;
|
import com.gkhy.hazmat.common.domain.entity.SysDictType;
|
import com.gkhy.hazmat.common.enums.BusinessType;
|
import com.gkhy.hazmat.system.service.SysDictTypeService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
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.*;
|
|
import java.util.List;
|
|
@Api(tags = "数据字典类型前端控制器")
|
@RestController
|
@RequestMapping("/system/dict/type")
|
public class SysDictTypeController {
|
@Autowired
|
private SysDictTypeService dictTypeService;
|
|
@ApiOperation(value = "字典类型分页")
|
@GetMapping(value = "/list")
|
public CommonResult list(SysDictType dictType){
|
return CommonResult.success(dictTypeService.selectDictTypeList(dictType));
|
}
|
|
@ApiOperation(value = "根据id获取字典类型详情")
|
@GetMapping(value = "/{dictId}")
|
public CommonResult getInfo(@PathVariable(name = "dictId")Long dictId){
|
return CommonResult.success(dictTypeService.selectDictTypeById(dictId));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
@ApiOperation(value = "新增字典类型")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody SysDictType dictType){
|
return CommonResult.success(dictTypeService.insertDictType(dictType));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "编辑字典类型")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody SysDictType dictType){
|
return CommonResult.success(dictTypeService.updateDictType(dictType));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
@ApiOperation(value = "删除字典类型")
|
@DeleteMapping(value = "/{dictIds}")
|
public CommonResult remove(@PathVariable Long[] dictIds){
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
return CommonResult.success();
|
}
|
|
@RepeatSubmit
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
@ApiOperation(value = "刷新缓存")
|
@DeleteMapping("/refreshCache")
|
public CommonResult refreshCache(){
|
dictTypeService.resetDictCache();
|
return CommonResult.success();
|
}
|
|
@ApiOperation(value = "获取字典选择框列表")
|
@GetMapping("/optionselect")
|
public CommonResult optionselect()
|
{
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
return CommonResult.success(dictTypes);
|
}
|
}
|