heheng
6 天以前 d8012ee77b6a9e86611aae9074d5925826f4210d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.gkhy.exam.admin.controller.system;
 
import com.gkhy.exam.common.annotation.Log;
import com.gkhy.exam.common.annotation.RepeatSubmit;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.domain.entity.SysDictType;
import com.gkhy.exam.common.enums.BusinessType;
import com.gkhy.exam.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('train:exam: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('train:exam: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('train:exam: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);
    }
}