package com.smartor.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; 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.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.smartor.domain.IvrLibaTarget; import com.smartor.service.IIvrLibaTargetService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 指标库Controller * * @author smartor * @date 2023-03-22 */ @RestController @RequestMapping("/smartor/ivrtarget") public class IvrLibaTargetController extends BaseController { @Autowired private IIvrLibaTargetService ivrLibaTargetService; /** * 查询指标库列表 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:list')") @GetMapping("/list") public TableDataInfo list(IvrLibaTarget ivrLibaTarget) { startPage(); List list = ivrLibaTargetService.selectIvrLibaTargetList(ivrLibaTarget); return getDataTable(list); } /** * 导出指标库列表 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:export')") @Log(title = "指标库", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, IvrLibaTarget ivrLibaTarget) { List list = ivrLibaTargetService.selectIvrLibaTargetList(ivrLibaTarget); ExcelUtil util = new ExcelUtil(IvrLibaTarget.class); util.exportExcel(response, list, "指标库数据"); } /** * 获取指标库详细信息 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:query')") @GetMapping(value = "/{targetID}") public AjaxResult getInfo(@PathVariable("targetID") String targetID) { return success(ivrLibaTargetService.selectIvrLibaTargetByTargetID(targetID)); } /** * 新增指标库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:add')") @Log(title = "指标库", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody IvrLibaTarget ivrLibaTarget) { return toAjax(ivrLibaTargetService.insertIvrLibaTarget(ivrLibaTarget)); } /** * 修改指标库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:edit')") @Log(title = "指标库", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody IvrLibaTarget ivrLibaTarget) { return toAjax(ivrLibaTargetService.updateIvrLibaTarget(ivrLibaTarget)); } /** * 删除指标库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:remove')") @Log(title = "指标库", businessType = BusinessType.DELETE) @DeleteMapping("/{targetIDs}") public AjaxResult remove(@PathVariable String[] targetIDs) { return toAjax(ivrLibaTargetService.deleteIvrLibaTargetByTargetIDs(targetIDs)); } }