Blame view

src/main/java/com/order/erp/controller/DictionaryController.java 2.51 KB
“谢茂盛” authored
1
2
package com.order.erp.controller;
Ran authored
3
import com.alibaba.excel.EasyExcel;
4
import com.order.erp.common.annotation.AnonymousAccess;
“谢茂盛” authored
5
6
7
8
9
10
11
import com.order.erp.common.constant.ServerResult;
import com.order.erp.domain.vo.admin.DictionaryQueryVO;
import com.order.erp.domain.vo.admin.DictionaryVO;
import com.order.erp.log.Log;
import com.order.erp.service.admin.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
Ran authored
12
13
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.net.URLCodec;
“谢茂盛” authored
14
15
16
17
18
19
20
21
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
Ran authored
22
23
24
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
“谢茂盛” authored
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

/**
 * @author xms
 */
@RestController
@Api(tags = "系统:字典管理")
@RequestMapping("/order/erp/dictionary")
public class DictionaryController {

    @Resource
    private DictionaryService dictionaryService;


    @Log("查询字典列表")
    @ApiOperation("查询字典列表")
    @PostMapping(value = "/list_by_page")
41
    @AnonymousAccess
“谢茂盛” authored
42
43
44
45
46
47
48
    public ServerResult listByPage(@RequestBody @Validated DictionaryQueryVO queryVO) {
        return dictionaryService.listByPage(queryVO);
    }

    @Log("获取所有字典")
    @ApiOperation("获取所有字典")
    @PostMapping(value = "/get_all")
49
    @AnonymousAccess
“谢茂盛” authored
50
51
52
53
54
55
56
    public ServerResult getAll(@RequestBody @Validated DictionaryQueryVO queryVO) {
        return dictionaryService.getAll(queryVO);
    }

    @Log("新增字典")
    @ApiOperation("新增字典")
    @PostMapping("/add")
57
    @AnonymousAccess
“谢茂盛” authored
58
59
60
61
62
63
64
    public ServerResult add(@RequestBody @Validated DictionaryVO dictionaryVO) {
        return dictionaryService.add(dictionaryVO);
    }

    @Log("修改字典")
    @ApiOperation("修改字典")
    @PostMapping("/edit")
65
    @AnonymousAccess
“谢茂盛” authored
66
67
68
69
70
71
72
    public ServerResult edit(@RequestBody @Validated DictionaryVO dictionaryVO) {
        return dictionaryService.edit(dictionaryVO);
    }

    @Log("删除字典")
    @ApiOperation("删除字典")
    @PostMapping("/delete")
73
    @AnonymousAccess
“谢茂盛” authored
74
75
76
    public ServerResult delete(@RequestBody @Validated DictionaryQueryVO queryVO) {
        return dictionaryService.deleteById(queryVO);
    }
Ran authored
77
“谢茂盛” authored
78
}