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.
tcZz-java/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcZxyhController.java

123 lines
3.6 KiB

2 years ago
package com.ruoyi.tcZz.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
1 year ago
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
2 years ago
import com.ruoyi.tcZz.domain.TcZxyh;
import com.ruoyi.tcZz.service.ITcZxyhService;
1 year ago
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
2 years ago
import org.springframework.web.multipart.MultipartFile;
2 years ago
1 year ago
import javax.servlet.http.HttpServletResponse;
import java.util.List;
2 years ago
/**
* Controller
2 years ago
*
2 years ago
* @author ruoyi
* @date 2023-10-12
*/
@RestController
2 years ago
@Api(tags = "最新隐患")
2 years ago
@RequestMapping("/tcZz/networkSecurity/zxyh")
2 years ago
public class TcZxyhController extends BaseController {
2 years ago
@Autowired
private ITcZxyhService tcZxyhService;
/**
*
*/
2 years ago
@ApiOperation(value = "查询最新隐患列表", response = TcZxyh.class)
2 years ago
@GetMapping("/list")
2 years ago
public TableDataInfo list(TcZxyh tcZxyh) {
2 years ago
startPage();
List<TcZxyh> list = tcZxyhService.selectTcZxyhList(tcZxyh);
return getDataTable(list);
}
/**
*
*/
2 years ago
@ApiOperation(value = "导出最新隐患列表")
2 years ago
@PostMapping("/export")
2 years ago
public void export(HttpServletResponse response, TcZxyh tcZxyh) {
2 years ago
List<TcZxyh> list = tcZxyhService.selectTcZxyhList(tcZxyh);
ExcelUtil<TcZxyh> util = new ExcelUtil<TcZxyh>(TcZxyh.class);
util.exportExcel(response, list, "最新隐患数据");
}
/**
*
*/
2 years ago
@ApiOperation(value = "获取最新隐患详细信息")
2 years ago
@GetMapping(value = "/{id}")
2 years ago
public AjaxResult getInfo(@PathVariable("id") Long id) {
2 years ago
return success(tcZxyhService.selectTcZxyhById(id));
}
/**
*
*/
2 years ago
@ApiOperation(value = "新增最新隐患")
2 years ago
@PostMapping
2 years ago
public AjaxResult add(@RequestBody TcZxyh tcZxyh) {
2 years ago
return toAjax(tcZxyhService.insertTcZxyh(tcZxyh));
}
/**
*
*/
2 years ago
@ApiOperation(value = "修改最新隐患")
2 years ago
@PutMapping
2 years ago
public AjaxResult edit(@RequestBody TcZxyh tcZxyh) {
2 years ago
return toAjax(tcZxyhService.updateTcZxyh(tcZxyh));
}
/**
*
*/
2 years ago
@ApiOperation(value = "删除最新隐患")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
2 years ago
return toAjax(tcZxyhService.deleteTcZxyhByIds(ids));
}
2 years ago
/**
*
*/
@ApiOperation("通用导入excel信息")
@PostMapping("/common/importExcel")
public AjaxResult importExcel(MultipartFile file) throws Exception {
ExcelUtil<TcZxyh> util = new ExcelUtil<TcZxyh>(TcZxyh.class);
List<TcZxyh> tcZxyhList = util.importExcel(file.getInputStream());
tcZxyhService.importUser(tcZxyhList);
return AjaxResult.success();
}
2 years ago
/**
*
*
* @param isStatus
* @return
*/
@ApiOperation("批量启用禁用")
@GetMapping("/isStatus")
public AjaxResult isStatus(@RequestParam("isStatus") Integer isStatus, @RequestParam("ids") List<String> ids) {
1 year ago
tcZxyhService.updateByisStatus(isStatus, ids);
2 years ago
return AjaxResult.success();
}
2 years ago
@ApiOperation("通用下载excel模板")
@PostMapping("/importTemplate")
1 year ago
public void importTemplate(HttpServletResponse response) {
2 years ago
ExcelUtil<TcZxyh> util = new ExcelUtil<TcZxyh>(TcZxyh.class);
util.importTemplateExcel(response, " 最新隐患");
}
2 years ago
}