From fc7eb24fda4b7942209a2aa23bbf7e531fa4e69f Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 25 Dec 2023 09:25:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=BC=94=E7=BB=83=E8=AE=B0=E5=BD=95=E8=A1=A8=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service-api/safeproduct-api/pom.xml | 5 +++++ .../hzims/safeproduct/entity/RehearsalRecordEntity.java | 13 +++++++++++++ .../service/impl/RehearsalRecordServiceImpl.java | 17 ----------------- .../safeproduct/src/main/resources/db/1.0.1.sql | 1 + 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/hzims-service-api/safeproduct-api/pom.xml b/hzims-service-api/safeproduct-api/pom.xml index 5cec7fd..b8843ad 100644 --- a/hzims-service-api/safeproduct-api/pom.xml +++ b/hzims-service-api/safeproduct-api/pom.xml @@ -15,6 +15,11 @@ org.springblade blade-system-api + + + com.alibaba + easyexcel + jar diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java index 6d027ea..28d15e8 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java @@ -1,5 +1,7 @@ package com.hnac.hzims.safeproduct.entity; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -19,40 +21,48 @@ import java.util.Date; */ @Data @EqualsAndHashCode(callSuper = true) +@ExcelIgnoreUnannotated @TableName("hzims_rehearsal_record") @ApiModel(value = "演练记录实体类") public class RehearsalRecordEntity extends BaseEntity { @Size(max = 50, message = "编码字段长度不能超过50") @ApiModelProperty("编码") + @ExcelProperty(value = "编码", index = 0) private String code; @NotNull @Size(max = 50, message = "单位字段长度不能超过50") @ApiModelProperty("单位") + @ExcelProperty(value = "单位", index = 1) private String unit; @NotNull @Size(max = 50, message = "演练科目字段长度不能超过50") @ApiModelProperty("演练科目") + @ExcelProperty(value = "演练科目", index = 2) private String subject; @NotNull @ApiModelProperty("演练计划开始时间") + @ExcelProperty(value = "演练计划开始时间", index = 3) private Date scheduledStartTime; @NotNull @ApiModelProperty("演练计划结束时间") + @ExcelProperty(value = "演练计划结束时间", index = 4) private Date scheduledEndTime; @NotNull @Size(max = 255, message = "演练地点字段长度不能超过255") @ApiModelProperty("演练地点") + @ExcelProperty(value = "演练地点", index = 5) private String location; @Min(value = 0, message = "参演人数不能小于0") @Max(value = 1000, message = "参演人数字段长度超出限制范围") @ApiModelProperty("参演人数") + @ExcelProperty(value = "参演人数", index = 6) private Integer peopleNum; @Size(max = 5000, message = "参演人员字段长度超出限制范围") @@ -65,9 +75,11 @@ public class RehearsalRecordEntity extends BaseEntity { private String commander; @ApiModelProperty("演练实际开始时间") + @ExcelProperty(value = "演练实际开始时间", index = 7) private Date actualStartTime; @ApiModelProperty("演练实际结束时间") + @ExcelProperty(value = "演练实际结束时间", index = 8) private Date actualEndTime; @Size(max = 250, message = "演练记录字段长度不能超过250") @@ -85,6 +97,7 @@ public class RehearsalRecordEntity extends BaseEntity { @NotNull @Size(max = 20, message = "演练状态字段长度不能超过20") @ApiModelProperty("演练状态") + @ExcelProperty(value = "演练状态", index = 9) private String rehearsalStatus; @Size(max = 1000, message = "演练图片字段长度不能超过1000") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 0d8d844..f1aa1e8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -207,24 +207,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl excludeColumnFiledNames = new HashSet<>(); - excludeColumnFiledNames.add("peopleName"); - excludeColumnFiledNames.add("commander"); - excludeColumnFiledNames.add("record"); - excludeColumnFiledNames.add("comment"); - excludeColumnFiledNames.add("rehearsalMethod"); - excludeColumnFiledNames.add("imgPath"); - excludeColumnFiledNames.add("filePath"); - excludeColumnFiledNames.add("id"); - excludeColumnFiledNames.add("createUser"); - excludeColumnFiledNames.add("createDept"); - excludeColumnFiledNames.add("createTime"); - excludeColumnFiledNames.add("updateUser"); - excludeColumnFiledNames.add("updateTime"); - excludeColumnFiledNames.add("status"); - excludeColumnFiledNames.add("isDeleted"); WriteSheet writeSheet = EasyExcel.writerSheet(1, "演练记录表").head(RehearsalRecordEntity.class) - .excludeColumnFiledNames(excludeColumnFiledNames) .build(); excelWriter.write(rehearsalRecordList, writeSheet); excelWriter.finish(); diff --git a/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql index 4138082..d729081 100644 --- a/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql @@ -20,6 +20,7 @@ CREATE TABLE `hzims`.`hzims_rehearsal_record` ( `scheduled_end_time` datetime NOT NULL COMMENT '演练计划结束时间', `location` varchar(255) NOT NULL COMMENT '演练地点', `people_num` int(10) NOT NULL DEFAULT '0' COMMENT '参演人数', + `people_name` varchar(5000) DEFAULT '' COMMENT '参演人员', `commander` varchar(10) NOT NULL COMMENT '总指挥', `actual_start_time` datetime DEFAULT NULL COMMENT '演练实际开始时间', `actual_end_time` datetime DEFAULT NULL COMMENT '演练实际结束时间',