liusheng
2023-12-15 78b0e909aa6ece787091e5d81450c8927ef2599e
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
82
83
84
85
86
87
88
89
90
91
92
93
package com.ruoyi.web.controller.smartor;
 
import cn.hutool.db.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.IvrLibaTarget;
import com.smartor.service.IIvrLibaTargetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 指标选项库Controller
 *
 * @author ruoyi
 * @date 2023-12-14
 */
@RestController
@RequestMapping("/smartor/target")
public class IvrLibaTargetController extends BaseController {
    @Autowired
    private IIvrLibaTargetService ivrLibaTargetService;
 
    /**
     * 查询指标选项库列表
     */
    @PreAuthorize("@ss.hasPermi('system:target:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody    IvrLibaTarget ivrLibaTarget) {
        PageUtils.startPageByPost(ivrLibaTarget.getPageNum(),ivrLibaTarget.getPageSize());
        List<IvrLibaTarget> list = ivrLibaTargetService.selectIvrLibaTargetList(ivrLibaTarget);
        return getDataTable(list);
    }
 
    /**
     * 导出指标选项库列表
     */
    @PreAuthorize("@ss.hasPermi('system:target:export')")
    @Log(title = "指标选项库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IvrLibaTarget ivrLibaTarget) {
        List<IvrLibaTarget> list = ivrLibaTargetService.selectIvrLibaTargetList(ivrLibaTarget);
        ExcelUtil<IvrLibaTarget> util = new ExcelUtil<IvrLibaTarget>(IvrLibaTarget.class);
        util.exportExcel(response, list, "指标选项库数据");
    }
 
    /**
     * 获取指标选项库详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:target:query')")
    @GetMapping(value = "/getInfo/{targetID}")
    public AjaxResult getInfo(@PathVariable("targetID") Long targetID) {
        return success(ivrLibaTargetService.selectIvrLibaTargetByTargetID(targetID));
    }
 
    /**
     * 新增指标选项库
     */
    @PreAuthorize("@ss.hasPermi('system:target:add')")
    @Log(title = "指标选项库", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody IvrLibaTarget ivrLibaTarget) {
        return toAjax(ivrLibaTargetService.insertIvrLibaTarget(ivrLibaTarget));
    }
 
    /**
     * 修改指标选项库
     */
    @PreAuthorize("@ss.hasPermi('system:target:edit')")
    @Log(title = "指标选项库", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody IvrLibaTarget ivrLibaTarget) {
        return toAjax(ivrLibaTargetService.updateIvrLibaTarget(ivrLibaTarget));
    }
 
    /**
     * 删除指标选项库
     */
    @PreAuthorize("@ss.hasPermi('system:target:remove')")
    @Log(title = "指标选项库", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{targetIDs}")
    public AjaxResult remove(@PathVariable Long[] targetIDs) {
        return toAjax(ivrLibaTargetService.deleteIvrLibaTargetByTargetIDs(targetIDs));
    }
}