EasyExcel注解使用
上接《Springboot下导入导出excel》,本篇详细介绍 EasyExcel 注解使用。
1. @ExcelProperty
- value:指定写入的列头,如果不指定则使用成员变量的名字作为列头;如果要设置复杂的头,可以为value指定多个值
- order:优先级高于- value,会根据- order的顺序来匹配实体和excel中数据的顺序
- index:优先级高于- value和- order,指定写到第几列,如果不指定则根据成员变量位置排序;默认第一个字段就是- index=0
- converter:指定当前字段用什么转换器,默认会自动选择。可以用来设置类型转换器,需要实现- Converter接口
1.1 value
默认情况下,使用类的属性名作为Excel的列表,当然也可以使用 @ExcelProperty 注解来重新指定属性名称。
public class Student {@ExcelProperty(value = "姓名")String name;@ExcelProperty(value = "年龄")Integer age;@ExcelProperty(value = "出生日期")String birthday;@ExcelProperty(value = "分数")Double score;
}

1.1.1 表头合并
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"})String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;
}

1.2 index
如果不指定则按照属性在类中的排列顺序来。index 是指定该属性在Excel中列的下标,下标从 0 开始。
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"}, index = 2)String name;@ExcelProperty(value = {"用户基本信息", "年龄"}, index = 1)Integer age;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数", index = 10)Double score;
}

1.3 order
order 的默认值为 Integer.MAX_VALUE,通过效果我们可以得出结论:order值越小,越排在前面
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"}, order = 5)Integer age;@ExcelProperty(value = {"用户基本信息", "出生日期"}, order = 6)String birthday;@ExcelProperty(value = "分数")Double score;
}

✨⚠️注意:
- 优先级:index > order > 默认配置
- index相当于绝对位置,下标从0开始
- order相当于相对位置,值越小的排在越前面
1.4 convert
在读写EXCEL时,有时候需要我们进行数据类型转换,例如我们这里的创建时间,在实体对象中是 Long 类型,但是这样直接导出到Excel中不太直观。我们需要转换成 yyyy-MM-dd HH:mm:ss 格式,此时我们就可以用到转换器。
📝DateTimeConverter:
public class DateTimeConverter implements Converter<Long> {private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");// 支持导入的Java类型@Overridepublic Class<?> supportJavaTypeKey() {return Long.class;}// 支持导出的Excel类型@Overridepublic CellDataTypeEnum supportExcelTypeKey() {return CellDataTypeEnum.STRING;}// 转换为Java@Overridepublic Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {return null;}// 转换为Excel@Overridepublic WriteCellData<?> convertToExcelData(Long value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {if (value == null) {return new WriteCellData(CellDataTypeEnum.STRING, null);}LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(value), ZoneId.systemDefault());String dateStr = localDateTime.format(dateTimeFormatter);return new WriteCellData(dateStr);}
}
- supportJavaTypeKey:导入的Java类型
- supportExcelTypeKey:导出的Excel类型,返回- CellDataTypeEnum类型。
- convertToJavaData:导入转换逻辑。
- convertToExcelData:导出转换逻辑,返回- WriteCellData类型。
📝Student:
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

1.4.1 枚举转换
📝GenderEnum:
/*** 性别枚举*/
@Getter
@AllArgsConstructor
public enum GenderEnum {UNKNOWN(0, "未知"),MALE(1, "男性"),FEMALE(2, "女性");private final Integer value;private final String description;public static GenderEnum convert(Integer value) {return Stream.of(values()).filter(bean -> bean.value.equals(value)).findAny().orElse(UNKNOWN);}public static GenderEnum convert(String description) {return Stream.of(values()).filter(bean -> bean.description.equals(description)).findAny().orElse(UNKNOWN);}
}
Stream.of(values()) 是 Java 8 中 Stream API 的一种用法,用于将枚举类型的 values() 方法返回的数组转换为一个流。这样可以方便地对枚举常量进行各种操作,如过滤、映射等。
- 每个枚举类型都有一个隐式的
values()方法,该方法返回一个包含所有枚举常量的数组。
Stream.of(T... values)是一个静态方法,它接受一个可变参数列表,并返回一个包含这些元素的流。当你将values()方法的结果传递给Stream.of时,它会将枚举常量数组转换为一个流。- 使用
findAny()找到第一个匹配的枚举常量,如果没有找到匹配的枚举常量,则返回 UNKNOWN。
📝GenderConverter:
public class GenderConverter implements Converter<Integer> {// 支持导入的Java类型@Overridepublic Class<?> supportJavaTypeKey() {return Integer.class;}// 支持导出的Excel类型@Overridepublic CellDataTypeEnum supportExcelTypeKey() {return CellDataTypeEnum.STRING;}// 转换为Java@Overridepublic Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {return GenderEnum.convert(cellData.getStringValue()).getValue();}// 转换为Excel@Overridepublic WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {return new WriteCellData(GenderEnum.convert(value).getDescription());}
}

2. @ExcelIgnore
默认所有字段都会和excel去匹配,加了这个注解会忽略该字段
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)@ExcelIgnoreInteger gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

3. @ExcelIgnoreUnannotated
修饰类,如果类不标注该注解时,默认类中所有成员变量都会参与读写,无论是否在成员变量上加了 @ExcelProperty 的注解。标注该注解后,类中的成员变量如果没有标注 @ExcelProperty 注解将不会参与读写。
@Data
@NoArgsConstructor
@AllArgsConstructor
@ExcelIgnoreUnannotated
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;Integer gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

4. @HeadRowHeight
修饰类,指定列头行高
@Data
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(80)
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)@ExcelIgnoreInteger gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

5. @HeadStyle
设置标题样式
| 属性 | 描述 | 
|---|---|
| dataFormat | 日期格式 | 
| hidden | 设置单元格使用此样式隐藏 | 
| locked | 设置单元格使用此样式锁定 | 
| quotePrefix | 在单元格前面增加 '单引号,数字或公式将以字符串形式展示 | 
| horizontalAlignment | 设置是否水平居中 | 
| wrapped | 设置文本是否应换行。将此标志设置为true通过在多行上显示使单元格中的所有内容可见 | 
| verticalAlignment | 设置是否垂直居中 | 
| rotation | 设置单元格中文本旋转角度。03版本的Excel旋转角度区间为-90°90°,07版本的Excel旋转角度区间为0°180° | 
| indent | 设置单元格中缩进文本的空格数 | 
| borderLeft | 设置左边框的样式 | 
| borderRight | 设置右边框样式 | 
| borderTop | 设置上边框样式 | 
| borderBottom | 设置下边框样式 | 
| leftBorderColor | 设置左边框颜色 | 
| rightBorderColor | 设置右边框颜色 | 
| topBorderColor | 设置上边框颜色 | 
| bottomBorderColor | 设置下边框颜色 | 
| fillPatternType | 设置填充类型 | 
| fillBackgroundColor | 设置背景色 | 
| fillForegroundColor | 设置前景色 | 
| shrinkToFit | 设置自动单元格自动大小 | 
@Data
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(80)
@HeadStyle(fillForegroundColor = 10, fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, wrapped = BooleanEnum.TRUE)
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)@ExcelIgnoreInteger gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

6. @HeadFontStyle
设置标题字体格式
| 属性 | 描述 | 
|---|---|
| fontName | 设置字体名称 | 
| fontHeightInPoints | 设置字体高度 | 
| italic | 设置字体是否斜体 | 
| strikeout | 是否设置删除线 | 
| color | 设置字体颜色 | 
| typeOffset | 设置偏移量 | 
| underline | 设置下划线 | 
| charset | 设置字体编码 | 
| bold | 设置字体是否加粗 | 
@Data
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(80)
@HeadStyle(fillForegroundColor = 10, fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, wrapped = BooleanEnum.TRUE)
@HeadFontStyle(fontHeightInPoints = 10, color = 5)
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)@ExcelIgnoreInteger gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

✨💎注:如果需要自定义样式,可以通过继承 AbstractCellStyleStrategy 类(public abstract class AbstractCellStyleStrategy implements CellWriteHandler),实现其setHeadCellStyle 和 setContentCellStyle 方法可以自定义设置表头和单元格内容样式。
参见📖 Easyexcel(7-自定义样式)
7. @ContentRowHeight
修饰类,指定内容行高
@Data
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(80)
@HeadStyle(fillForegroundColor = 10, fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, wrapped = BooleanEnum.TRUE)
@HeadFontStyle(fontHeightInPoints = 10, color = 5)
@ContentRowHeight(value = 30)
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)@ExcelIgnoreInteger gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

8. @ColumnWidth
设置表格列的宽度
@Data
@NoArgsConstructor
@AllArgsConstructor
@HeadRowHeight(80)
@HeadStyle(fillForegroundColor = 10, fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, wrapped = BooleanEnum.TRUE)
@HeadFontStyle(fontHeightInPoints = 10, color = 5)
@ContentRowHeight(value = 30)
public class Student {@ExcelProperty(value = {"用户基本信息", "姓名"} )String name;@ExcelProperty(value = {"用户基本信息", "年龄"})Integer age;@ColumnWidth(25)@ExcelProperty(value = {"用户基本信息", "性别"}, converter = GenderConverter.class)Integer gender;@ExcelProperty(value = {"用户基本信息", "出生日期"})String birthday;@ExcelProperty(value = "分数")Double score;@ExcelProperty(value = "创建时间", converter = DateTimeConverter.class)private Long createTime;
}

9. @ContentStyle
设置内容格式注解,和 @HeadStyle 属性一致。
| 属性 | 描述 | 
|---|---|
| dataFormat | 日期格式 | 
| hidden | 设置单元格使用此样式隐藏 | 
| locked | 设置单元格使用此样式锁定 | 
| quotePrefix | 在单元格前面增加`符号,数字或公式将以字符串形式展示 | 
| horizontalAlignment | 设置是否水平居中 | 
| wrapped | 设置文本是否应换行。将此标志设置为true通过在多行上显示使单元格中的所有内容可见 | 
| verticalAlignment | 设置是否垂直居中 | 
| rotation | 设置单元格中文本旋转角度。03版本的Excel旋转角度区间为-90°90°,07版本的Excel旋转角度区间为0°180° | 
| indent | 设置单元格中缩进文本的空格数 | 
| borderLeft | 设置左边框的样式 | 
| borderRight | 设置右边框样式 | 
| borderTop | 设置上边框样式 | 
| borderBottom | 设置下边框样式 | 
| leftBorderColor | 设置左边框颜色 | 
| rightBorderColor | 设置右边框颜色 | 
| topBorderColor | 设置上边框颜色 | 
| bottomBorderColor | 设置下边框颜色 | 
| fillPatternType | 设置填充类型 | 
| fillBackgroundColor | 设置背景色 | 
| fillForegroundColor | 设置前景色 | 
| shrinkToFit | 设置自动单元格自动大小 | 
注解 @HeadStyle 的属性 dataFormat 没有说明,在此处说明一下。@ContentStyle 注解的 dataFormat 属性可以接受一个整数,该整数对应于 Excel 的预定义格式代码。
常见值:
- 0 或 General:通用格式
- 1:数字格式(0.00)
- 2:货币格式(#,##0.00_); (#,##0.00)
- 9:百分比格式(0%)
- 20:日期格式(yyyy-mm-dd)
- 21:日期格式(mm/dd/yyyy)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {@ExcelProperty("字符串标题")private String string;@ExcelProperty("日期标题 (yyyy-mm-dd)")@ContentStyle(dataFormat = 22) // yyyy-mm-dd 格式private Date date;@ExcelProperty("百分比标题")@ContentStyle(dataFormat = 9) // 百分比格式private Double percentage;@ExcelProperty("货币标题")@ContentStyle(dataFormat = 2) // 货币格式private Double currency;
}
public static void exportExcel(String fileName) {// 写入数据List<Student> data = new ArrayList<>();data.add(new Student("张三", new Date(), 0.2, 100.25));data.add(new Student("李四", new Date(), 0.35, 200.0));data.add(new Student("李丽", new Date(), 0.27, 345.5));data.add(new Student("王二", new Date(), 0.65, 123458.9));// 创建写入对象EasyExcel.write(fileName, Student.class).sheet("学生信息").doWrite(data);
}

10. @ContentFontStyle
设置单元格内容字体格式,和 @HeadFontStyle 属性一致。
| 属性 | 描述 | 
|---|---|
| fontName | 设置字体名称 | 
| fontHeightInPoints | 设置字体高度 | 
| italic | 设置字体是否斜体 | 
| strikeout | 是否设置删除线 | 
| color | 设置字体颜色 | 
| typeOffset | 设置偏移量 | 
| underline | 设置下划线 | 
| charset | 设置字体编码 | 
| bold | 设置字体是否加粗 | 
✨💎注:如果需要自定义样式,可以通过继承 AbstractCellStyleStrategy (public abstract class AbstractCellStyleStrategy implements CellWriteHandler)类,实现其setHeadCellStyle 和 setContentCellStyle 方法可以自定义设置表头和单元格内容样式
11. @ContentLoopMerge
修饰字段,设置合并单元格的注解。
| 属性 | 描述 | 
|---|---|
| eachRow | 合并列 | 
| columnExtend | 合并行 | 
12. @OnceAbsoluteMerge
修饰类,用于指定位置的单元格合并。
| 属性 | 描述 | 
|---|---|
| firstRowIndex | 第一行下标 | 
| lastRowIndex | 最后一行下标 | 
| firstColumnIndex | 第一列下标 | 
| lastColumnIndex | 最后一列下标 | 
13. @DateTimeFormat
日期转换,value参照 java.text.SimpleDateFormat
14. @NumberFormat
数字转换,value参照java.text.DecimalFormat
15. 日期、数字导出方式
实际导出Excel会要求导出格式,整理以下4种方式。
15.1 注解@ContentStyle
15.2 注解@DateTimeFormat、@DateTimeFormat
15.3 自定义Converter
自定义Converter,重写convertToExcelData,实现转换;实体类成员变量的注解上增加 @ExcelProterty(value = “工作时间”,converter = DateConverter.class)
15.4 自定义CellWriteHandler
自定义CellWriteHandler,重写afterCellDispose,可以自定义内容样式、值等,自由度更高。构建Excel的时候,注册到处理类
 EasyExcel.write(fileName, Student.class)
 .registerWriteHandler(new SimpleColumnWidthStyleStrategy(15)) // 设置列宽策略
 .registerWriteHandler(new CustomCellWriteHandler()) // 自定义样式
 .sheet(“学生信息”)
 .doWrite(data);
参考文章:📖Easyexcel(注解使用)
 https://blog.csdn.net/q1468051413/article/details/139348375
 https://blog.csdn.net/weiwosuoai/article/details/141338421
 https://cloud.tencent.com/developer/article/1671316
📖 Easyexcel
相关文章:
 
EasyExcel注解使用
上接《Springboot下导入导出excel》,本篇详细介绍 EasyExcel 注解使用。 1. ExcelProperty value:指定写入的列头,如果不指定则使用成员变量的名字作为列头;如果要设置复杂的头,可以为value指定多个值orderÿ…...
 
Visual Basic 6 关于应用的类库 - 开源研究系列文章
上次整理VB6的原来写的代码,然后遇到了关于应用窗体的显示问题。VB6不比C#,能够直接反射调用里面的方法,判断是否显示关于窗体然后显示。以前写过一个VB6插件的例子,不过那个源码不在,所以就找了度娘,能够象…...
 
C#泛型
泛型是一种非常强大的特性,它允许程序员编写灵活的代码,同时保持类型安全。泛型的核心思想是允许类或方法在定义时不指定具体的数据类型,而是在实际使用时指定。这意味着你可以创建一个可以与任何数据类型一起工作的类或方法 泛型类通过在类…...
 
go语言的成神之路-标准库篇-fmt标准库
目录 一、三种类型的输出 print: println: printf: 总结: 代码展示: 二、格式化占位符 %s:用于格式化字符串。 %d:用于格式化整数。 %f:用于格式化浮点数。 %v࿱…...
React Native的router解析
写在前面 React Native(简称RN)是一个由Facebook开发的开源框架,用于构建跨平台的移动应用程序。在RN中,路由(router)是非常重要的概念,它允许我们在不同的屏幕之间进行导航和切换。 以下是RN…...
 
Linux update-alternatives 命令详解
1、查看所有候选项 sudo update-alternatives --list (java筛选sudo update-alternatives --list java) 2、更换候选项 sudo update-alternatives --config java 3、自动选择优先级最高的作为默认项 sudo update-alterna…...
 
【踩坑】修复报错libcurl.so.4、LIBFFI_BASE_7.0、libssl.so.3
转载请注明出处:小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你,欢迎[点赞、收藏、关注]哦~ libcurl.so.4: sudo apt install curl -y LIBFFI_BASE_7.0: conda install libffi3.3 -y libssl.so.3: sudo apt install -y openssl li…...
python网络爬虫基础:html基础概念与遍历文档树
开始之前导入html段落,同时下载好本节将用到的库。下载方式为:pip install beautifulsoup4 一点碎碎念:为什么install后面的不是bs4也不是BeautifulSoup? html_doc """ <html><head><title>The…...
 
【已解决】MacOS上VMware Fusion虚拟机打不开的解决方法
在使用VMware Fusion时,不少用户可能会遇到虚拟机无法打开的问题。本文将为大家提供一个简单有效的解决方法,只需删除一个文件,即可轻松解决这一问题。 一、问题现象 在MacOS系统上,使用VMware Fusion运行虚拟机时,有…...
 
经典视觉神经网络1 CNN
一、概述 输入的图像都很大,使用全连接网络的话,计算的代价较高,图像也很难保留原本特征。 卷积神经网络(Convolutional Neural Network,CNN)是一种专门用于处理具有网格状结构数据的深度学习模型。主要应用…...
 
一些硬件知识【2024/12/6】
MP6924A: 正点原子加热台拆解: PMOS 相比 NMOS 的缺点: 缺点描述迁移率低PMOS 中的空穴迁移率约为电子迁移率的 1/3 到 1/2,导致导通电流较低。开关速度慢由于迁移率较低,PMOS 的开关速度比 NMOS 慢,不适合高速数字电…...
网络安全法-网络安全支持与促进
第二章 网络安全支持与促进 第十五条 国家建立和完善网络安全标准体系。国务院标准化行政主管部门和国务院其他有关部门根据各自的职责,组织制定并适时修订有关网络安全管理以及网络产品、服务和运行安全的国家标准、行业标准。 国家支持企业、研究机构、高等学…...
 
【Docker】如何在Docker中配置防火墙规则?
Docker本身并不直接管理防火墙规则;它依赖于主机系统的防火墙设置。不过,Docker在启动容器时会自动配置一些iptables规则来管理容器网络流量。如果你需要更细粒度地控制进出容器的流量,你需要在主机系统上配置防火墙规则。以下是如何在Linux主…...
 
Cesium 问题: 添加billboard后移动或缩放地球,标记点位置会左右偏移
文章目录 问题分析原先的:添加属性——解决漂移移动问题产生新的问题:所选的经纬度坐标和应放置的位置有偏差解决坐标位置偏差的问题完整代码问题 添加 billboard 后, 分析 原先的: // 图标加载 function addStation ({lon, lat, el, testName...
使用Python3 连接操作 OceanBase数据库
注:使用Python3 连接 OceanBase数据库,可通过安装 PyMySQL驱动包来实现。 本次测试是在一台安装部署OBD的OceanBase 测试linux服务器上,通过python来远程操作OceanBase数据库。 一、Linux服务器通过Python3连接OceanBase数据库 1.1 安装pyth…...
 
SpringBoot该怎么使用Neo4j - 优化篇
文章目录 前言实体工具使用 前言 上一篇中,我们的Cypher都用的是字符串,字符串拼接简单,但存在写错的风险,对于一些比较懒的开发者,甚至觉得之间写字符串还更自在快速,也确实,但如果在后期需要…...
 
Flutter如何调用java接口如何导入java包
文章目录 1. Flutter 能直接调用 Java 的接口吗?如何调用 Java 接口? 2. Flutter 能导入 Java 的包吗?步骤: 总结 在 Flutter 中,虽然 Dart 是主要的开发语言,但你可以通过**平台通道(Platform …...
 
Redis 数据结构(一)—字符串、哈希表、列表
Redis(版本7.0)的数据结构主要包括字符串(String)、哈希表(Hash)、列表(List)、集合(Set)、有序集合(Sorted Set)、超日志(…...
 
day1:ansible
ansible-doc <module_name>(如果没有网,那这个超级有用) 这个很有用,用来查单个模块的文档。 ansible-doc -l 列出所有模块 ansible-doc -s <module_name> 查看更详细的模块文档。 ansible-doc --help 使用 --help …...
如何设置Java爬虫的异常处理?
在Java爬虫中设置异常处理是非常重要的,因为网络请求可能会遇到各种问题,如连接超时、服务器错误、网络中断等。通过合理的异常处理,可以确保爬虫的稳定性和健壮性。以下是如何在Java爬虫中设置异常处理的步骤和最佳实践: 1. 使用…...
 
LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明
LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造,完美适配AGV和无人叉车。同时,集成以太网与语音合成技术,为各类高级系统(如MES、调度系统、库位管理、立库等)提供高效便捷的语音交互体验。 L…...
 
铭豹扩展坞 USB转网口 突然无法识别解决方法
当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…...
 
sshd代码修改banner
sshd服务连接之后会收到字符串: SSH-2.0-OpenSSH_9.5 容易被hacker识别此服务为sshd服务。 是否可以通过修改此banner达到让人无法识别此服务的目的呢? 不能。因为这是写的SSH的协议中的。 也就是协议规定了banner必须这么写。 SSH- 开头,…...
LangChain【6】之输出解析器:结构化LLM响应的关键工具
文章目录 一 LangChain输出解析器概述1.1 什么是输出解析器?1.2 主要功能与工作原理1.3 常用解析器类型 二 主要输出解析器类型2.1 Pydantic/Json输出解析器2.2 结构化输出解析器2.3 列表解析器2.4 日期解析器2.5 Json输出解析器2.6 xml输出解析器 三 高级使用技巧3…...
41道Django高频题整理(附答案背诵版)
解释一下 Django 和 Tornado 的关系? Django和Tornado都是Python的web框架,但它们的设计哲学和应用场景有所不同。 Django是一个高级的Python Web框架,鼓励快速开发和干净、实用的设计。它遵循MVC设计,并强调代码复用。Django有…...
 
Pandas 可视化集成:数据科学家的高效绘图指南
为什么选择 Pandas 进行数据可视化? 在数据科学和分析领域,可视化是理解数据、发现模式和传达见解的关键步骤。Python 生态系统提供了多种可视化工具,如 Matplotlib、Seaborn、Plotly 等,但 Pandas 内置的可视化功能因其与数据结…...
 
Centos 7 服务器部署多网站
一、准备工作 安装 Apache bash sudo yum install httpd -y sudo systemctl start httpd sudo systemctl enable httpd创建网站目录 假设部署 2 个网站,目录结构如下: bash sudo mkdir -p /var/www/site1/html sudo mkdir -p /var/www/site2/html添加测试…...
 
汇编语言学习(三)——DoxBox中debug的使用
目录 一、安装DoxBox,并下载汇编工具(MASM文件) 二、debug是什么 三、debug中的命令 一、安装DoxBox,并下载汇编工具(MASM文件) 链接: https://pan.baidu.com/s/1IbyJj-JIkl_oMOJmkKiaGQ?pw…...
创客匠人:如何通过创始人IP打造实现知识变现与IP变现的长效增长?
在流量红利逐渐消退的当下,创始人IP的价值愈发凸显。它不仅能够帮助中小企业及个人创业者突破竞争壁垒,还能成为企业品牌影响力的核心资产。然而,市场上IP孵化机构鱼龙混杂,如何选择一家真正具备长期价值的合作伙伴?创…...
 
动态生成element-plus的scss变量;SCSS中实现动态颜色变体生成
文章目录 一、动态css变量1.生成内容2.动态生成css变量2.1新增_color-utils.scss(不推荐)2.2新增_color-utils.scss(推荐)2.3theme.scss引入使用 一、动态css变量 1.生成内容 在我们修改element-plus主题色时候,会自…...
