From 7ef4892f9f24f941aca37e6b3991b808a0aca619 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期五, 08 九月 2023 11:16:35 +0800
Subject: [PATCH] 优化
---
ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java | 58 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
index 2806951..9bd7c85 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
@@ -12,6 +12,7 @@
import com.ycl.controller.BaseController;
import com.ycl.entity.cockpitManage.TeamConstruction;
import com.ycl.service.cockpitManage.ITeamConstructionService;
+import com.ycl.utils.EasyExcelUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -24,7 +25,7 @@
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
/**
* <p>
@@ -58,27 +59,28 @@
return CommonResult.success(iTeamConstructionService
.page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>()
.like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
- .eq( status != null, TeamConstruction::getStatus, status)
- .eq(TeamConstruction::getIsDelete, isDelete)));
+ .eq(status != null, TeamConstruction::getStatus, status)
+ .eq(TeamConstruction::getIsDelete, isDelete)
+ .orderByDesc(TeamConstruction::getId)));
}
@PostMapping("/addition")
@ApiOperation("娣诲姞")
- @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "娣诲姞")
+ @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "娣诲姞")
public CommonResult add(@RequestBody TeamConstruction teamConstruction) {
return CommonResult.success(iTeamConstructionService.save(teamConstruction));
}
@PutMapping("/modification")
@ApiOperation("淇敼")
- @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "淇敼")
+ @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "淇敼")
public CommonResult modify(@RequestBody TeamConstruction teamConstruction) {
return CommonResult.success(iTeamConstructionService.updateById(teamConstruction));
}
@DeleteMapping("/deletion")
@ApiOperation("鍒犻櫎")
- @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "鍒犻櫎")
+ @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "鍒犻櫎")
public CommonResult delete(@RequestParam Long id) {
Integer isDelete = 1;
TeamConstruction teamConstruction = new TeamConstruction();
@@ -87,44 +89,42 @@
return CommonResult.success(iTeamConstructionService.updateById(teamConstruction));
}
+ @ApiOperation(value = "鎵归噺鍒犻櫎杩濊绫诲瀷")
+ @DeleteMapping("/batch_delete")
+ @LogSave(operationType = "杩愯惀鍩虹璁剧疆", contain = "鎵归噺鍒犻櫎杩濊浜嬮」")
+ public CommonResult removeViolations(@RequestParam Long[] ids) {
+
+ return CommonResult.success(iTeamConstructionService.removeBatchByIds(Arrays.asList(ids)));
+ }
+
@PostMapping("/export")
@ApiOperation("瀵煎嚭")
- @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "瀵煎嚭")
+ @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "瀵煎嚭")
@ApiImplicitParams(
{
- @ApiImplicitParam(name = "size", required = true, value = "椤甸潰鏁伴噺"),
- @ApiImplicitParam(name = "current", required = true, value = "椤电爜"),
@ApiImplicitParam(name = "departName", value = "閮ㄩ棬鍚嶇О"),
@ApiImplicitParam(name = "status", value = "鐘舵��")}
)
@SneakyThrows
- public void export(@RequestParam() Integer size,
- @RequestParam() Integer current,
- @RequestParam(name = "departName", required = false) String departName,
- @RequestParam(name = "status", required = false) Integer status,
- HttpServletResponse response) {
+ public void export(
+ @RequestParam(name = "departName", required = false) String departName,
+ @RequestParam(name = "status", required = false) Integer status,
+ HttpServletResponse response) {
Integer isDelete = 0;
- response.setContentType("application/vnd.ms-excel");
- response.setCharacterEncoding("utf-8");
- response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx");
- EasyExcel
- .write(response.getOutputStream(), TeamConstruction.class)
- .sheet("鏁版嵁")
- .doWrite(iTeamConstructionService
- .page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>()
- .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
- .eq(status != null, TeamConstruction::getStatus, status)
- .eq(TeamConstruction::getIsDelete, isDelete))
- .getRecords());
-
+ String sheetName = "鏁版嵁";
+ EasyExcelUtils.export(response, sheetName, TeamConstruction.class, iTeamConstructionService
+ .list(new LambdaQueryWrapper<TeamConstruction>()
+ .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
+ .eq(status != null, TeamConstruction::getStatus, status)
+ .eq(TeamConstruction::getIsDelete, isDelete)));
}
@PostMapping("/import")
@ApiOperation("瀵煎叆")
@SneakyThrows
- @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "瀵煎叆")
- public CommonResult export(MultipartFile multipartFile) {
+ @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "瀵煎叆")
+ public CommonResult export(@RequestParam("file") MultipartFile multipartFile) {
EasyExcel.read(multipartFile.getInputStream(), TeamConstruction.class, new ReadListener() {
@Override
public void invoke(Object o, AnalysisContext analysisContext) {
--
Gitblit v1.8.0