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.IvrLibaTemplate; import com.smartor.service.IIvrLibaTemplateService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 话术模板库Controller * * @author smartor * @date 2023-03-22 */ @RestController @RequestMapping("/smartor/ivrtemplate") public class IvrLibaTemplateController extends BaseController { @Autowired private IIvrLibaTemplateService ivrLibaTemplateService; /** * 查询话术模板库列表 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:list')") @GetMapping("/list") public TableDataInfo list(IvrLibaTemplate ivrLibaTemplate) { startPage(); List list = ivrLibaTemplateService.selectIvrLibaTemplateList(ivrLibaTemplate); return getDataTable(list); } /** * 导出话术模板库列表 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:export')") @Log(title = "话术模板库", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, IvrLibaTemplate ivrLibaTemplate) { List list = ivrLibaTemplateService.selectIvrLibaTemplateList(ivrLibaTemplate); ExcelUtil util = new ExcelUtil(IvrLibaTemplate.class); util.exportExcel(response, list, "话术模板库数据"); } /** * 获取话术模板库详细信息 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:query')") @GetMapping(value = "/{templateID}") public AjaxResult getInfo(@PathVariable("templateID") String templateID) { return success(ivrLibaTemplateService.selectIvrLibaTemplateByTemplateID(templateID)); } /** * 新增话术模板库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:add')") @Log(title = "话术模板库", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody IvrLibaTemplate ivrLibaTemplate) { return toAjax(ivrLibaTemplateService.insertIvrLibaTemplate(ivrLibaTemplate)); } /** * 修改话术模板库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:edit')") @Log(title = "话术模板库", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody IvrLibaTemplate ivrLibaTemplate) { return toAjax(ivrLibaTemplateService.updateIvrLibaTemplate(ivrLibaTemplate)); } /** * 删除话术模板库 */ @PreAuthorize("@ss.hasPermi('smartor:ivrtemplate:remove')") @Log(title = "话术模板库", businessType = BusinessType.DELETE) @DeleteMapping("/{templateIDs}") public AjaxResult remove(@PathVariable String[] templateIDs) { return toAjax(ivrLibaTemplateService.deleteIvrLibaTemplateByTemplateIDs(templateIDs)); } }