当前位置: 首页 > news >正文

政府网站建设上会说明/营销推广型网站

政府网站建设上会说明,营销推广型网站,lamp 做网站,阜沙网站建设上接《Springboot下导入导出excel》,本篇详细介绍 EasyExcel 注解使用。 1. ExcelProperty value:指定写入的列头,如果不指定则使用成员变量的名字作为列头;如果要设置复杂的头,可以为value指定多个值order&#xff…

上接《Springboot下导入导出excel》,本篇详细介绍 EasyExcel 注解使用。

1. @ExcelProperty

  • value:指定写入的列头,如果不指定则使用成员变量的名字作为列头;如果要设置复杂的头,可以为value指定多个值
  • order:优先级高于 value,会根据 order 的顺序来匹配实体和excel中数据的顺序
  • index:优先级高于 valueorder,指定写到第几列,如果不指定则根据成员变量位置排序;默认第一个字段就是 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),实现其setHeadCellStylesetContentCellStyle 方法可以自定义设置表头和单元格内容样式。

参见📖 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)类,实现其setHeadCellStylesetContentCellStyle 方法可以自定义设置表头和单元格内容样式

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》&#xff0c;本篇详细介绍 EasyExcel 注解使用。 1. ExcelProperty value&#xff1a;指定写入的列头&#xff0c;如果不指定则使用成员变量的名字作为列头&#xff1b;如果要设置复杂的头&#xff0c;可以为value指定多个值order&#xff…...

Visual Basic 6 关于应用的类库 - 开源研究系列文章

上次整理VB6的原来写的代码&#xff0c;然后遇到了关于应用窗体的显示问题。VB6不比C#&#xff0c;能够直接反射调用里面的方法&#xff0c;判断是否显示关于窗体然后显示。以前写过一个VB6插件的例子&#xff0c;不过那个源码不在&#xff0c;所以就找了度娘&#xff0c;能够象…...

C#泛型

泛型是一种非常强大的特性&#xff0c;它允许程序员编写灵活的代码&#xff0c;同时保持类型安全。泛型的核心思想是允许类或方法在定义时不指定具体的数据类型&#xff0c;而是在实际使用时指定。这意味着你可以创建一个可以与任何数据类型一起工作的类或方法 泛型类通过在类…...

go语言的成神之路-标准库篇-fmt标准库

目录 一、三种类型的输出 print&#xff1a; println&#xff1a; printf&#xff1a; 总结&#xff1a; 代码展示&#xff1a; 二、格式化占位符 %s&#xff1a;用于格式化字符串。 %d&#xff1a;用于格式化整数。 %f&#xff1a;用于格式化浮点数。 %v&#xff1…...

React Native的router解析

写在前面 React Native&#xff08;简称RN&#xff09;是一个由Facebook开发的开源框架&#xff0c;用于构建跨平台的移动应用程序。在RN中&#xff0c;路由&#xff08;router&#xff09;是非常重要的概念&#xff0c;它允许我们在不同的屏幕之间进行导航和切换。 以下是RN…...

Linux update-alternatives 命令详解

1、查看所有候选项 sudo update-alternatives --list &#xff08;java筛选​​​​​​​sudo update-alternatives --list java&#xff09; 2、​​​​​​​更换候选项 sudo update-alternatives --config java 3、自动选择优先级最高的作为默认项 sudo update-alterna…...

【踩坑】修复报错libcurl.so.4、LIBFFI_BASE_7.0、libssl.so.3

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你&#xff0c;欢迎[点赞、收藏、关注]哦~ libcurl.so.4&#xff1a; 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段落&#xff0c;同时下载好本节将用到的库。下载方式为&#xff1a;pip install beautifulsoup4 一点碎碎念&#xff1a;为什么install后面的不是bs4也不是BeautifulSoup&#xff1f; html_doc """ <html><head><title>The…...

【已解决】MacOS上VMware Fusion虚拟机打不开的解决方法

在使用VMware Fusion时&#xff0c;不少用户可能会遇到虚拟机无法打开的问题。本文将为大家提供一个简单有效的解决方法&#xff0c;只需删除一个文件&#xff0c;即可轻松解决这一问题。 一、问题现象 在MacOS系统上&#xff0c;使用VMware Fusion运行虚拟机时&#xff0c;有…...

经典视觉神经网络1 CNN

一、概述 输入的图像都很大&#xff0c;使用全连接网络的话&#xff0c;计算的代价较高&#xff0c;图像也很难保留原本特征。 卷积神经网络&#xff08;Convolutional Neural Network&#xff0c;CNN&#xff09;是一种专门用于处理具有网格状结构数据的深度学习模型。主要应用…...

一些硬件知识【2024/12/6】

MP6924A: 正点原子加热台拆解&#xff1a; PMOS 相比 NMOS 的缺点&#xff1a; 缺点描述迁移率低PMOS 中的空穴迁移率约为电子迁移率的 1/3 到 1/2&#xff0c;导致导通电流较低。开关速度慢由于迁移率较低&#xff0c;PMOS 的开关速度比 NMOS 慢&#xff0c;不适合高速数字电…...

网络安全法-网络安全支持与促进

第二章 网络安全支持与促进 第十五条 国家建立和完善网络安全标准体系。国务院标准化行政主管部门和国务院其他有关部门根据各自的职责&#xff0c;组织制定并适时修订有关网络安全管理以及网络产品、服务和运行安全的国家标准、行业标准。 国家支持企业、研究机构、高等学…...

【Docker】如何在Docker中配置防火墙规则?

Docker本身并不直接管理防火墙规则&#xff1b;它依赖于主机系统的防火墙设置。不过&#xff0c;Docker在启动容器时会自动配置一些iptables规则来管理容器网络流量。如果你需要更细粒度地控制进出容器的流量&#xff0c;你需要在主机系统上配置防火墙规则。以下是如何在Linux主…...

Cesium 问题: 添加billboard后移动或缩放地球,标记点位置会左右偏移

文章目录 问题分析原先的:添加属性——解决漂移移动问题产生新的问题:所选的经纬度坐标和应放置的位置有偏差解决坐标位置偏差的问题完整代码问题 添加 billboard 后, 分析 原先的: // 图标加载 function addStation ({lon, lat, el, testName...

使用Python3 连接操作 OceanBase数据库

注&#xff1a;使用Python3 连接 OceanBase数据库&#xff0c;可通过安装 PyMySQL驱动包来实现。 本次测试是在一台安装部署OBD的OceanBase 测试linux服务器上&#xff0c;通过python来远程操作OceanBase数据库。 一、Linux服务器通过Python3连接OceanBase数据库 1.1 安装pyth…...

SpringBoot该怎么使用Neo4j - 优化篇

文章目录 前言实体工具使用 前言 上一篇中&#xff0c;我们的Cypher都用的是字符串&#xff0c;字符串拼接简单&#xff0c;但存在写错的风险&#xff0c;对于一些比较懒的开发者&#xff0c;甚至觉得之间写字符串还更自在快速&#xff0c;也确实&#xff0c;但如果在后期需要…...

Flutter如何调用java接口如何导入java包

文章目录 1. Flutter 能直接调用 Java 的接口吗&#xff1f;如何调用 Java 接口&#xff1f; 2. Flutter 能导入 Java 的包吗&#xff1f;步骤&#xff1a; 总结 在 Flutter 中&#xff0c;虽然 Dart 是主要的开发语言&#xff0c;但你可以通过**平台通道&#xff08;Platform …...

Redis 数据结构(一)—字符串、哈希表、列表

Redis&#xff08;版本7.0&#xff09;的数据结构主要包括字符串&#xff08;String&#xff09;、哈希表&#xff08;Hash&#xff09;、列表&#xff08;List&#xff09;、集合&#xff08;Set&#xff09;、有序集合&#xff08;Sorted Set&#xff09;、超日志&#xff08…...

day1:ansible

ansible-doc <module_name>&#xff08;如果没有网&#xff0c;那这个超级有用&#xff09; 这个很有用&#xff0c;用来查单个模块的文档。 ansible-doc -l 列出所有模块 ansible-doc -s <module_name> 查看更详细的模块文档。 ansible-doc --help 使用 --help …...

如何设置Java爬虫的异常处理?

在Java爬虫中设置异常处理是非常重要的&#xff0c;因为网络请求可能会遇到各种问题&#xff0c;如连接超时、服务器错误、网络中断等。通过合理的异常处理&#xff0c;可以确保爬虫的稳定性和健壮性。以下是如何在Java爬虫中设置异常处理的步骤和最佳实践&#xff1a; 1. 使用…...

阿里云盘permission denied

问题是执行 ./aliyunpan 时遇到了 Permission denied 的错误。这通常是因为文件没有执行权限。以下是解决问题的步骤&#xff1a; 检查文件权限 运行以下命令检查文件的权限&#xff1a; ls -l aliyunpan输出中会看到类似以下内容&#xff1a; -rw-r--r-- 1 user group 123…...

在 Ubuntu 24 上安装 Redis 7.0.15 并配置允许所有 IP 访问

前提条件 一台运行 Ubuntu 24 的服务器拥有 sudo 权限的用户 步骤一&#xff1a;更新系统包 首先&#xff0c;确保系统包是最新的&#xff0c;以避免潜在的依赖问题。 sudo apt update sudo apt upgrade -y步骤二&#xff1a;安装编译 Redis 所需的依赖 Redis 需要一些编译…...

构建高效可靠的分布式推理系统:深入解析控制器与模型服务的协同工作

在现代互联网应用中,随着用户需求的增长和技术的进步,单一服务器已经难以满足大规模并发请求的需求。为了提升系统的性能和可靠性,开发者们越来越多地采用分布式架构。本文将结合具体的代码示例,深入浅出地探讨如何构建一个高效的分布式推理系统,并详细解析其中的关键组件…...

springboot394疫情居家办公系统(论文+源码)_kaic

摘 要 如今社会上各行各业&#xff0c;都喜欢用自己行业的专属软件工作&#xff0c;互联网发展到这个时候&#xff0c;人们已经发现离不开了互联网。新技术的产生&#xff0c;往往能解决一些老技术的弊端问题。因为传统疫情居家办公系统信息管理难度大&#xff0c;容错率低&a…...

共筑数字安全防线,2024开源和软件安全沙龙即将启幕

随着数字化转型进程的加快以及开源代码的广泛应用&#xff0c;开源凭借平等、开放、协作、共享的优秀创作模式&#xff0c;逐渐成为推动数字技术创新、加速传统行业转型升级的重要模式。但随着软件供应链日趋复杂多元&#xff0c;使得其安全风险不断加剧&#xff0c;针对软件供…...

后端报错: message: “For input string: \“\““

这个错误信息表明后端尝试将一个空字符串 "" 转换为某种数值类型&#xff08;如整数、长整型等&#xff09;&#xff0c;但转换失败了。在许多编程语言中&#xff0c;如果你试图解析一个非数字的字符串&#xff08;在这个情况下是一个空字符串&#xff09;为数值类型…...

39 矩阵置零

39 矩阵置零 39.1 矩阵置零解决方案 解题思路&#xff1a; 利用第一行和第一列标记&#xff1a; 使用两个标记变量&#xff0c;rowZero和colZero&#xff0c;来判断第一行和第一列是否需要置零。遍历矩阵从(1,1)开始&#xff0c;如果某个元素是0&#xff0c;则标记该行和该列…...

使用伪装IP地址和MAC地址进行Nmap扫描

使用伪装IP地址和MAC地址进行Nmap扫描 在某些网络设置中&#xff0c;攻击者可以使用伪装的IP地址甚至伪装的MAC地址进行系统扫描。这种扫描方式只有在可以保证捕获响应的情况下才有意义。如果从某个随机的网络尝试使用伪装的IP地址进行扫描&#xff0c;很可能无法接收到任何响…...

linux安装docker和mysql

1.下载安装doker 1. 更新系统,确保系统是最新的 sudo yum update -y2.安装 Docker 所需的依赖包&#xff1a; sudo yum install -y yum-utils 2. 设置 Docker 仓库 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 3. 安装 Dock…...

贪心算法专题(四)

目录 1. 单调递增的数字 1.1 算法原理 1.2 算法代码 2. 坏了的计算器 2.1 算法原理 2.2 算法代码 3. 合并区间 3.1 算法原理 3.2 算法代码 4. 无重叠区间 4.1 算法原理 4.2 算法代码 5. 用最少数量的箭引爆气球 5.1 算法原理 ​5.2 算法代码 1. 单调递增的数字…...