excel 列单元格合并(合并列相同行)

代码

  • 首先自定义注解CellMerge,用于标记哪些属性需要合并,哪个是主键**(这里做了一个优化,可以标记多个主键)**
import org.dromara.common.excel.core.CellMergeStrategy;import java.lang.annotation.*;/*** excel 列单元格合并(合并列相同项)** 需搭配 {@link CellMergeStrategy} 策略使用** @author Lion Li*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface CellMerge {/*** col index*/int index() default -1;}
  • 再创建自定义单元格合并策略类CellMergeStrategy,当Excel中两列主键相同时,合并被标记需要合并的列**(当前类增加多主键判断是否需要合并)**

import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.dromara.common.core.utils.reflect.ReflectUtils;
import org.dromara.common.excel.annotation.CellMerge;import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 列值重复合并策略** @author Lion Li*/
@Slf4j
public class CellMergeStrategy extends AbstractMergeStrategy {private final List<CellRangeAddress> cellList;private final boolean hasTitle;private int rowIndex;public CellMergeStrategy(List<?> list, boolean hasTitle) {this.hasTitle = hasTitle;// 行合并开始下标this.rowIndex = hasTitle ? 1 : 0;this.cellList = handle(list, hasTitle);}@Overrideprotected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {// judge the list is not nullif (CollUtil.isNotEmpty(cellList)) {// the judge is necessaryif (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == 0) {for (CellRangeAddress item : cellList) {sheet.addMergedRegion(item);}}}}@SneakyThrowsprivate List<CellRangeAddress> handle(List<?> list, boolean hasTitle) {List<CellRangeAddress> cellList = new ArrayList<>();if (CollUtil.isEmpty(list)) {return cellList;}Field[] fields = ReflectUtils.getFields(list.get(0).getClass(), field -> !"serialVersionUID".equals(field.getName()));// 有注解的字段List<Field> mergeFields = new ArrayList<>();List<Integer> mergeFieldsIndex = new ArrayList<>();for (int i = 0; i < fields.length; i++) {Field field = fields[i];if (field.isAnnotationPresent(CellMerge.class)) {CellMerge cm = field.getAnnotation(CellMerge.class);mergeFields.add(field);mergeFieldsIndex.add(cm.index() == -1 ? i : cm.index());if (hasTitle) {ExcelProperty property = field.getAnnotation(ExcelProperty.class);rowIndex = Math.max(rowIndex, property.value().length);}}}Map<Field, RepeatCell> map = new HashMap<>();// 生成两两合并单元格for (int i = 0; i < list.size(); i++) {for (int j = 0; j < mergeFields.size(); j++) {Field field = mergeFields.get(j);Object val = ReflectUtils.invokeGetter(list.get(i), field.getName());int colNum = mergeFieldsIndex.get(j);if (!map.containsKey(field)) {map.put(field, new RepeatCell(val, i));} else {RepeatCell repeatCell = map.get(field);Object cellValue = repeatCell.getValue();if (cellValue == null || "".equals(cellValue)) {// 空值跳过不合并continue;}if (!cellValue.equals(val)) {if (i - repeatCell.getCurrent() > 1) {cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));}map.put(field, new RepeatCell(val, i));} else if (j == 0) {if (i == list.size() - 1) {if (i > repeatCell.getCurrent()) {cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));}}} else {// 判断前面的是否合并了RepeatCell firstCell = map.get(mergeFields.get(0));if (repeatCell.getCurrent() != firstCell.getCurrent()) {if (i == list.size() - 1) {if (i > repeatCell.getCurrent()) {cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));}} else if (repeatCell.getCurrent() < firstCell.getCurrent()) {if (i - repeatCell.getCurrent() > 1) {cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));}map.put(field, new RepeatCell(val, i));}} else if (i == list.size() - 1) {if (i > repeatCell.getCurrent()) {cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));}}}}}}return cellList;}@Data@AllArgsConstructorstatic class RepeatCell {private Object value;private int current;}
}

ExcelUtlis工具类

package org.dromara.common.excel.utils;import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.core.util.IdUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.file.FileUtils;
import org.dromara.common.excel.convert.ExcelBigNumberConvert;
import org.dromara.common.excel.core.*;import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.List;
import java.util.Map;/*** Excel相关处理** @author Lion Li*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ExcelUtil {/*** 同步导入(适用于小数据量)** @param is 输入流* @return 转换后集合*/public static <T> List<T> importExcel(InputStream is, Class<T> clazz) {return EasyExcel.read(is).head(clazz).autoCloseStream(false).sheet().doReadSync();}/*** 使用校验监听器 异步导入 同步返回** @param is         输入流* @param clazz      对象类型* @param isValidate 是否 Validator 检验 默认为是* @return 转换后集合*/public static <T> ExcelResult<T> importExcel(InputStream is, Class<T> clazz, boolean isValidate) {DefaultExcelListener<T> listener = new DefaultExcelListener<>(isValidate);EasyExcel.read(is, clazz, listener).sheet().doRead();return listener.getExcelResult();}/*** 使用自定义监听器 异步导入 自定义返回** @param is       输入流* @param clazz    对象类型* @param listener 自定义监听器* @return 转换后集合*/public static <T> ExcelResult<T> importExcel(InputStream is, Class<T> clazz, ExcelListener<T> listener) {EasyExcel.read(is, clazz, listener).sheet().doRead();return listener.getExcelResult();}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param response  响应体*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, HttpServletResponse response) {try {resetResponse(sheetName, response);ServletOutputStream os = response.getOutputStream();exportExcel(list, sheetName, clazz, false, os, null);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param response  响应体* @param options   级联下拉选*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, HttpServletResponse response, List<DropDownOptions> options) {try {resetResponse(sheetName, response);ServletOutputStream os = response.getOutputStream();exportExcel(list, sheetName, clazz, false, os, options);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param merge     是否合并单元格* @param response  响应体*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge, HttpServletResponse response) {try {resetResponse(sheetName, response);ServletOutputStream os = response.getOutputStream();exportExcel(list, sheetName, clazz, merge, os, null);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param merge     是否合并单元格* @param response  响应体* @param options   级联下拉选*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge, HttpServletResponse response, List<DropDownOptions> options) {try {resetResponse(sheetName, response);ServletOutputStream os = response.getOutputStream();exportExcel(list, sheetName, clazz, merge, os, options);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param os        输出流*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, OutputStream os) {exportExcel(list, sheetName, clazz, false, os, null);}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param os        输出流* @param options   级联下拉选内容*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, OutputStream os, List<DropDownOptions> options) {exportExcel(list, sheetName, clazz, false, os, options);}/*** 导出excel** @param list      导出数据集合* @param sheetName 工作表的名称* @param clazz     实体类* @param merge     是否合并单元格* @param os        输出流*/public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, boolean merge,OutputStream os, List<DropDownOptions> options) {//配置字体,表头背景等HorizontalCellStyleStrategy horizontalCellStyleStrategy =setConfigure();ExcelWriterSheetBuilder builder = EasyExcel.write(os, clazz).autoCloseStream(false)// 自动适配.registerWriteHandler(new LongestMatchColumnWidthStyleStrategyPlus())//配置字体,表头背景等.registerWriteHandler(horizontalCellStyleStrategy)// 大数值自动转换 防止失真.registerConverter(new ExcelBigNumberConvert()).sheet(sheetName);if (merge) {// 合并处理器builder.registerWriteHandler(new CellMergeStrategy(list, true));}// 添加下拉框操作builder.registerWriteHandler(new ExcelDownHandler(options));//字符串去空格builder.registerWriteHandler(new StringTrimHandler());builder.doWrite(list);}/*** 单表多数据模板导出 模板格式为 {.属性}** @param filename     文件名* @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param response     响应体*/public static void exportTemplate(List<Object> data, String filename, String templatePath, HttpServletResponse response) {try {resetResponse(filename, response);ServletOutputStream os = response.getOutputStream();exportTemplate(data, templatePath, os);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 单表多数据模板导出 模板格式为 {.属性}** @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param os           输出流*/public static void exportTemplate(List<Object> data, String templatePath, OutputStream os) {ClassPathResource templateResource = new ClassPathResource(templatePath);ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(templateResource.getStream()).autoCloseStream(false)// 大数值自动转换 防止失真.registerConverter(new ExcelBigNumberConvert()).build();WriteSheet writeSheet = EasyExcel.writerSheet().build();if (CollUtil.isEmpty(data)) {throw new IllegalArgumentException("数据为空");}// 单表多数据导出 模板格式为 {.属性}for (Object d : data) {excelWriter.fill(d, writeSheet);}excelWriter.finish();}/*** 多表多数据模板导出 模板格式为 {key.属性}** @param filename     文件名* @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param response     响应体*/public static void exportTemplateMultiList(Map<String, Object> data, String filename, String templatePath, HttpServletResponse response) {try {resetResponse(filename, response);ServletOutputStream os = response.getOutputStream();exportTemplateMultiList(data, templatePath, os);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 多sheet模板导出 模板格式为 {key.属性}** @param filename     文件名* @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param response     响应体*/public static void exportTemplateMultiSheet(List<Map<String, Object>> data, String filename, String templatePath, HttpServletResponse response) {try {resetResponse(filename, response);ServletOutputStream os = response.getOutputStream();exportTemplateMultiSheet(data, templatePath, os);} catch (IOException e) {throw new RuntimeException("导出Excel异常");}}/*** 多表多数据模板导出 模板格式为 {key.属性}** @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param os           输出流*/public static void exportTemplateMultiList(Map<String, Object> data, String templatePath, OutputStream os) {ClassPathResource templateResource = new ClassPathResource(templatePath);ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(templateResource.getStream()).autoCloseStream(false)// 大数值自动转换 防止失真.registerConverter(new ExcelBigNumberConvert()).build();WriteSheet writeSheet = EasyExcel.writerSheet().build();if (CollUtil.isEmpty(data)) {throw new IllegalArgumentException("数据为空");}for (Map.Entry<String, Object> map : data.entrySet()) {// 设置列表后续还有数据FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();if (map.getValue() instanceof Collection) {// 多表导出必须使用 FillWrapperexcelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);} else {excelWriter.fill(map.getValue(), writeSheet);}}excelWriter.finish();}/*** 多sheet模板导出 模板格式为 {key.属性}** @param templatePath 模板路径 resource 目录下的路径包括模板文件名*                     例如: excel/temp.xlsx*                     重点: 模板文件必须放置到启动类对应的 resource 目录下* @param data         模板需要的数据* @param os           输出流*/public static void exportTemplateMultiSheet(List<Map<String, Object>> data, String templatePath, OutputStream os) {ClassPathResource templateResource = new ClassPathResource(templatePath);ExcelWriter excelWriter = EasyExcel.write(os).withTemplate(templateResource.getStream()).autoCloseStream(false)// 大数值自动转换 防止失真.registerConverter(new ExcelBigNumberConvert()).build();if (CollUtil.isEmpty(data)) {throw new IllegalArgumentException("数据为空");}for (int i = 0; i < data.size(); i++) {WriteSheet writeSheet = EasyExcel.writerSheet(i).build();for (Map.Entry<String, Object> map : data.get(i).entrySet()) {// 设置列表后续还有数据FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();if (map.getValue() instanceof Collection) {// 多表导出必须使用 FillWrapperexcelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);} else {excelWriter.fill(map.getValue(), writeSheet);}}}excelWriter.finish();}/*** 重置响应体*/static void resetResponse(String sheetName, HttpServletResponse response) throws UnsupportedEncodingException {String filename = encodingFilename(sheetName);FileUtils.setAttachmentResponseHeader(response, filename);response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");}/*** 解析导出值 0=男,1=女,2=未知** @param propertyValue 参数值* @param converterExp  翻译注解* @param separator     分隔符* @return 解析后值*/public static String convertByExp(String propertyValue, String converterExp, String separator) {StringBuilder propertyString = new StringBuilder();String[] convertSource = converterExp.split(StringUtils.SEPARATOR);for (String item : convertSource) {String[] itemArray = item.split("=");if (StringUtils.containsAny(propertyValue, separator)) {for (String value : propertyValue.split(separator)) {if (itemArray[0].equals(value)) {propertyString.append(itemArray[1] + separator);break;}}} else {if (itemArray[0].equals(propertyValue)) {return itemArray[1];}}}return StringUtils.stripEnd(propertyString.toString(), separator);}/*** 反向解析值 男=0,女=1,未知=2** @param propertyValue 参数值* @param converterExp  翻译注解* @param separator     分隔符* @return 解析后值*/public static String reverseByExp(String propertyValue, String converterExp, String separator) {StringBuilder propertyString = new StringBuilder();String[] convertSource = converterExp.split(StringUtils.SEPARATOR);for (String item : convertSource) {String[] itemArray = item.split("=");if (StringUtils.containsAny(propertyValue, separator)) {for (String value : propertyValue.split(separator)) {if (itemArray[1].equals(value)) {propertyString.append(itemArray[0] + separator);break;}}} else {if (itemArray[1].equals(propertyValue)) {return itemArray[0];}}}return StringUtils.stripEnd(propertyString.toString(), separator);}/*** 编码文件名*/public static String encodingFilename(String filename) {return IdUtil.fastSimpleUUID() + "_" + filename + ".xlsx";}//配置字体,表头背景等private static HorizontalCellStyleStrategy setConfigure() {// 头的策略WriteCellStyle headWriteCellStyle = new WriteCellStyle();
//        // 背景色
//        headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
//        WriteFont headWriteFont = new WriteFont();
//        headWriteFont.setFontHeightInPoints((short) 10);
//        headWriteCellStyle.setWriteFont(headWriteFont);// 内容的策略WriteCellStyle contentWriteCellStyle = new WriteCellStyle();contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);contentWriteCellStyle.setWrapped(true);contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);contentWriteCellStyle.setBorderTop(BorderStyle.THIN);contentWriteCellStyle.setBorderRight(BorderStyle.THIN);contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置// 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);}
}

选择工具类ExcelUtils导出

注解:

结果:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/73300.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

flowable适配达梦7 (2.1)

经过第一版的问题解决&#xff0c;后端项目可以启动&#xff0c;前端页面也集成进去。 前端在流程设计页面报错 之后发现主要是组件中modelerStore这个值没有 解决方法:在data增加对象 给component/process/designer.vue 中涉及到的每个子组件传入 :modelerStore“modeler…

Prometheus Exporter系列-Mysql_Exporter一键部署

新项目旧项目都需要给研发配置mysql监控&#xff0c;这里mysql监控对应aws 阿里云 腾讯云 华为云的云mysql产品或开源自建mysql。 exporter安装虽然简单&#xff0c;经常手动操作不免让人心烦&#xff0c;一键完成省去繁琐的常规操作。 配置信息对的情况下测试多次都可以正常安…

2025年移动端开发性能优化实践与趋势分析

启动速度优化 本质&#xff1a;缩短首次可见帧渲染时间。 方法&#xff1a; iOS&#xff1a;利用Core ML本地模型轻量化部署&#xff0c;减少云端等待。Android&#xff1a;强制启用SplashScreen API&#xff0c;通过setKeepOnScreenCondition控制动画时长。冷启动需将耗时操…

【MySQL篇】DEPENDENT SUBQUERY(依赖性子查询)优化:从百秒到秒级响应的四种优化办法

&#x1f4ab;《博主介绍》&#xff1a;✨又是一天没白过&#xff0c;我是奈斯&#xff0c;从事IT领域✨ &#x1f4ab;《擅长领域》&#xff1a;✌️擅长阿里云AnalyticDB for MySQL(分布式数据仓库)、Oracle、MySQL、Linux、prometheus监控&#xff1b;并对SQLserver、NoSQL(…

全文 - MLIR Toy Tutorial Chapter 1: Toy Language and AST

Toy 语言 本教程&#xff0c;将会借助一个玩具语言来讲解&#xff0c;这个语言我们称其为 Toy。Toy 是一个基于张量的语言&#xff0c;它允许你定义函数&#xff0c;执行一些数学计算&#xff0c;并且打印结果。做这样的设定&#xff0c;是因为我们希望让教程保持简明&#xff…

排序复习_代码纯享

头文件 #pragma once #include<iostream> #include<vector> #include<utility> using std::vector; using std::cout; using std::cin; using std::endl; using std::swap;//插入排序 //1、直接插入排序&#xff08;稳定&#xff09; void InsertSort(vecto…

CSS语言的双向链表

CSS语言的双向链表 引言 在计算机科学中&#xff0c;数据结构是一个极为重要的概念&#xff0c;而链表则是最常见的数据结构之一。链表可以分为单向链表和双向链表&#xff0c;其中双向链表因其灵活性和高效性而受到广泛应用。在前端开发的领域&#xff0c;尤其是CSS&#xf…

简单理解机器学习中top_k、top_p、temperature三个参数的作用

AI系列文章&#xff1a; AWS AI认证考试中经常提及几个重要的工具介绍 简单理解机器学习中top_k、top_p、temperature三个参数的作用 用Deepseek Kimi 快速生成高质量的ppt 在机器学习中&#xff0c;top_k、top_p 和 temperature 是用于控制生成模型&#xff08;如语言模型…

红宝书第十三讲:详解JavaScript核心对象:Array、Object、Date、RegExp

红宝书第十三讲&#xff1a;详解JavaScript核心对象&#xff1a;Array、Object、Date、RegExp 资料取自《JavaScript高级程序设计&#xff08;第5版&#xff09;》。 查看总目录&#xff1a;红宝书学习大纲 一、Object&#xff1a;万物皆对象的“盒子” Object是JavaScript中…

昆仑技术重构AI大模型落地范式,长期作“加法”迎来国产生态化“拐点”

作者 | 曾响铃 文 | 响铃说 DeepSeek的爆火&#xff0c;在业内迅速掀起了一场国产化的变革。“国产大模型国产算力”软硬协同的范式正在被重构&#xff0c;AI产业国产化的含金量持续提升&#xff0c;越来越多的企业在这一趋势下加速走上数智化转型路径。 其中&#xff0c;以…

原开源鸿蒙仓库停止更新

2月24日&#xff0c;gitee 上的开源鸿蒙组织&#xff0c;所有代码停止更新&#xff0c;查看代码仓显示已关闭&#xff0c;不少小伙伴以为停止更新了&#xff0c;发生了什么&#xff1f; 原因很简单&#xff0c;所有代码仓迁移至 Gitcode&#xff0c;至于为什么改用 Gitcode&…

Spring Boot框架中常用注解

以下是Spring Boot框架中常用注解的详细说明&#xff0c;包括名称、用途、用法、使用位置及扩展示例&#xff0c;按功能模块分类整理&#xff1a; 一、核心启动与配置注解 1. SpringBootApplication 用途&#xff1a;主启动类注解&#xff0c;整合了 Configuration、EnableAu…

Azure Delta Lake、Databricks和Event Hubs实现实时欺诈检测

设计Azure云架构方案实现Azure Delta Lake和Azure Databricks&#xff0c;结合 Azure Event Hubs/Kafka 摄入实时数据&#xff0c;通过 Delta Lake 实现 Exactly-Once 语义&#xff0c;实时欺诈检测&#xff08;流数据写入 Delta Lake&#xff0c;批处理模型实时更新&#xff0…

车载以太网网络测试 -23【TCPUDP通信示例】

1 摘要 在车载通信场景中&#xff0c;TCP以及UDP的通信可以用于多种应用&#xff0c;例如车辆状态监控、远程控制、数据采集等。以下是详细的代码示例&#xff0c;展示了如何使用Python实现简单的TCP客户端与服务端通信以及简单的UDP客户端与服务端通信&#xff0c;并模拟了车…

SpringBoot大学生竞赛管理系统设计与实现

一个用于管理大学生竞赛报名、信息查询与竞赛管理的系统&#xff0c;采用了现代化的SpringBoot框架进行开发。该系统的主要功能包括学生信息管理、教师信息管理、竞赛报名审核、竞赛信息管理等模块&#xff0c;适用于学校或教育机构进行竞赛活动的组织与管理。系统界面简洁&…

深入解析libsunrpc:构建分布式系统的核心RPC库

深入解析libsunrpc&#xff1a;构建分布式系统的核心RPC库 引言 在分布式系统开发中&#xff0c;远程过程调用&#xff08;Remote Procedure Call, RPC&#xff09; 是连接不同节点、实现跨网络服务调用的关键技术。作为SUN公司开源的经典RPC实现&#xff0c;libsunrpc 凭借其…

MinIO搭建部署

1、命令行安装 访问monio官网下载应用程序 # wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20250228095516.0.0-1.x86_64.rpm -O minio.rpm # sudo dnf install minio.rpm # mkdir ~/minio # minio server ~/minio --console-address :90012、dock…

Linux修改SSH端口号

我这里那RedHat系列的操作系统举例,修改SSH端口号 修改SSH配置文件:/etc/ssh/sshd_config,将端口号修改为2222.vim /etc/ssh/sshd_config重启SSH服务systemctl restart sshd# 如果是比较旧的OS,使用下面的命令重启 service ssh restart验证端口更改是否成功netstat -tulnp …

【嵌入式Linux】基于ArmLinux的智能垃圾分类系统项目

目录 1. 功能需求2. Python基础2.1 特点2.2 Python基础知识2.3 dict嵌套简单说明 3. C语言调用Python3.1 搭建编译环境3.2 直接调用python语句3.3 调用无参python函数3.4 调用有参python函数 4. 阿里云垃圾识别方案4.1 接入阿里云4.2 C语言调用阿里云Python接口 5. 香橙派使用摄…

【商城实战(63)】配送区域与运费设置全解析

【商城实战】专栏重磅来袭&#xff01;这是一份专为开发者与电商从业者打造的超详细指南。从项目基础搭建&#xff0c;运用 uniapp、Element Plus、SpringBoot 搭建商城框架&#xff0c;到用户、商品、订单等核心模块开发&#xff0c;再到性能优化、安全加固、多端适配&#xf…