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.
taicangzongzhi-java/ruoyi-admin/src/main/java/com/ruoyi/zongzhi/controller/TcSafetyDangerController.java

94 lines
2.8 KiB

package com.ruoyi.zongzhi.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.utils.poi.ExcelUtil;
import com.ruoyi.zongzhi.domain.TcSafetyDanger;
import com.ruoyi.zongzhi.service.ITcSafetyDangerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 安全隐患Controller
*
* @author ruoyi
* @date 2023-08-10
*/
@RestController
@RequestMapping("/zongzhi/danger")
@Api(tags = " 安全隐患")
public class TcSafetyDangerController extends BaseController {
@Autowired
private ITcSafetyDangerService tcSafetyDangerService;
/**
* 查询监管单位列表
*/
@GetMapping("/list")
public TableDataInfo list(TcSafetyDanger tcSafetyDanger) {
startPage();
List<TcSafetyDanger> list = tcSafetyDangerService.selectTcSafetyDangerList(tcSafetyDanger);
return getDataTable(list);
}
/**
* 导出监管单位列表
*/
@PostMapping("/export")
public void export(HttpServletResponse response, TcSafetyDanger tcSafetyDanger) {
List<TcSafetyDanger> list = tcSafetyDangerService.selectTcSafetyDangerList(tcSafetyDanger);
ExcelUtil<TcSafetyDanger> util = new ExcelUtil<TcSafetyDanger>(TcSafetyDanger.class);
util.exportExcel(response, list, "监管单位数据");
}
/**
* 获取监管单位详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tcSafetyDangerService.selectTcSafetyDangerById(id));
}
/**
* 新增监管单位
*/
@PostMapping
public AjaxResult add(@RequestBody TcSafetyDanger tcSafetyDanger) {
return toAjax(tcSafetyDangerService.insertTcSafetyDanger(tcSafetyDanger));
}
/**
* 修改监管单位
*/
@PutMapping
public AjaxResult edit(@RequestBody TcSafetyDanger tcSafetyDanger) {
return toAjax(tcSafetyDangerService.updateTcSafetyDanger(tcSafetyDanger));
}
/**
* 删除监管单位
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(tcSafetyDangerService.deleteTcSafetyDangerByIds(ids));
}
}