|
|
|
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;
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.tcZz.domain.TcAqg;
|
|
|
|
import com.ruoyi.tcZz.domain.TcAqyh;
|
|
|
|
import com.ruoyi.tcZz.domain.TcSjlytj;
|
|
|
|
import com.ruoyi.tcZz.domain.TcSslx;
|
|
|
|
import com.ruoyi.tcZz.service.ITcSslxService;
|
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 涉事类型Controller
|
|
|
|
*
|
|
|
|
* @author ruoyi
|
|
|
|
* @date 2023-10-12
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@Api(tags = "涉事类型")
|
|
|
|
@RequestMapping("/tcZz/netWorkYq/sslx")
|
|
|
|
public class TcSslxController extends BaseController {
|
|
|
|
@Autowired
|
|
|
|
private ITcSslxService tcSslxService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询涉事类型列表
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "查询涉事类型列表", response = TcSslx.class)
|
|
|
|
@GetMapping("/list")
|
|
|
|
public TableDataInfo list(TcSslx tcSslx) {
|
|
|
|
startPage();
|
|
|
|
List<TcSslx> list = tcSslxService.selectTcSslxList(tcSslx);
|
|
|
|
return getDataTable(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导出涉事类型列表
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "导出涉事类型列表")
|
|
|
|
@PostMapping("/export")
|
|
|
|
public void export(HttpServletResponse response, TcSslx tcSslx) {
|
|
|
|
List<TcSslx> list = tcSslxService.selectTcSslxList(tcSslx);
|
|
|
|
ExcelUtil<TcSslx> util = new ExcelUtil<TcSslx>(TcSslx.class);
|
|
|
|
util.exportExcel(response, list, "涉事类型数据");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取涉事类型详细信息
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "获取涉事类型详细信息")
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
|
return success(tcSslxService.selectTcSslxById(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增涉事类型
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "新增涉事类型")
|
|
|
|
@PostMapping
|
|
|
|
public AjaxResult add(@RequestBody TcSslx tcSslx) {
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改涉事类型
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "修改涉事类型")
|
|
|
|
@PutMapping
|
|
|
|
public AjaxResult edit(@RequestBody TcSslx tcSslx) {
|
|
|
|
return toAjax(tcSslxService.updateTcSslx(tcSslx));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除涉事类型
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "删除涉事类型")
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
|
return toAjax(tcSslxService.deleteTcSslxByIds(ids));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导入
|
|
|
|
*/
|
|
|
|
@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();
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("通用下载excel模板")
|
|
|
|
@PostMapping("/importTemplate")
|
|
|
|
public void importTemplate(HttpServletResponse response)
|
|
|
|
{
|
|
|
|
ExcelUtil<TcSslx> util = new ExcelUtil<TcSslx>(TcSslx.class);
|
|
|
|
util.importTemplateExcel(response, " 涉事类型");
|
|
|
|
}
|
|
|
|
}
|