zhanghua
2022-11-28 a4047b6048ebfe09e66a765b58ea12b5bd0e2e6e
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,6 @@
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
 * <p>
@@ -58,27 +58,27 @@
        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(status != null, TeamConstruction::getStatus, status)
                        .eq(TeamConstruction::getIsDelete, isDelete)));
    }
    @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();
@@ -89,7 +89,7 @@
    @PostMapping("/export")
    @ApiOperation("导出")
    @LogSave(operationType = "队伍建设管理",contain = "导出")
    @LogSave(operationType = "队伍建设管理", contain = "导出")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "size", required = true, value = "页面数量"),
@@ -104,26 +104,20 @@
                       @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
                .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());
    }
    @PostMapping("/import")
    @ApiOperation("导入")
    @SneakyThrows
    @LogSave(operationType = "队伍建设管理",contain = "导入")
    @LogSave(operationType = "队伍建设管理", contain = "导入")
    public CommonResult export(MultipartFile multipartFile) {
        EasyExcel.read(multipartFile.getInputStream(), TeamConstruction.class, new ReadListener() {
            @Override