java poi导出excel合并单元格

news2025/4/21 17:39:09

导出效果

代码:

import java.math.BigDecimal;

public class CwmonthlyPlanSub0Bean {
	/**
	 * 主键
	 */
	private Long id;
	/**
	 * 付款类
	 */
	private String fkl;
	/**
	 * 付款事项
	 */
	private String fksx;
	
	/**
	 * 本期预算金额
	 */
	private BigDecimal bqysje;
	
	
/**
 * 
 * 电汇金额
 */
	private BigDecimal dhje;
/**
 * 
 
 */
	private BigDecimal cdje;
	private String remarks;
	public CwmonthlyPlanSub0Bean(Long id, String fkl, String fksx, BigDecimal bqysje, BigDecimal dhje,BigDecimal cdje, String remarks) {
		super();
		this.id = id;
		this.fkl = fkl;
		this.fksx = fksx;
		
		this.bqysje = bqysje;
		
		this.dhje=dhje;
		this.cdje=cdje;
		this.remarks=remarks;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the fkl
	 */
	public String getFkl() {
		return fkl;
	}

	/**
	 * @param fkl the fkl to set
	 */
	public void setFkl(String fkl) {
		this.fkl = fkl;
	}

	/**
	 * @return the fksx
	 */
	public String getFksx() {
		return fksx;
	}

	/**
	 * @param fksx the fksx to set
	 */
	public void setFksx(String fksx) {
		this.fksx = fksx;
	}

	

	/**
	 * @return the bqysje
	 */
	public BigDecimal getBqysje() {
		return bqysje;
	}

	/**
	 * @param bqysje the bqysje to set
	 */
	public void setBqysje(BigDecimal bqysje) {
		this.bqysje = bqysje;
	}


	/**
	 * @return the dhje
	 */
	public BigDecimal getDhje() {
		return dhje;
	}

	/**
	 * @param dhje the dhje to set
	 */
	public void setDhje(BigDecimal dhje) {
		this.dhje = dhje;
	}

	/**
	 * @return the cdje
	 */
	public BigDecimal getCdje() {
		return cdje;
	}

	/**
	 * @param cdje the cdje to set
	 */
	public void setCdje(BigDecimal cdje) {
		this.cdje = cdje;
	}

	/**
	 * @return the remarks
	 */
	public String getRemarks() {
		return remarks;
	}

	/**
	 * @param remarks the remarks to set
	 */
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}




	
}
public static void main(String args[]) {
		// 模拟部分数据
		List<CwmonthlyPlanSub0Bean> detail = new ArrayList<CwmonthlyPlanSub0Bean>();
		// MonthlyFundingEntity entity=dao.get
		CwmonthlyPlanSub0Bean d1 = new CwmonthlyPlanSub0Bean(1L, "人工", "工资", new BigDecimal("4.675"),
				new BigDecimal("4.675"), new BigDecimal("4.675"), "555");
		CwmonthlyPlanSub0Bean d2 = new CwmonthlyPlanSub0Bean(2L, "人工", "福利费", new BigDecimal("44.675"),
				new BigDecimal("4.675"), new BigDecimal("4.675"), "66");
		CwmonthlyPlanSub0Bean d3 = new CwmonthlyPlanSub0Bean(3L, "原料", "电铜", new BigDecimal("6.675"),
				new BigDecimal("4.675"), new BigDecimal("4.675"), "77");
		CwmonthlyPlanSub0Bean d4 = new CwmonthlyPlanSub0Bean(4L, "原料", "绿柱石", new BigDecimal("7.675"),
				new BigDecimal("4.675"), new BigDecimal("4.675"), "88");
		CwmonthlyPlanSub0Bean d5 = new CwmonthlyPlanSub0Bean(5L, "燃料动力", "测试", new BigDecimal("8.675"),
				new BigDecimal("4.675"), new BigDecimal("4.675"), "999");
		detail.add(d1);
		detail.add(d2);
		detail.add(d3);
		detail.add(d4);
		detail.add(d5);

		try {
			FileOutputStream fout = new FileOutputStream("D:/data/students.xls");
			ExportExcels(detail, fout);
			fout.close();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
public static void ExportExcels(List<CwmonthlyPlanSub0Bean> detail, FileOutputStream fout) {

		try {
			// 1.创建工作簿
			HSSFWorkbook workbook = new HSSFWorkbook();
			// 1.1创建合并单元格对象
			CellRangeAddress callRangeAddress1 = new CellRangeAddress(0, 0, 0, 5);// 起始行,结束行,起始列,结束列
			// 填报部门
			CellRangeAddress callRangeAddress2 = new CellRangeAddress(1, 1, 0, 1);// 起始行,结束行,起始列,结束列
			// 编制时间:
			CellRangeAddress callRangeAddress3 = new CellRangeAddress(1, 1, 2, 4);// 起始行,结束行,起始列,结束列
		
			// 项目
			CellRangeAddress callRangeAddress5 = new CellRangeAddress(2, 3, 0, 0);// 起始行,结束行,起始列,结束列
			
			// 核算内容
			CellRangeAddress callRangeAddress6 = new CellRangeAddress(2, 3, 1, 1);// 起始行,结束行,起始列,结束列
			// 本期预算金额
			CellRangeAddress callRangeAddress7 = new CellRangeAddress(2, 3, 2, 2);// 起始行,结束行,起始列,结束列

			// 付款方式
			CellRangeAddress callRangeAddress8 = new CellRangeAddress(2, 2, 3, 4);// 起始行,结束行,起始列,结束列
			// 备注
			CellRangeAddress callRangeAddress9 = new CellRangeAddress(2, 3, 5, 5);// 起始行,结束行,起始列,结束列

			// 经办人、部门负责人
			CellRangeAddress callRangeAddressPersion1 = new CellRangeAddress(detail.size() + 5, detail.size() + 5 + 1,
					0, 2);// 起始行,结束行,起始列,结束列
			CellRangeAddress callRangeAddressPersion2 = new CellRangeAddress(detail.size() + 5, detail.size() + 5 + 1,
					3, 5);// 起始行,结束行,起始列,结束列

			// 样式配置start
			// title
			HSSFCellStyle erStyle = createCellStyle(workbook, (short) 13, true, true);
			// 项目名称和时间
			HSSFCellStyle sanStyle = createCellStyle(workbook, (short) 10, false, false);
			// 标题样式
			HSSFCellStyle colStyle = createCellStyle(workbook, (short) 10, true, true);
			// 内容样式
			HSSFCellStyle cellStyle = createCellStyle(workbook, (short) 10, false, true);
			// 2.创建工作表
			HSSFSheet sheet = workbook.createSheet("2024年2月份部门支出预算明细表");
			sheet.autoSizeColumn(1);
			sheet.setColumnWidth(1, sheet.getColumnWidth(1) * 50 / 10);

			// 2.1加载合并单元格对象
			sheet.addMergedRegion(callRangeAddress1);
			sheet.addMergedRegion(callRangeAddress2);
			sheet.addMergedRegion(callRangeAddress3);
			

			sheet.addMergedRegion(callRangeAddress5);
			
			sheet.addMergedRegion(callRangeAddress6);
			sheet.addMergedRegion(callRangeAddress7);
			sheet.addMergedRegion(callRangeAddress8);
			sheet.addMergedRegion(callRangeAddress9);
			sheet.addMergedRegion(callRangeAddressPersion1);
			sheet.addMergedRegion(callRangeAddressPersion2);

			// 设置默认列宽
			sheet.setDefaultColumnWidth(15);
			// 3.创建行
			// 3.1创建头标题行;并且设置头标题
			HSSFRow rower = sheet.createRow(0);
			HSSFCell celler = rower.createCell(0);
			// 加载单元格样式
			celler.setCellStyle(erStyle);
			celler.setCellValue("2024年2月份部门支出预算明细表");

			// 创建第二行
			HSSFRow rowsan = sheet.createRow(1);
			HSSFCell cellsan = rowsan.createCell(0);
			HSSFCell cellsan1 = rowsan.createCell(2);
			HSSFCell cellsan2 = rowsan.createCell(5);
			// 加载单元格样式
			cellsan.setCellStyle(sanStyle);
			cellsan.setCellValue("填报部门:333");
			cellsan1.setCellStyle(sanStyle);
			cellsan1.setCellValue("编制时间:2017年 10月 20日");
			cellsan2.setCellStyle(sanStyle);
			cellsan2.setCellValue(" 单位:万元");

			// 3.2创建列标题;并且设置列标题
			HSSFRow row2 = sheet.createRow(2);
		
			
			String[] titles = { "项目", "核算内容", "本期预算金额", "付款方式", "", "备注" };// ""为占位字符串
			for (int i = 0; i < titles.length; i++) {
				HSSFCell cell2 = row2.createCell(i);
				// 加载单元格样式
				
				colStyle.setBorderTop(BorderStyle.THIN);
				colStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderBottom(BorderStyle.THIN);
				colStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderLeft(BorderStyle.THIN);
				colStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderRight(BorderStyle.THIN);
				colStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
				cell2.setCellStyle(colStyle);
				cell2.setCellValue(titles[i]);

			}

			HSSFRow rowfour = sheet.createRow(3);
			String[] titlefour = {  "电汇", "承兑" };
			for (int i = 0; i < titlefour.length; i++) {
				HSSFCell cell2 = rowfour.createCell(i + 3);
				// 加载单元格样式
				cell2.setCellStyle(colStyle);
				colStyle.setBorderTop(BorderStyle.THIN);
				colStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderBottom(BorderStyle.THIN);
				colStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderLeft(BorderStyle.THIN);
				colStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
				colStyle.setBorderRight(BorderStyle.THIN);
				colStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
				cell2.setCellValue(titlefour[i]);
			}

			// 招标人代表
			HSSFRow rowpersion = sheet.createRow(detail.size() + 5);
			HSSFCell cellpersion = rowpersion.createCell(0);
			HSSFCell cellpersion1 = rowpersion.createCell(3);

			// 加载单元格样式
			cellpersion.setCellStyle(sanStyle);
			cellpersion.setCellValue("经办人:");
			cellpersion1.setCellStyle(sanStyle);
			cellpersion1.setCellValue("部门负责人:");
			BigDecimal count = new BigDecimal(0);
			BigDecimal dhCount = new BigDecimal(0);
			BigDecimal cdCount = new BigDecimal(0);
			// 4.操作单元格;将用户列表写入excel
			if (detail != null) {
				int i = 1;
				for (int j = 0; j < detail.size(); j++) {
					// 创建数据行,前面有两行,头标题行和列标题行
					HSSFRow row3 = sheet.createRow(j + 4);
					HSSFCell cell0 = row3.createCell(0);
					cell0.setCellStyle(cellStyle);
					cellStyle.setBorderTop(BorderStyle.THIN);
					cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
					cellStyle.setBorderBottom(BorderStyle.THIN);
					cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
					cellStyle.setBorderLeft(BorderStyle.THIN);
					cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
					cellStyle.setBorderRight(BorderStyle.THIN);
					cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
					cell0.setCellValue(detail.get(j).getFkl());

					HSSFCell cell1 = row3.createCell(1);
					cell1.setCellStyle(cellStyle);
					cell1.setCellValue(detail.get(j).getFksx());

					HSSFCell cell2 = row3.createCell(2);
					cell2.setCellStyle(cellStyle);
					cell2.setCellValue(String.valueOf(detail.get(j).getBqysje()));

					HSSFCell cell3 = row3.createCell(3);
					cell3.setCellStyle(cellStyle);
					cell3.setCellValue(String.valueOf(detail.get(j).getDhje()));
					HSSFCell cell4 = row3.createCell(4);
					cell4.setCellStyle(cellStyle);

					cell4.setCellValue(String.valueOf(detail.get(j).getCdje()));
					count = count.add(detail.get(j).getBqysje());
					dhCount = dhCount.add(detail.get(j).getDhje());
					cdCount = cdCount.add(detail.get(j).getCdje());
					HSSFCell cell5 = row3.createCell(5);
					cell5.setCellStyle(cellStyle);
					cell5.setCellValue(detail.get(j).getRemarks());

				}
			}
			// 合计
			HSSFRow hssfRow = sheet.createRow(detail.size() + 4);
			HSSFCell hssfCell = hssfRow.createCell(0);
			HSSFCell hssfCel0 = hssfRow.createCell(1);
			HSSFCell hssfCel2 = hssfRow.createCell(2);
			HSSFCell hssfCel3 = hssfRow.createCell(3);
			HSSFCell hssfCel4 = hssfRow.createCell(4);
			HSSFCell hssfCel5 = hssfRow.createCell(5);
			// 加载单元格样式
			HSSFCellStyle totleStyle = createCellStyle(workbook, (short) 10, true, true);
			hssfCell.setCellStyle(totleStyle);
			totleStyle.setAlignment(HorizontalAlignment.CENTER);// 水平居中
			totleStyle.setBorderTop(BorderStyle.THIN);
			totleStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
			totleStyle.setBorderBottom(BorderStyle.THIN);
			totleStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
			totleStyle.setBorderLeft(BorderStyle.THIN);
			totleStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
			totleStyle.setBorderRight(BorderStyle.THIN);
			totleStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
			hssfCell.setCellValue("合计:");
			HSSFCellStyle countStyle = createCellStyle(workbook, (short) 10, true, true);
			countStyle.setBorderTop(BorderStyle.THIN);
			countStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
			countStyle.setBorderBottom(BorderStyle.THIN);
			countStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
			countStyle.setBorderLeft(BorderStyle.THIN);
			countStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
			countStyle.setBorderRight(BorderStyle.THIN);
			countStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
			hssfCel2.setCellStyle(countStyle);
			hssfCel2.setCellValue(String.valueOf(count));
			hssfCel3.setCellStyle(countStyle);
			hssfCel3.setCellValue(String.valueOf(dhCount));
			hssfCel4.setCellStyle(countStyle);
			hssfCel4.setCellValue(String.valueOf(cdCount));
			hssfCel5.setCellStyle(countStyle);
			hssfCel5.setCellValue("");
			hssfCel0.setCellStyle(countStyle);
			hssfCel0.setCellValue("");
			
			setBorderStyle(BorderStyle.THIN,callRangeAddress5, sheet);
			setBorderStyle(BorderStyle.THIN,callRangeAddress6, sheet);
			setBorderStyle(BorderStyle.THIN,callRangeAddress7, sheet);
			setBorderStyle(BorderStyle.THIN,callRangeAddress8, sheet);
			setBorderStyle(BorderStyle.THIN,callRangeAddress9, sheet);
			// 5.输出
			workbook.write(fout);
//             workbook.close();
			// out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	public static void  setBorderStyle(BorderStyle border,CellRangeAddress region,HSSFSheet sheet){
		RegionUtil.setBorderBottom(BorderStyle.THIN,region, sheet);
		RegionUtil.setBorderLeft(BorderStyle.THIN,region, sheet);
		RegionUtil.setBorderRight(BorderStyle.THIN,region, sheet);
		RegionUtil.setBorderTop(BorderStyle.THIN,region, sheet);
	}

	/**
	 * @param workbook
	 * @param fontsize
	 * @return 单元格样式
	 */
	private static HSSFCellStyle createCellStyle(HSSFWorkbook workbook, short fontsize, boolean flag, boolean flag1) {
		// TODO Auto-generated method stub
		HSSFCellStyle style = workbook.createCellStyle();
		// 是否水平居中
		if (flag1) {
			style.setAlignment(HorizontalAlignment.CENTER);// 水平居中
		}
		style.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
		// 创建字体
		HSSFFont font = workbook.createFont();
		// 是否加粗字体
		if (flag) {
			font.setBold(true);
		}
		font.setFontHeightInPoints(fontsize);
		// 加载字体
		style.setFont(font);
		return style;
	}

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

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

相关文章

CSS 弹幕按钮动画

<template><view class="content"><button class="btn-23"><text class="text">弹幕按钮</text><text class="marquee">弹幕按钮</text></button></view></template><…

移动硬盘无法识别处理办法

今天这里做一下总结&#xff0c;我现在手上有一个移动硬盘&#xff0c;插入win10电脑是有盘号的&#xff0c;但是 但是点击就出问题 解决办法 安装DiskGenius 下载网址在https://www.diskgenius.cn/download.php 下载之后解压安装就行&#xff0c;非常简单&#xff0c;然后…

Provide/Inject 依赖注入(未完待续)

父组件传递给子组件数据&#xff0c;通过props&#xff0c;但是需要逐层传递 provide/Inject 的推出就是为了解决这个问题&#xff0c;它提供了一种组件之间共享此类值的方式,不必通过组件树每层级显示地传递props 目的是为了共享那些被 认为对于一个组件树而言是全局的数据 p…

【LeetCode: 57. 插入区间+分类讨论+模拟】

&#x1f680; 算法题 &#x1f680; &#x1f332; 算法刷题专栏 | 面试必备算法 | 面试高频算法 &#x1f340; &#x1f332; 越难的东西,越要努力坚持&#xff0c;因为它具有很高的价值&#xff0c;算法就是这样✨ &#x1f332; 作者简介&#xff1a;硕风和炜&#xff0c;…

12.3在应用层使用SPI总线

在SPI总线驱动框架中提供了一个spidev 的字符设备驱动&#xff0c;在应用层可以通过它来访问SPI总线。 应用层访问SPI总线的步骤 编写spidev设备树节点&#xff0c;在SPI总线的设备树节点下添加spidev设备的树节点&#xff0c;设备树示例如下所示&#xff1a; spidev0: spid…

ASCII编码:计算机文本通信的基石

ASCII&#xff08;美国信息交换标准代码&#xff09;编码是一种将字符与数字相互映射的编码系统&#xff0c;它为现代计算机文本通信奠定了基础。本文将从多个方面介绍ASCII编码的原理、发展历程、应用及其在现实场景中的优势&#xff0c;帮助您深入了解这一重要的编码技术。 …

C++进阶--红黑树

红黑树 一、红黑树的概念二、红黑树的性质三、红黑树结点的定义四、红黑树的插入五、红黑树的验证七、红黑树的查找七、红黑树与AVL树的比较七、完整代码RBTree.h 一、红黑树的概念 红黑树&#xff0c;是一种二叉搜索树&#xff0c;但在每个结点上增加一个存储位表示结点的颜色…

QT -狗狗管理工具

QT -狗狗管理工具 一、演示效果二、UML三、关键代码四、程序链接 一、演示效果 二、UML 三、关键代码 #include <QFrame> #include <QHBoxLayout> #include <QVBoxLayout> #include <QLabel> #include <QSizePolicy> #include <QDialog> …

【深度学习每日小知识】Computer Vision 计算机视觉

计算机视觉是人工智能的一个领域&#xff0c;涉及算法和系统的开发&#xff0c;使计算机能够解释、理解和分析来自周围世界的视觉数据。这包括从静态图像到视频流甚至 3D 环境的一切。 使用对象检测和特征提取等方法&#xff0c;计算机视觉本质上需要从视觉输入中提取有用信息…

大模型微调及生态简单介绍

大模型 大模型生态OpenAI大模型生态&#xff1a; 全球开源大模型性能评估榜单中文语言模型——ChatGLM基于ChatGLM的多模态⼤模型 大模型微调LLM⼤语⾔模型 ⼀般训练过程为什么需要微调高效微调技术⽅法概述⾼效微调⽅法一&#xff1a;LoRA微调方法高效微调⽅法⼆&#xff1a;P…

linux 网络设置

查看linux基础的网络配置 命令 网关route -nip 地址ifconfig / ip aDNS 服务器cat /etc/resolv.conf主机名hostname路由route -n网络连接状态ss / netstat 一&#xff0c;ifconfig 查看网络接口信息 &#xff08;一&#xff09;ifconfig …

C++|68.虚析构函数

文章目录 虚析构函数诞生的背景问题若创造一个子类的对象&#xff0c;并使用一个父类的指针指向/管理它&#xff0c;结果会如何解决方案——虚析构函数 虚析构函数诞生的背景 Derived继承了Base&#xff0c;Derived本身自带析构函数&#xff0c;而由于继承了Base&#xff0c;De…

openssl3.2 - quic服务的运行

文章目录 openssl3.2 - quic服务的运行概述笔记运行openssl编译好的quic服务程序todo - 如果自己编译quic服务工程END openssl3.2 - quic服务的运行 概述 在看 官方 guide目录下的工程. 都是客户端程序, 其中有quic客户端, 需要运行quic服务才行. openssl编译好的目录中有编译…

【Python】数据可视化--基于TMDB_5000_Movie数据集

一、数据准备 tmdb_5000_movie数据集下载 二、数据预处理 观察数据集合情况 import pandas as pd import ast import warnings warnings.filterwarnings(ignore) # 加载数据集 df pd.read_csv(tmdb_5000_movies.csv) # 查看数据集信息 print(df.info()) 由于原数据集包含的…

DM数据库安装注意事项

数据库安装注意事项 一、安装前 一些参数需要在数据库创建实例前找用户确认。 参数名参数掩码参数值备注数据页大小PAGE_SIZE32数据文件使用的页大小(缺省使用8K&#xff0c;建议默认&#xff1a;32)&#xff0c;可以为 4K、8K、16K 或 32K 之一&#xff0c;选择的页大小越大…

UCB Data100:数据科学的原理和技巧:第十六章到第十八章

十六、交叉验证和正则化 Cross Validation and Regularization 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 学习成果 认识到需要验证和测试集来预览模型在未知数据上的表现 应用交叉验证来选择模型超参数 了解 L1 和 L2 正则化的概念基础 在特征工程讲座结束时…

QT上位机开发(进度条操作)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 进度条是一个比较常见的控件。如果某个操作需要很长的时间才能完成&#xff0c;那么这个时候最好有一个进度条提示&#xff0c;这样比较容易平复一…

鸿蒙(HarmonyOS)应用开发指南

1. 概述 1.1 简介 鸿蒙&#xff08;即 HarmonyOS &#xff0c;开发代号 Ark&#xff0c;正式名称为华为终端鸿蒙智能设备操作系统软件&#xff09;是华为公司自 2012 年以来开发的一款可支持鸿蒙原生应用和兼容 AOSP 应用的分布式操作系统。该系统利用“分布式”技术将手机、电…

centos 7 上如何安装chrome 和chrome-driver

centos 7 上如何安装chrome 和chrome-driver 查找自己的服务器是什么系统 cat /etc/os-release这里以centos linux 7为例 下载google-chrome安装包 wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm安装chrome sudo yum localinstall go…

C++ 输入用户名和密码 防止注入攻击

1、问题解释&#xff1a;注入攻击 &#xff0c;无密码直接登录数据库 可视化展示 1.1、当你的数据库为&#xff1a;其中包含三个字段id user 以及md5密码 1.2、在使用C堆数据库信息进行访问的时候&#xff0c;使用多条语句进行查询 string sql "select id from t_user…