如何使用 SQL 语句创建一个 MySQL 数据库的表,以及对应的 XML 文件和 Mapper 文件
文章目录
- 1、SQL 脚本语句
- 2、XML 文件
- 3、Mapper 文件
- 4、启动 ServiceInit 文件
- 5、DataService 文件
- 6、ComplianceDBConfig 配置文件
这个方式通常是放在项目代码中,使用配置在项目的启动时创建表格,SQL 语句放到一个 XML 文件中。在Spring 项目启动时,通过配置的方式和 Bean的方式进行加载,并创建文件,同时做了些部分延伸。
1、SQL 脚本语句
DROP TABLE IF EXISTS `user_online_detail_${tableSuffix}`;
CREATE TABLE `user_online_detail_${tableSuffix}` (
`id` bigint(20) NOT NULL COMMENT 'id',
`uid` bigint(20) DEFAULT NULL COMMENT '用户id',
`login_type` int(11) DEFAULT NULL COMMENT '端类型',
`company` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '公司name',
`company_id` char(36) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '公司id',
`online_time` bigint(20) DEFAULT NULL COMMENT '上线时间',
`offline_time` bigint(20) DEFAULT NULL COMMENT '下线时间',
`current_state` int(11) DEFAULT NULL COMMENT '当前状态',
`accumulated_duration` bigint(20) DEFAULT NULL COMMENT '累计时长',
`create_time` bigint(20) DEFAULT NULL COMMENT '记录创建时间',
`update_time` bigint(20) DEFAULT NULL COMMENT '记录修改时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `uid`(`uid`) USING BTREE,
INDEX `login_type`(`login_type`) USING BTREE,
INDEX `company`(`company`) USING BTREE,
INDEX `create_time`(`create_time`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = Compact;
注意事项:
user_online_detail_${tableSuffix}:tableSuffix是表后缀,用于分库分表使用。bigint(20):常用于Double类型,用作金额等。PRIMARY KEY (id) USING BTREE:创建主键并整加索引,便于搜索,使用BTREE索引。ENGINE = InnoDB:指定数据库引擎。CHARACTER SET = utf8:设定字符集。
2、XML 文件
- 通常开发中,所有的
update和insert都要使用批量的方式。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wen.mapper.compliance.OnlineUserMapper"><resultMap id="BaseResultMap" type="com.wen.dto.UserInfoDto"><id column="id" jdbcType="BIGINT" property="id"/><result column="uid" jdbcType="BIGINT" property="uid"/><result column="login_type" jdbcType="INTEGER" property="loginType"/><result column="company" jdbcType="VARCHAR" property="company"/><result column="company_id" jdbcType="CHAR" property="companyId"/><result column="online_time" jdbcType="BIGINT" property="onlineTime"/><result column="offline_time" jdbcType="BIGINT" property="offlineTime"/><result column="current_state" jdbcType="INTEGER" property="currentState"/><result column="accumulated_duration" jdbcType="BIGINT" property="accumulatedDuration"/><result column="create_time" jdbcType="BIGINT" property="createTime"/><result column="update_time" jdbcType="BIGINT" property="updateTime"/></resultMap><sql id="Base_Column_List">id, uid, login_type, company, company_id, online_time, offline_time, current_state,accumulated_duration, create_time, update_time</sql><select id="selectOnlineUserInfoByUid" resultMap="BaseResultMap">SELECTid, uid, login_type, company, company_id, online_time, offline_time, current_state, accumulated_duration, create_time, update_timeFROMuser_online_detail_${tableSuffix}WHERE<if test="user != null and user.size() > 0">(uid, login_type, company) in<foreach collection="user" separator="," open="(" close=")" item="u">(#{u.uid}, #{u.loginType}, #{u.company})</foreach></if></select><insert id="insertOnlineUserInfo" parameterType="com.wen.dto.UserInfoDto">INSERT INTOuser_online_detail_${tableSuffix}(id, uid, login_type, company, company_id, online_time, offline_time, current_state, accumulated_duration, create_time, update_time)VALUES<foreach collection="infoList" item="info" separator=",">(#{info.id,jdbcType=BIGINT}, #{info.uid,jdbcType=BIGINT}, #{info.loginType,jdbcType=INTEGER}, #{info.company,jdbcType=VARCHAR}, #{info.companyId,jdbcType=CHAR}, #{info.onlineTime,jdbcType=BIGINT}, #{info.offlineTime,jdbcType=BIGINT}, #{info.currentState,jdbcType=INTEGER}, #{info.accumulatedDuration,jdbcType=BIGINT}, #{info.createTime,jdbcType=BIGINT},#{info.updateTime,jdbcType=BIGINT})</foreach></insert><update id="updateOnlineUserInfo"><foreach collection="infoList" item="info" separator=";">UPDATEuser_online_detail_${tableSuffix}<set><if test="info.company != null">company = #{info.company,jdbcType=VARCHAR},</if><if test="info.companyId != null">company_id = #{info.companyId,jdbcType=CHAR},</if><if test="info.onlineTime != null">online_time = #{info.onlineTime,jdbcType=BIGINT},</if><if test="info.offlineTime != null">offline_time = #{info.offlineTime,jdbcType=BIGINT},</if><if test="info.currentState != null">current_state = #{info.currentState,jdbcType=INTEGER},</if><if test="info.updateTime != null">update_time = #{info.updateTime,jdbcType=BIGINT},</if><if test="info.accumulatedDuration != null">accumulated_duration = #{info.accumulatedDuration,jdbcType=BIGINT}</if></set>WHERE id = #{info.id}</foreach></update><select id="getOnlineUserIdByPageHelper" resultType="com.wen.dto.UidDto">SELECTuid, MAX(create_time) as create_timeFROMuser_online_detail_${tableSuffix}WHEREcompany = #{company}<if test="uid != null">and uid = #{uid}</if>GROUP BY uidORDER BY create_time desc</select><select id="getOnlineUserListByUserId" resultMap="BaseResultMap">SELECTid, uid, login_type, company, company_id, online_time, offline_time, current_state, accumulated_duration, create_time, update_timeFROMuser_online_detail_${tableSuffix}WHEREcreate_time <![CDATA[>=]]> #{startTime} AND create_time <![CDATA[<=]]> #{endTime}<if test="uidList.size() > 0">AND uid in<foreach collection="uidList" open="(" close=")" item="uid" separator=",">#{uid}</foreach></if><if test="loginEquip != 0">AND login_type = #{loginEquip}</if><if test="equipState == 0">AND current_state != 5</if><if test="equipState == 1">AND current_state = 5</if></select></mapper>
3、Mapper 文件
@Mapper:这个注解一般是加到配置文件中,用于扫描一个包下的所有 mapper 文件。
@Mapper
public interface OnlineUserMapper {List<UserInfoDto> selectOnlineUserInfoByUid(@Param("user") List<QueryUidDto> user, @Param("tableSuffix") int tableSuffix);// 批量方式void insertOnlineUserInfo(@Param("infoList") List<UserInfoDto> infoList, @Param("tableSuffix") int tableSuffix);// 批量方式void updateUserInfo(@Param("infoList") List<UserInfoDto> infoList, @Param("tableSuffix") int tableSuffix);List<UidDto> getOnlineUserIdByPageHelper(@Param("uid") Long uid, @Param("company") String company, @Param("tableSuffix") int tableSuffix);// 批量方式List<UserInfoDto> getOnlineUserListByUserId(@Param("uidList") List<Long> uidList,@Param("startTime") long startTime,@Param("endTime") long endTime,@Param("loginEquip") int loginEquip,@Param("equipState") int equipState,@Param("tableSuffix") int tableSuffix);}
4、启动 ServiceInit 文件
- 该文件作为程序启动时加载。
@Slf4j
@Component
public class ServerInit {@Value("${runScript}")private boolean runScript;@Value("${runScriptDB}")private String dbList;@PostConstructpublic void run() {log.info("-------------------runScript start!------------------------");this.runScript();log.info("-------------------runScript end!------------------------");}// 启动方法public void runScript() {if (runScript) {String[] dbs = dbList.split(",");if(ArrayUtil.isEmpty(dbs)) {return;}dataService.runScript(new ArrayList<>(Arrays.asList(dbs)));}}
}
5、DataService 文件
- 启动时如何创建表格,创建多少个表格,表的名字如何设置。
public interface IDataService {void runScript(List<String> dbList);@Overridepublic void runScript(List<String> dbList) {try {if (dbList.contains("compliance")) {for (int i = 0; i < 10; i++) {complianceSchemaMapper.runScript(String.valueOf(i));log.info("complianceSchemaMapper runScript num {} completed", i);}complianceSchemaMapper.runSingleScript();log.info("complianceSchemaMapper runScript completed");}log.info("all runScript completed");} catch (Exception ex) {log.error("runScript error", ex);}}
}
6、ComplianceDBConfig 配置文件
- 这个文件比较复杂,可作为参考,可做权限控制,根据登陆时的 ID 进行权限判断。
@Slf4j
@Configuration
@MapperScan(basePackages = {"com.wen.server.mapper.compliance"}, sqlSessionTemplateRef = "complianceSessionTemplate")
public class ComplianceDBConfig {@Value("${spring.profiles.active}")private String active;@Value("${spring.datasource.compliance.url}")private String url;@Value("${spring.datasource.compliance.username}")private String username;@Value("${spring.datasource.compliance.driver-class-name}")private String driverClassName;@Value("${spring.datasource.compliance.passwdServer}")private String passwdServer;@Value("${spring.datasource.compliance.password}")private String password;@Value("${spring.datasource.compliance.maxWait}")private long maxWait;@Value("${spring.datasource.compliance.phyTimeoutMillis}")private long phyTimeoutMillis;@Value("${spring.datasource.compliance.minEvictableIdleTimeMillis}")private long minEvictableIdleTimeMillis;@Value("${spring.datasource.compliance.minIdle}")private int minIdle;@Value("${spring.datasource.compliance.maxActive}")private int maxActive;@Value("${spring.datasource.compliance.initialSize}")private int initialSize;@Value("${spring.datasource.compliance.timeBetweenEvictionRunsMillis}")private long timeBetweenEvictionRunsMillis;@Value("${spring.datasource.compliance.testWhileIdle}")private boolean testWhileIdle;@Value("${spring.datasource.compliance.testOnBorrow}")private boolean testOnBorrow;@Value("${spring.datasource.compliance.testOnReturn}")private boolean testOnReturn;@Value("${spring.datasource.compliance.validationQueryTimeout}")private int validationQueryTimeout;@Value("${spring.datasource.compliance.connectTimeout}")private int connectTimeout;@Value("${spring.datasource.compliance.socketTimeout}")private int socketTimeout;@Value("${spring.datasource.compliance.fetchSize}")private int fetchSize;private static final String IP_REGEX = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";@Bean(name = "complianceDataSource")public DataSource mysqlDataSource() {DruidDataSource druidDataSource = new DruidDataSource();druidDataSource.setDriverClassName(driverClassName);druidDataSource.setUsername(username);druidDataSource.setUrl(url);druidDataSource.setMaxWait(maxWait);druidDataSource.setPhyTimeoutMillis(phyTimeoutMillis);druidDataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);druidDataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);druidDataSource.setInitialSize(initialSize);druidDataSource.setMinIdle(minIdle);druidDataSource.setMaxActive(maxActive);druidDataSource.setTestWhileIdle(testWhileIdle);druidDataSource.setTestOnBorrow(testOnBorrow);druidDataSource.setTestOnReturn(testOnReturn);druidDataSource.setValidationQueryTimeout(validationQueryTimeout);druidDataSource.setConnectTimeout(connectTimeout);druidDataSource.setSocketTimeout(socketTimeout);if (!active.equals("dev")) {druidDataSource.setPasswordCallback(druidPasswordCallback());} else {druidDataSource.setPassword(password);}return druidDataSource;}@Bean(name = "complianceSessionFactory")public SqlSessionFactory mysqlSessionFactory(@Qualifier("complianceDataSource") DataSource dataSource) throws Exception {//如果用的是mybatis-plus 一定得是 MybatisSqlSessionFactoryBean//否则无法识别 mybatis-plus扩展的一些接口,如:selectList, selectOne, selectMap ..., 并出现invalid bound ExceptionMybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();bean.setDataSource(dataSource);//分页插件PageInterceptor pageHelper = new PageInterceptor();Properties properties = new Properties();properties.setProperty("reasonable", "true");properties.setProperty("supportMethodsArguments", "true");properties.setProperty("returnPageInfo", "check");pageHelper.setProperties(properties);//添加插件bean.setPlugins(pageHelper);bean.addMapperLocations(new PathMatchingResourcePatternResolver().getResources("file:./config/*Mapper.xml"));bean.addMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mybatis/compliance/*.xml"));MybatisConfiguration conf = new MybatisConfiguration();
// conf.setLogImpl(Slf4jImpl.class);conf.setDefaultFetchSize(fetchSize);addInterceptor(conf);bean.setConfiguration(conf);return bean.getObject();}private static void addInterceptor(MybatisConfiguration conf) {DeptDataPermissionRule rule = new DeptDataPermissionRule() {private final Set<String> userTables = new HashSet<>(Arrays.asList("user_0", "user_1", "user_2", "user_3", "user_4", "user_5", "user_6", "user_7", "user_8", "user_9"));private final Set<String> deptTables = new HashSet<>(Arrays.asList("dept_0", "dept_1", "dept_2", "dept_3", "dept_4", "dept_5", "dept_6", "dept_7", "dept_8", "dept_9"));private final Set<String> onlineUserTables = new HashSet<>(Arrays.asList("user_online_detail_0", "user_online_detail_1", "user_online_detail_2", "user_online_detail_3", "user_online_detail_4", "user_online_detail_5", "user_online_detail_6", "user_online_detail_7", "user_online_detail_8", "user_online_detail_9"));@Overridepublic boolean matches(String tableName) {return userTables.contains(tableName) || deptTables.contains(tableName) || isOnlineUserTables(tableName);}private boolean isUserTable(String tableName) {return userTables.contains(tableName);}private boolean isDeptTable(String tableName) {return deptTables.contains(tableName);}private boolean isOnlineUserTables(String tableName) { return userTables.contains(tableName);}@Overrideprotected Expression getExpression(String tableName, Alias tableAlias, CurrentUser loginUser, DeptDataPermission deptDataPermission) {Integer currentPage = UserHolder.getCurrentUser().getCurrentPage();if (isUserTable(tableName))return buildUserExpression(tableName, tableAlias, deptDataPermission.getDeptIds(currentPage));else if (isDeptTable(tableName))return buildDeptExpression(tableName, tableAlias, deptDataPermission.getDeptIds(currentPage));else if (isUserTables(tableName))return buildOnlineUserExpression(tableName, tableAlias, deptDataPermission.getUserIds(currentPage));return EXPRESSION_NULL;}private Expression buildOnlineUserExpression(String tableName, Alias tableAlias, Set<Long> userIds) {String columnName = getColumnName(tableName);if (StrUtil.isEmpty(columnName)) {return null;}if (CollUtil.isEmpty(userIds)) {return EXPRESSION_NULL;}return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName),// Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号new Parenthesis(new ExpressionList<>(convertList(userIds, LongValue::new))));}private Expression buildDeptExpression(String tableName, Alias tableAlias, Set<Long> deptIds) {// 如果不存在配置,则无需作为条件String columnName = getColumnName(tableName);if (StrUtil.isEmpty(columnName)) {return null;}// 如果为空,则无条件if (CollUtil.isEmpty(deptIds)) {return EXPRESSION_NULL;}// 拼接条件return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName),// Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号new Parenthesis(new ExpressionList<>(convertList(deptIds, LongValue::new))));}private Expression buildUserExpression(String tableName, Alias tableAlias, Set<Long> deptIds) {String columnName = getColumnName(tableName);if (StrUtil.isEmpty(columnName)) {return null;}if (CollUtil.isEmpty(deptIds)) {return new EqualsTo(MyBatisUtils.buildColumn(tableName, tableAlias, "uid"), new LongValue(UserHolder.getCurrentUser().getUserId()));}return new InExpression(MyBatisUtils.buildColumn(tableName, tableAlias, columnName),// Parenthesis 的目的,是提供 (1,2,3) 的 () 左右括号new Parenthesis(new ExpressionList<>(convertList(deptIds, LongValue::new))));}private String getColumnName(String tableName) {if (StrUtil.isBlank(tableName)) {return null;}if (isUserTable(tableName)) {return "dept_id";}if (isDeptTable(tableName)) {return "dept_id";}if (isOnlineUserTables(tableName) ) {return "uid";}return null;}};DataPermissionRuleHandler handler = new DataPermissionRuleHandler(new DataPermissionRuleFactoryImpl(Arrays.asList(rule)));DataPermissionInterceptor inner = new DataPermissionInterceptor(handler);MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();mybatisPlusInterceptor.addInnerInterceptor(inner);conf.addInterceptor(mybatisPlusInterceptor);}@Bean("complianceTransactionManager")@Primarypublic DataSourceTransactionManager mysqlTransactionManager(@Qualifier("complianceDataSource") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}@Bean("complianceSessionTemplate")public SqlSessionTemplate mysqlSessionTemplate(@Qualifier("complianceSessionFactory") SqlSessionFactory sqlSessionFactory) {return new SqlSessionTemplate(sqlSessionFactory);}public DruidPasswordCallback druidPasswordCallback() {return new DruidPasswordCallback() {@Overridepublic void setProperties(Properties properties) {String pwd = PasswordServiceHelper.getLastedPassword(passwdServer, username);if (StrUtil.isBlank(pwd)) {log.error("**COMPLIANCE_DB** 密码服务未拿到密码");} else {log.info("**COMPLIANCE_DB** get password from password service ok! password: {}", pwd);}setPassword(pwd.toCharArray());}};}
}
相关文章:
如何使用 SQL 语句创建一个 MySQL 数据库的表,以及对应的 XML 文件和 Mapper 文件
文章目录 1、SQL 脚本语句2、XML 文件3、Mapper 文件4、启动 ServiceInit 文件5、DataService 文件6、ComplianceDBConfig 配置文件 这个方式通常是放在项目代码中,使用配置在项目的启动时创建表格,SQL 语句放到一个 XML 文件中。在Spring 项目启动时&am…...
Unity性能优化---动态网格组合(二)
在上一篇中,组合的是同一个材质球的网格,如果其中有不一样的材质球会发生什么?如下图: 将场景中的一个物体替换为不同的材质球 运行之后,就变成了相同的材质。 要实现组合不同材质的网格步骤如下: 在父物体…...
JVM学习《垃圾回收算法和垃圾回收器》
目录 1.垃圾回收算法 1.1 标记-清除算法 1.2 复制算法 1.3 标记-整理算法 1.4 分代收集算法 2.垃圾回收器 2.1 熟悉一下垃圾回收的一些名词 2.2 垃圾回收器有哪些? 2.3 Serial收集器 2.4 Parallel Scavenge收集器 2.5 ParNew收集器 2.6 CMS收集器 1.垃圾…...
GPS模块/SATES-ST91Z8LR:电路搭建;直接用电脑的USB转串口进行通讯;模组上报定位数据转换地图识别的坐标手动查询地图位置
从事嵌入式单片机的工作算是符合我个人兴趣爱好的,当面对一个新的芯片我即想把芯片尽快搞懂完成项目赚钱,也想着能够把自己遇到的坑和注意事项记录下来,即方便自己后面查阅也可以分享给大家,这是一种冲动,但是这个或许并不是原厂希望的,尽管这样有可能会牺牲一些时间也有哪天原…...
什么是TCP的三次握手
TCP(传输控制协议)的三次握手是一个用于在两个网络通信的计算机之间建立连接的过程。这个过程确保了双方都有能力接收和发送数据,并且初始化双方的序列号。以下是三次握手的详细步骤: 第一次握手(SYN)&…...
《Clustering Propagation for Universal Medical Image Segmentation》CVPR2024
摘要 这篇论文介绍了S2VNet,这是一个用于医学图像分割的通用框架,它通过切片到体积的传播(Slice-to-Volume propagation)来统一自动(AMIS)和交互式(IMIS)医学图像分割任务。S2VNet利…...
Linux ifconfig ip 命令详解
简介 ifconfig 和 ip 命令用于配置和显示 Linux 上的网络接口。虽然 ifconfig 是传统工具,但现在已被弃用并被提供更多功能的 ip 命令取代。 ifconfig 安装 sudo apt install net-toolssudo yum install net-tools查看所有活动的网络接口 ifconfig启动/激活网络…...
Vue3 对于echarts使用 v-show,导致显示不全,宽度仅100px,无法重新渲染的问题
参考链接:解决Echarts图表使用v-show,显示不全,宽度仅100px的问题_echarts v-show图表不全-CSDN博客 Vue3 echarts v-show无法重新渲染的问题_v-show echarts不渲染-CSDN博客 原因不多赘述了,大概就是v-show 本身是结构已经存在,当数据发生…...
C++实现俄罗斯方块
俄罗斯方块 还记得俄罗斯方块吗?相信这是小时候我们每个人都喜欢玩的一个小游戏。顾名思义,俄罗斯方块自然是俄罗斯人发明的。这人叫阿列克谢帕基特诺夫。他设置这个游戏的规则是:由小方块组成的不同形状的板块陆续从屏幕上方落下来…...
鸿蒙分享:添加模块,修改app名称图标
新建公共模块common 在entry的oh-package.json5添加dependencies,引入common模块 "dependencies": {"common": "file:../common" } 修改app名称: common--src--resources--string.json 新增: {"name&q…...
扫描IP段内的使用的IP
扫描IP段内的使用的IP 方法一:命令行 命令行进入 for /L %i IN (1,1,254) DO ping -w 1 -n 1 192.168.3.%iarp -a方法二:python from scapy.all import ARP, Ether, srp import keyboarddef scan_network(ip_range):# 创建一个ARP请求包arp ARP(pds…...
【专题】虚拟存储器
前文提到的存储器管理方式有一个共同的特点,即它们都要求将一个作业全部装入内存后方能运行。 但有两种特殊情况: 有的作业很大,其所要求的内存空间超过了内存总容量,作业不能全部被装入内存,致使该作业无法运行&#…...
Python之爬虫入门--示例(2)
一、Requests库安装 可以使用命令提示符指令直接安装requests库使用 pip install requests 二、爬取JSON数据 (1)、点击网络 (2)、刷新网页 (3)、这里有一些数据类型,选择全部 (…...
5G CPE终端功能及性能评测(四)
5G CPE 功能性能评测 本文选取了几款在工业应用领域应用较多的5G CPE,对其功能和性能进行了对比评测。功能方面主要对比了网络接口数量,VPN功能 支持情况。以下测试为空口测试,测试结果受环境影响较大,性能仅供参考。总体看,高通X55芯片下行最优,速率稳定。 功能 对比CPE…...
人工智能驱动的骗局会模仿熟悉的声音
由于人工智能技术的进步,各种现代骗局变得越来越复杂。 这些骗局现在包括人工智能驱动的网络钓鱼技术,即使用人工智能模仿家人或朋友的声音和视频。 诈骗者使用来自社交媒体的内容来制作深度伪造内容,要求提供金钱或个人信息。个人应该通过…...
电子病历静态数据脱敏路径探索
一、引言 数据脱敏(Data Masking),屏蔽敏感数据,对某些敏感信息(比如patient_name、ip_no、ad、no、icd11、drug等等 )通过脱敏规则进行数据的变形,实现隐私数据的可靠保护。电子病历作为医疗领…...
混合云策略在安全领域受到青睐
Genetec 发布了《2025 年物理安全状况报告》,该报告根据超过 5,600 名该领域领导者(其中包括 100 多名来自澳大利亚和新西兰的领导者)的回应,揭示了物理安全运营的趋势。 报告发现,澳大利亚和新西兰的组织采用混合云策…...
Echarts使用平面方法绘制三维立体柱状图表
目录 一、准备工作 1.下载引入ECharts库 2.创建容器 二、绘制基本柱状 三、绘制立体柱状方法一 1.定义立方体形状 2.注册立方体形状 3.配置custom系列 4.设置数据 5.渲染图表 四、绘制立体柱状方法二 1.画前知识 2.计算坐标renderItem 函数 (1&#x…...
java-判断语句
题目一:选择练习1 657. 选择练习1 - AcWing题库 代码 import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc new Scanner(System.in);int a sc.nextInt(), b sc.nextInt();int c sc.nextInt(), d sc.nextInt();…...
11.14【JAVA EXP3】【DEBUG】
比较疑惑的一点是当前页面(资源的url)与请求的url? 请求的url由webService接收,servelt当中也可以发送出这个url 进行页面跳转,是跳转到某个Jsp页面,这个页面的url是在哪里定义的? 在Jsp打印信息,这个报…...
Vue3 + Element Plus + TypeScript中el-transfer穿梭框组件使用详解及示例
使用详解 Element Plus 的 el-transfer 组件是一个强大的穿梭框组件,常用于在两个集合之间进行数据转移,如权限分配、数据选择等场景。下面我将详细介绍其用法并提供一个完整示例。 核心特性与用法 基本属性 v-model:绑定右侧列表的值&…...
【ROS】Nav2源码之nav2_behavior_tree-行为树节点列表
1、行为树节点分类 在 Nav2(Navigation2)的行为树框架中,行为树节点插件按照功能分为 Action(动作节点)、Condition(条件节点)、Control(控制节点) 和 Decorator(装饰节点) 四类。 1.1 动作节点 Action 执行具体的机器人操作或任务,直接与硬件、传感器或外部系统…...
C++中string流知识详解和示例
一、概览与类体系 C 提供三种基于内存字符串的流,定义在 <sstream> 中: std::istringstream:输入流,从已有字符串中读取并解析。std::ostringstream:输出流,向内部缓冲区写入内容,最终取…...
select、poll、epoll 与 Reactor 模式
在高并发网络编程领域,高效处理大量连接和 I/O 事件是系统性能的关键。select、poll、epoll 作为 I/O 多路复用技术的代表,以及基于它们实现的 Reactor 模式,为开发者提供了强大的工具。本文将深入探讨这些技术的底层原理、优缺点。 一、I…...
3-11单元格区域边界定位(End属性)学习笔记
返回一个Range 对象,只读。该对象代表包含源区域的区域上端下端左端右端的最后一个单元格。等同于按键 End 向上键(End(xlUp))、End向下键(End(xlDown))、End向左键(End(xlToLeft)End向右键(End(xlToRight)) 注意:它移动的位置必须是相连的有内容的单元格…...
OPENCV形态学基础之二腐蚀
一.腐蚀的原理 (图1) 数学表达式:dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一,腐蚀跟膨胀属于反向操作,膨胀是把图像图像变大,而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...
R语言速释制剂QBD解决方案之三
本文是《Quality by Design for ANDAs: An Example for Immediate-Release Dosage Forms》第一个处方的R语言解决方案。 第一个处方研究评估原料药粒径分布、MCC/Lactose比例、崩解剂用量对制剂CQAs的影响。 第二处方研究用于理解颗粒外加硬脂酸镁和滑石粉对片剂质量和可生产…...
【Go语言基础【12】】指针:声明、取地址、解引用
文章目录 零、概述:指针 vs. 引用(类比其他语言)一、指针基础概念二、指针声明与初始化三、指针操作符1. &:取地址(拿到内存地址)2. *:解引用(拿到值) 四、空指针&am…...
MySQL 8.0 事务全面讲解
以下是一个结合两次回答的 MySQL 8.0 事务全面讲解,涵盖了事务的核心概念、操作示例、失败回滚、隔离级别、事务性 DDL 和 XA 事务等内容,并修正了查看隔离级别的命令。 MySQL 8.0 事务全面讲解 一、事务的核心概念(ACID) 事务是…...
【安全篇】金刚不坏之身:整合 Spring Security + JWT 实现无状态认证与授权
摘要 本文是《Spring Boot 实战派》系列的第四篇。我们将直面所有 Web 应用都无法回避的核心问题:安全。文章将详细阐述认证(Authentication) 与授权(Authorization的核心概念,对比传统 Session-Cookie 与现代 JWT(JS…...
