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/TcSslxController.java

142 lines
4.3 KiB

2 years ago
package com.ruoyi.tcZz.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
2 years ago
import com.ruoyi.common.core.page.TableDataInfo;
2 years ago
import com.ruoyi.common.enums.BusinessType;
2 years ago
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.tcZz.domain.TcAqg;
1 year ago
import com.ruoyi.tcZz.domain.TcAqyh;
2 years ago
import com.ruoyi.tcZz.domain.TcSjlytj;
2 years ago
import com.ruoyi.tcZz.domain.TcSslx;
import com.ruoyi.tcZz.service.ITcSslxService;
2 years ago
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 org.springframework.web.multipart.MultipartFile;
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/netWorkYq/sslx")
2 years ago
public class TcSslxController extends BaseController {
2 years ago
@Autowired
private ITcSslxService tcSslxService;
/**
*
*/
2 years ago
@ApiOperation(value = "查询涉事类型列表", response = TcSslx.class)
2 years ago
@GetMapping("/list")
2 years ago
public TableDataInfo list(TcSslx tcSslx) {
2 years ago
startPage();
List<TcSslx> list = tcSslxService.selectTcSslxList(tcSslx);
return getDataTable(list);
}
/**
*
*/
2 years ago
@ApiOperation(value = "导出涉事类型列表")
2 years ago
@PostMapping("/export")
2 years ago
public void export(HttpServletResponse response, TcSslx tcSslx) {
2 years ago
List<TcSslx> list = tcSslxService.selectTcSslxList(tcSslx);
ExcelUtil<TcSslx> util = new ExcelUtil<TcSslx>(TcSslx.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(tcSslxService.selectTcSslxById(id));
}
/**
*
*/
2 years ago
@ApiOperation(value = "新增涉事类型")
2 years ago
@PostMapping
2 years ago
public AjaxResult add(@RequestBody TcSslx tcSslx) {
1 year ago
TcSslx newtcSslx=new TcSslx();
newtcSslx.setName(tcSslx.getName());
List<TcSslx> list = tcSslxService.selectTcSslxList(newtcSslx);
if (!list.isEmpty()){
for (TcSslx a :list) {
tcSslx.setId(a.getId());
tcSslxService.updateTcSslx(tcSslx);
}
}else {
tcSslxService.insertTcSslx(tcSslx);
}
return AjaxResult.success();
2 years ago
}
/**
*
*/
2 years ago
@ApiOperation(value = "修改涉事类型")
2 years ago
@PutMapping
2 years ago
public AjaxResult edit(@RequestBody TcSslx tcSslx) {
2 years ago
return toAjax(tcSslxService.updateTcSslx(tcSslx));
}
/**
*
*/
2 years ago
@ApiOperation(value = "删除涉事类型")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
2 years ago
return toAjax(tcSslxService.deleteTcSslxByIds(ids));
}
2 years ago
/**
*
*/
@ApiOperation("通用导入excel信息")
@PostMapping("/common/importExcel")
public AjaxResult importExcel(MultipartFile file) throws Exception {
ExcelUtil<TcSslx> util = new ExcelUtil<TcSslx>(TcSslx.class);
List<TcSslx> tcSslxList = util.importExcel(file.getInputStream());
tcSslxService.importUser(tcSslxList);
return AjaxResult.success();
}
/**
*
*
* @param isStatus
* @return
*/
@ApiOperation("批量启用禁用")
@GetMapping("/isStatus")
public AjaxResult isStatus(@RequestParam("isStatus") Integer isStatus, @RequestParam("ids") List<String> ids) {
tcSslxService.updateByisStatus(isStatus,ids);
return AjaxResult.success();
}
2 years ago
@ApiOperation("通用下载excel模板")
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<TcSslx> util = new ExcelUtil<TcSslx>(TcSslx.class);
util.importTemplateExcel(response, " 涉事类型");
}
2 years ago
}