You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
3.4 KiB
114 lines
3.4 KiB
package com.ruoyi.tcZz.controller;
|
|
|
|
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.exception.ServiceException;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.tcZz.domain.TcZclds;
|
|
import com.ruoyi.tcZz.service.ITcZcldsService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 众测漏洞数(tc_zclds)表控制层
|
|
* @author du
|
|
* @since 2024/8/5 13:16
|
|
*/
|
|
@RestController
|
|
@Api(tags = "众测漏洞数")
|
|
@RequestMapping("/tcZz/networkSecurity/zclds")
|
|
public class TcZcldsController extends BaseController {
|
|
@Autowired
|
|
private ITcZcldsService tcZcldsService;
|
|
|
|
/**
|
|
* 查询众测漏洞数列表
|
|
*/
|
|
@ApiOperation(value = "查询众测漏洞数列表", response = TcZclds.class)
|
|
@GetMapping("/list")
|
|
public TableDataInfo list(TcZclds tc) {
|
|
startPage();
|
|
List<TcZclds> list = tcZcldsService.page(tc);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 导出众测漏洞数列表
|
|
*/
|
|
@ApiOperation(value = " 导出众测漏洞数列表")
|
|
@PostMapping("/export")
|
|
public void export(HttpServletResponse response, TcZclds tc) {
|
|
List<TcZclds> list = tcZcldsService.page(tc);
|
|
ExcelUtil<TcZclds> util = new ExcelUtil<>(TcZclds.class);
|
|
util.exportExcel(response, list, "众测漏洞数详情数据");
|
|
}
|
|
|
|
/**
|
|
* 获取众测漏洞数信息
|
|
*/
|
|
@ApiOperation(value = " 获取众测漏洞数信息")
|
|
@GetMapping(value = "/{id}")
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
return success(tcZcldsService.getById(id));
|
|
}
|
|
|
|
/**
|
|
* 新增众测漏洞数
|
|
*/
|
|
@ApiOperation(value = "新增众测漏洞数")
|
|
@PostMapping
|
|
public AjaxResult add(@RequestBody TcZclds tc) {
|
|
TcZclds t = new TcZclds();
|
|
if(tcZcldsService.page(t).size()>=4){
|
|
throw new ServiceException("无法新增!");
|
|
}
|
|
return toAjax(tcZcldsService.insert(tc));
|
|
}
|
|
|
|
/**
|
|
* 修改众测漏洞数
|
|
*/
|
|
@ApiOperation(value = "修改众测漏洞数")
|
|
@PutMapping
|
|
public AjaxResult edit(@RequestBody TcZclds tc) {
|
|
return toAjax(tcZcldsService.update(tc));
|
|
}
|
|
|
|
/**
|
|
* 删除众测漏洞数
|
|
*/
|
|
@ApiOperation(value = "删除众测漏洞数")
|
|
@DeleteMapping("/{ids}")
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(tcZcldsService.deleteByIds(ids));
|
|
}
|
|
|
|
|
|
/**
|
|
* 导入
|
|
*/
|
|
@ApiOperation("通用导入excel信息")
|
|
@PostMapping("/common/importExcel")
|
|
public AjaxResult importExcel(MultipartFile file) throws Exception {
|
|
ExcelUtil<TcZclds> util = new ExcelUtil<>(TcZclds.class);
|
|
List<TcZclds> tcZbxqList = util.importExcel(file.getInputStream());
|
|
tcZcldsService.importUser(tcZbxqList);
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
|
|
@ApiOperation("通用下载excel模板")
|
|
@PostMapping("/importTemplate")
|
|
public void importTemplate(HttpServletResponse response) {
|
|
ExcelUtil<TcZclds> util = new ExcelUtil<>(TcZclds.class);
|
|
util.importTemplateExcel(response, "众测漏洞数详情");
|
|
}
|
|
}
|