| | |
| | | package com.smartor.controller; |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | 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.github.pagehelper.PageInfo; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | 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; |
| | | 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.domain.IvrLibaTargetAssort; |
| | | import com.smartor.domain.IvrLibaTargetVO; |
| | | import com.smartor.service.IIvrLibaTargetService; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 指标库Controller |
| | | * |
| | | * @author smartor |
| | | * @date 2023-03-22 |
| | | * 指标选项库Controller |
| | | * |
| | | * @author ruoyi |
| | | * @date 2023-12-14 |
| | | */ |
| | | @Api(description = "指标库") |
| | | @RestController |
| | | @RequestMapping("/smartor/ivrtarget") |
| | | public class IvrLibaTargetController extends BaseController |
| | | { |
| | | @RequestMapping("/smartor/target") |
| | | public class IvrLibaTargetController extends BaseController { |
| | | @Autowired |
| | | private IIvrLibaTargetService ivrLibaTargetService; |
| | | |
| | | /** |
| | | * 查询指标库列表 |
| | | * 查询指标选项库列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(IvrLibaTarget ivrLibaTarget) |
| | | { |
| | | startPage(); |
| | | @ApiOperation("查询指标列表") |
| | | @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('smartor:ivrtarget:export')") |
| | | @PreAuthorize("@ss.hasPermi('system:target:export')") |
| | | @Log(title = "指标库", businessType = BusinessType.EXPORT) |
| | | @ApiOperation("导出指标列表") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, IvrLibaTarget ivrLibaTarget) |
| | | { |
| | | 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, "指标库数据"); |
| | | util.exportExcel(response, list, "指标选项库数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取指标库详细信息 |
| | | * 获取指标信息通过targetID |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:query')") |
| | | @GetMapping(value = "/{targetID}") |
| | | public AjaxResult getInfo(@PathVariable("targetID") String targetID) |
| | | { |
| | | @ApiOperation("获取指标信息通过targetID") |
| | | @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('smartor:ivrtarget:add')") |
| | | @Log(title = "指标库", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody IvrLibaTarget ivrLibaTarget) |
| | | { |
| | | return toAjax(ivrLibaTargetService.insertIvrLibaTarget(ivrLibaTarget)); |
| | | @PreAuthorize("@ss.hasPermi('system:target:add')") |
| | | @Log(title = "指标选项库", businessType = BusinessType.INSERT) |
| | | @ApiOperation("新增指标(这个接口没啥用了,用”新增或修改指标信息“这个接口好一些)") |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody IvrLibaTargetVO ivrLibaTargetVO) { |
| | | return toAjax(ivrLibaTargetService.insertIvrLibaTarget(ivrLibaTargetVO)); |
| | | } |
| | | |
| | | /** |
| | | * 修改指标库 |
| | | * 新增或修改指标信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:edit')") |
| | | @Log(title = "指标库", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody IvrLibaTarget ivrLibaTarget) |
| | | { |
| | | return toAjax(ivrLibaTargetService.updateIvrLibaTarget(ivrLibaTarget)); |
| | | @ApiOperation("新增或修改指标信息") |
| | | @PreAuthorize("@ss.hasPermi('system:target:edit')") |
| | | @Log(title = "指标选项库", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/saveOrupdateIvrLibaTarget") |
| | | public AjaxResult saveOrupdateIvrLibaTarget(@RequestBody IvrLibaTargetVO ivrLibaTargetVO) { |
| | | return toAjax(ivrLibaTargetService.saveOrupdateIvrLibaTarget(ivrLibaTargetVO)); |
| | | } |
| | | |
| | | /** |
| | | * 删除指标库 |
| | | * 删除指标 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('smartor:ivrtarget:remove')") |
| | | @Log(title = "指标库", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{targetIDs}") |
| | | public AjaxResult remove(@PathVariable String[] targetIDs) |
| | | { |
| | | @ApiOperation("删除指标") |
| | | @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)); |
| | | } |
| | | |
| | | /** |
| | | * 查询指标选项库列表 |
| | | */ |
| | | @ApiOperation("查询指标和关联的指标选项") |
| | | @PreAuthorize("@ss.hasPermi('system:target:list')") |
| | | @PostMapping("/targetInfo") |
| | | public TableDataInfo targetInfo(@RequestBody IvrLibaTarget ivrLibaTarget) { |
| | | PageUtils.startPageByPost(ivrLibaTarget.getPageNum(), ivrLibaTarget.getPageSize()); |
| | | //这个用来获取分页数据 |
| | | List<IvrLibaTargetVO> ivrLibaTargetVOS = ivrLibaTargetService.targetInfo(ivrLibaTarget); |
| | | |
| | | //用于分页 |
| | | List<IvrLibaTarget> ivrLibaTargets = ivrLibaTargetService.selectIvrLibaTargetList(null); |
| | | //分页 |
| | | TableDataInfo rspData = new TableDataInfo(); |
| | | rspData.setCode(HttpStatus.SUCCESS); |
| | | rspData.setMsg("查询成功"); |
| | | rspData.setRows(ivrLibaTargetVOS); |
| | | rspData.setTotal(new PageInfo(ivrLibaTargets).getTotal()); |
| | | |
| | | return rspData; |
| | | } |
| | | } |