diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java
index 42d89b3..eb67ad9 100644
--- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java
+++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java
@@ -17,4 +17,10 @@ public class ParamDto {
@ApiModelProperty(value = "id")
private String id;
+
+ @ApiModelProperty(value = "班组名称")
+ private String teamName;
+
+ @ApiModelProperty(value = "班组长")
+ private String teamLeader;
}
diff --git a/securitycontrol-model/securitycontrol-background/pom.xml b/securitycontrol-model/securitycontrol-background/pom.xml
index 8adf2d9..2952cbc 100644
--- a/securitycontrol-model/securitycontrol-background/pom.xml
+++ b/securitycontrol-model/securitycontrol-background/pom.xml
@@ -93,6 +93,44 @@
com.securitycontrol
securitycontrol-commons-entity
+
+
+ cn.afterturn
+ easypoi-base
+ 4.2.0
+
+
+ com.google.guava
+ guava
+
+
+
+
+ cn.afterturn
+ easypoi-web
+ 4.2.0
+
+
+ cn.afterturn
+ easypoi-annotation
+ 4.2.0
+
+
+ com.google.guava
+ guava
+ 20.0
+
+
+ org.apache.poi
+ poi
+ 4.1.2
+
+
+ org.freemarker
+ freemarker
+ 2.3.30
+
+
${project.artifactId}
diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java
new file mode 100644
index 0000000..6fb4206
--- /dev/null
+++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java
@@ -0,0 +1,68 @@
+package com.securitycontrol.background.controller;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
+import com.securitycontrol.background.export.entity.TeamExportVo;
+import com.securitycontrol.background.export.util.ExcelStyleUtil;
+import com.securitycontrol.background.service.TeamService;
+import com.securitycontrol.common.log.annotation.Log;
+import com.securitycontrol.common.log.enums.OperationType;
+import com.securitycontrol.entity.background.dto.ParamDto;
+import com.securitycontrol.entity.background.vo.TeamManageVo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.BeanUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @author:cwchen
+ * @date:2024-03-11-14:55
+ * @version:1.0
+ * @description:导出文件-web层
+ */
+@RestController
+@RequestMapping("/back/export/")
+@Slf4j
+public class ExportFileController {
+
+ @Resource(name = "TeamService")
+ private TeamService service;
+
+ @GetMapping("exportTeamData")
+ @Log(title = "人车管理", menu = "人车管理->班组管理", grade = OperationType.EXPORT_BUSINESS, details = "导出班组", type = "业务日志")
+ public void exportData(HttpServletRequest request, HttpServletResponse response, ParamDto dto) {
+ try {
+ List teamExportVoList = new ArrayList<>();
+ List teamLists = service.getTeamLists(dto);
+ for (int i = 0; i < teamLists.size(); i++) {
+ teamLists.get(i).setTeamId((i + 1) + "");
+ TeamExportVo exportVo = new TeamExportVo();
+ BeanUtils.copyProperties(teamLists.get(i), exportVo);
+ teamExportVoList.add(exportVo);
+ }
+ ExportParams exportParams = new ExportParams("班组列表", "班组列表", ExcelType.XSSF);
+ exportParams.setStyle(ExcelStyleUtil.class);
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TeamExportVo.class, teamExportVoList);
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("班组列表" + ".xlsx", "UTF-8"));
+ ServletOutputStream outputStream = response.getOutputStream();
+ workbook.write(outputStream);
+ outputStream.close();
+ workbook.close();
+ } catch (Exception e) {
+ log.error("导出班组", e);
+ }
+ }
+}
diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/entity/TeamExportVo.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/entity/TeamExportVo.java
new file mode 100644
index 0000000..0a59b50
--- /dev/null
+++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/entity/TeamExportVo.java
@@ -0,0 +1,29 @@
+package com.securitycontrol.background.export.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author:cwchen
+ * @date:2024-03-12-14:21
+ * @version:1.0
+ * @description:班组导出-vo
+ */
+@Data
+public class TeamExportVo {
+
+ @Excel(name = "序号", width = 10.0, orderNum = "0")
+ private String teamId;
+
+ @Excel(name = "所属工程", width = 20.0, orderNum = "1")
+ private String proName;
+
+ @Excel(name = "班组名称", width = 20.0, orderNum = "2")
+ private String teamName;
+
+ @Excel(name = "班组长", width = 20.0, orderNum = "3")
+ private String teamLeader;
+
+}
diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/util/ExcelStyleUtil.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/util/ExcelStyleUtil.java
new file mode 100644
index 0000000..3212b86
--- /dev/null
+++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/export/util/ExcelStyleUtil.java
@@ -0,0 +1,198 @@
+package com.securitycontrol.background.export.util;
+
+import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
+import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams;
+import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler;
+import org.apache.poi.ss.usermodel.*;
+
+/**
+ * @author 10488
+ * @Auther: ccw
+ * @Date: 2022/05/12/16:22
+ * @description: easypoi 导出表格样式
+ */
+public class ExcelStyleUtil implements IExcelExportStyler {
+ private static final short STRING_FORMAT = (short) BuiltinFormats.getBuiltinFormat("TEXT");
+ private static final short FONT_SIZE_TEN = 10;
+ private static final short FONT_SIZE_ELEVEN = 11;
+ private static final short FONT_SIZE_TWELVE = 12;
+
+ /**
+ * 大标题样式
+ */
+ private CellStyle headerStyle;
+
+ /**
+ * 每列标题样式
+ */
+ private CellStyle titleStyle;
+
+ /**
+ * 数据行样式
+ */
+ private CellStyle styles;
+
+ public ExcelStyleUtil(Workbook workbook) {
+ this.init(workbook);
+ }
+
+ /**
+ * 初始化样式
+ *
+ * @param workbook
+ */
+ private void init(Workbook workbook) {
+ this.headerStyle = initHeaderStyle(workbook);
+ this.titleStyle = initTitleStyle(workbook);
+ this.styles = initStyles(workbook);
+ }
+
+ /**
+ * 大标题样式
+ *
+ * @param color
+ * @return
+ */
+
+ @Override
+ public CellStyle getHeaderStyle(short color) {
+ return headerStyle;
+ }
+
+ /**
+ * 每列标题样式
+ *
+ * @param color
+ * @return
+ */
+
+ @Override
+ public CellStyle getTitleStyle(short color) {
+ return titleStyle;
+ }
+
+ /**
+ * 数据行样式
+ *
+ * @param parity 可以用来表示奇偶行
+ * @param entity 数据内容
+ * @return 样式
+ */
+
+ @Override
+
+ public CellStyle getStyles(boolean parity, ExcelExportEntity entity) {
+ return styles;
+ }
+
+ /**
+ * 获取样式方法
+ *
+ * @param dataRow 数据行
+ * @param obj 对象
+ * @param data 数据
+ */
+
+ @Override
+
+ public CellStyle getStyles(Cell cell, int dataRow, ExcelExportEntity entity, Object obj, Object data) {
+ return getStyles(true, entity);
+ }
+
+ /**
+ * 模板使用的样式设置
+ */
+
+ @Override
+ public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams) {
+ return null;
+ }
+
+ /**
+ * 初始化--大标题样式
+ *
+ * @param workbook
+ * @return
+ */
+
+ private CellStyle initHeaderStyle(Workbook workbook) {
+ CellStyle style = getBaseCellStyle(workbook);
+ style.setFont(getFont(workbook, FONT_SIZE_TWELVE, true));
+ return style;
+ }
+
+ /**
+ * 初始化--每列标题样式
+ *
+ * @param workbook
+ * @return
+ */
+
+ private CellStyle initTitleStyle(Workbook workbook) {
+ CellStyle style = getBaseCellStyle(workbook);
+ style.setFont(getFont(workbook, FONT_SIZE_ELEVEN, false));
+ //背景色
+ style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+ style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+ return style;
+
+ }
+
+ /**
+ * 初始化--数据行样式
+ *
+ * @param workbook
+ * @return
+ */
+ private CellStyle initStyles(Workbook workbook) {
+ CellStyle style = getBaseCellStyle(workbook);
+ style.setFont(getFont(workbook, FONT_SIZE_TEN, false));
+ style.setDataFormat(STRING_FORMAT);
+ return style;
+ }
+
+ /**
+ * 基础样式
+ *
+ * @return
+ */
+
+ private CellStyle getBaseCellStyle(Workbook workbook) {
+ CellStyle style = workbook.createCellStyle();
+ //下边框
+ style.setBorderBottom(BorderStyle.THIN);
+ //左边框
+ style.setBorderLeft(BorderStyle.THIN);
+ //上边框
+ style.setBorderTop(BorderStyle.THIN);
+ //右边框
+ style.setBorderRight(BorderStyle.THIN);
+ //水平居中
+ style.setAlignment(HorizontalAlignment.CENTER);
+ //上下居中
+ style.setVerticalAlignment(VerticalAlignment.CENTER);
+ //设置自动换行
+ style.setWrapText(true);
+ return style;
+ }
+
+ /**
+ * 字体样式
+ *
+ * @param size 字体大小
+ * @param isBold 是否加粗
+ * @return
+ */
+
+ private Font getFont(Workbook workbook, short size, boolean isBold) {
+ Font font = workbook.createFont();
+ //字体样式
+ font.setFontName("宋体");
+ //是否加粗
+ font.setBold(isBold);
+ //字体大小
+ font.setFontHeightInPoints(size);
+ return font;
+ }
+}
+
diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml
index 4bf0e53..ecb2b49 100644
--- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml
+++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml
@@ -57,10 +57,11 @@
FROM tb_work_team twt
LEFT JOIN tb_project tp on twt.bid_code = tp.bid_code
-
- AND (
- INSTR(twt.team_leader,#{keyWord}) > 0
- )
+
+ AND INSTR(twt.team_name,#{teamName}) > 0
+
+
+ AND INSTR(twt.team_leader,#{teamLeader}) > 0