Mybatis行为配置之Ⅱ—结果相关配置项说明

专栏精选

引入Mybatis

Mybatis的快速入门

Mybatis的增删改查扩展功能说明

mapper映射的参数和结果

Mybatis复杂类型的结果映射

Mybatis基于注解的结果映射

Mybatis枚举类型处理和类型处理器

再谈动态SQL

文章目录

  • 专栏精选
  • 引言
  • 摘要
  • 正文
      • autoMappingBehavior
      • autoMappingUnknownColumnBehavior
      • lazyLoadingEnabled
      • aggressiveLazyLoading
      • lazyLoadTriggerMethods
      • multipleResultSetsEnabled
      • useColumnLabel
      • useGeneratedKeys
      • mapUnderscoreToCamelCase
  • 总结

引言

大家好,我是奇迹老李,一个专注于分享开发经验和基础教程的博主。欢迎来到我的频道,这里汇聚了汇集编程技巧、代码示例和技术教程,欢迎广大朋友们点赞评论提出意见,重要的是点击关注喔 🙆,期待在这里与你共同度过美好的时光🕹️。今天要和大家分享的内容是行为配置之Ⅱ—结果映射配置项说明。做好准备,Let’s go🚎🚀

摘要

在这篇文章中,我们将了解Mybatis的配置将如何影响结果映射的行为,其中,有的配置项很常见,有的配置项不常见,这些配置项会对我们的开发工作造成什么样的影响,我们又将如何通过修改这些配置来简化日常开发工作呢?准备好开启今天的神奇之旅吧

正文

首图

在Mybatis的行为配置项中,存在一系列的配置项用于控制Mybatis的结果映射行为,下面我们来一一介绍这些配置项

autoMappingBehavior

备注:设置如何将字段映射行为属性,可以在NONE、PARTIAL、FULL三个可选项中选择
默认值:PARTIAL
建议值:
建议原因:
选项说明:

配置说明
NONE不自动映射,必须通过 <resultMap>标签手动指定映射
PAERIAL只会自动映射没有定义嵌套结果映射的字段
FULL自动映射任何复杂的结果集(无论是否嵌套)

可通过一下代码测试NONE配置的行为

@Test  
public void testAutoMapBehavior() {  SqlSession session = this.sqlSessionFactory.openSession();  ApplicationRepository mapper = session.getMapper(ApplicationRepository.class);  AppTestEntity e1 = mapper.queryById(1L);  System.out.println(e1);
}

默认配置下的打印结果

AppTestEntity{id=1, appName='测试应用1', appCode='ceshi', authType='1', createDate=2023-10-31, creator='admin', appStatus='null', authTypeDict=null, appStatusDict=null, services=null}

配置 <setting name="autoMappingBehavior" value="NONE"/>下的打印结果

null

如果通过 resultMap的方式指定映射关系,在NONE配置下也能成功映射

添加resultMap映射

<resultMap id="appTestMap" type="top.sunyog.common.entity.AppTestEntity">  <result column="app_name" property="appName"/>  <result column="app_code" property="appCode"/>  <result column="auth_type" property="authType"/>  <result column="create_date" property="createDate"/>  
</resultMap><!--省略sql-->
<select id="queryById" resultMap="appTestMap">...</select>

配置 <setting name="autoMappingBehavior" value="NONE"/>下的打印结果

AppTestEntity{id=null, appName='测试应用1', appCode='ceshi', authType='1', createDate=2023-10-31, creator='null', appStatus='null', authTypeDict=null, appStatusDict=null, services=null}

注意:只有result标签指明的字段才能正确映射,没指明的不会映射出结果。

细节:这里可以通过 autoMapping属性实现局部的自动映射,来改变 autoMappingBehavior的配置行为

<resultMap id="appTestMap" type="top.sunyog.common.entity.AppTestEntity" autoMapping="true">
...
</resultMap>

配置 <setting name="autoMappingBehavior" value="NONE"/>下的打印结果

AppTestEntity{id=1, appName='测试应用1', appCode='ceshi', authType='1', createDate=2023-10-31, creator='admin', appStatus='3', authTypeDict=null, appStatusDict=null, services=null}

可以通过以下代码测试FULL配置的行为

public interface ApplicationRepository {AppVo queryAppVoById(Long id);
}//测试代码
public class EnvConfigTest {  private SqlSessionFactory sqlSessionFactory;@Test  public void testAutoMapFull(){  SqlSession session = this.sqlSessionFactory.openSession();  ApplicationRepository mapper = session.getMapper(ApplicationRepository.class);  AppVo e1 = mapper.queryAppVoById(1L);  System.out.println(e1);  }  
}
<mapper namespace="top.sunyog.mybatis.mapper.ApplicationRepository"><resultMap id="appVoMap" type="appVo" autoMapping="true">   <!--注意,这里的association内部没有设置自动映射--><association property="service" column="service_id" foreignColumn="id">  <id column="service_id" property="id"/>  <result column="service_name" property="serviceName"/>  </association>    </resultMap>    <select id="queryAppVoById" resultMap="appVoMap">  select t1.id,t1.app_name,t2.id as service_id,t2.service_name,t2.service_code,t2.service_path from app_test t1  left join service_test t2 on t1.id=t2.app_id  where t1.id=#{id}  </select>
</mapper>

默认配置状态下的打印结果

AppVo{id=1, appName='测试应用1', service=ServiceTestEntity{id=3, serviceName='注册中心', serviceCode='null', servicePath='null', appId=null}}

修改配置为 <setting name="autoMappingBehavior" value="FULL"/>后的结果

AppVo{id=1, appName='测试应用1', service=ServiceTestEntity{id=3, serviceName='注册中心', serviceCode='nacos-service', servicePath='/nacos', appId=null}}

因此,FULL可以实现复杂对象的自动映射

autoMappingUnknownColumnBehavior

备注:自动映射时,发现未知列/属性时的行为。可选值包括NONE、WARNING、FAILING
默认值:NONE
建议值:
建议原因:
选项说明:

配置说明
NONE无操作
WARNING打印警告日志,需要保证org.apache.ibatis.session.AutoMappingUnknownColumnBehavior的日志级别为warn
FAILING抛出 SqlSessionException 异常

测试代码使用上例 autoMappingBehavior中的 testAutoMapFull()方法,修改xml映射文件

<select id="queryAppVoById" resultType="appVo">

默认配置下的输出结果(仅输出打印)

AppVo{id=1, appName='测试应用1', service=null}

配置 <setting name="autoMappingUnknownColumnBehavior" value="WARNING"/>后的结果(输出错误日志)

 WARN [main] - Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_id,propertyName=service_id,propertyType=null]WARN [main] - Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_name,propertyName=service_name,propertyType=null]WARN [main] - Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_code,propertyName=service_code,propertyType=null]WARN [main] - Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_path,propertyName=service_path,propertyType=null]
AppVo{id=1, appName='测试应用1', service=null}

配置 <setting name="autoMappingUnknownColumnBehavior" value="FAILING"/>0后的结果(报错退出)

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.session.SqlSessionException: Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_id,propertyName=service_id,propertyType=null]
### The error may exist in mapper/ApplicationMapper.xml
### The error may involve top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById
### The error occurred while handling results
### SQL: select t1.id,t1.app_name,t2.id as service_id,t2.service_name,t2.service_code,t2.service_path         from app_test t1         left join service_test t2 on t1.id=t2.app_id         where t1.id=?
### Cause: org.apache.ibatis.session.SqlSessionException: Unknown column is detected on 'top.sunyog.mybatis.mapper.ApplicationRepository.queryAppVoById' auto-mapping. Mapping parameters are [columnName=service_id,propertyName=service_id,propertyType=null]

lazyLoadingEnabled

备注:延迟加载开关,设置关联查询的延迟加载。其中的关联查询即是通过<association><collection> 标签配置的关联查询
默认值:false(V3.4.1及之前版本为true)
建议值:true
建议原因:很多情况下我们只需要获取主查询中的结果,对关联查询的结果不关心,通过设置延迟加载可以减少不必要的查询。

为了测试这个配置需要修改mapper包的日志级别为 DEBUG

<Loggers>  <Logger name="top.sunyog.mybatis.mapper" level="debug"/>
<Loggers>

测试类

@Test  
public void testLazyLoad(){  SqlSession session = this.sqlSessionFactory.openSession();  SimpleQueryMapper mapper = session.getMapper(SimpleQueryMapper.class);  AppTestEntity entity = mapper.queryAppDetail(2);  System.out.println("主查询结束");  System.out.println("查询结果app_name="+entity.getAppName());System.out.println("获取子查询结果");  DictTest appStatusDict = entity.getAppStatusDict();  System.out.println("子查询结果app_status_dict="+appStatusDict);  
}

默认情况下(或 <setting name="lazyLoadingEnabled" value="false"/>)的输出结果(先完成所有查询,再输出app_name)

DEBUG [main] - ==>  Preparing: select t1.* ,t2.dict_code as auth_type_dc,t2.dict_name as auth_type_dn,t2.dict_type as auth_type_dt,t2.dict_sort as auth_type_ds from ( select id,app_name,app_code,auth_type,create_date,creator,app_status from app_test where id=? ) t1 left join ( select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_auth_type' ) t2 on t1.auth_type=t2.dict_code
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - ====>  Preparing: select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_status' and dict_code=?
DEBUG [main] - ====> Parameters: 0(String)
DEBUG [main] - <====      Total: 1
DEBUG [main] - ====>  Preparing: select * from service_test where app_id=?
DEBUG [main] - ====> Parameters: 2(Integer)
DEBUG [main] - <====      Total: 2
DEBUG [main] - <==      Total: 1
主查询结束
查询结果app_name=公共应用1
获取子查询结果
子查询结果app_status_dict=DictTest{dictName='临时应用', dictCode='0', dictType='app_status', dictSort=0}

配置 <setting name="lazyLoadingEnabled" value="true"/>下的输出(先执行主查询,再打印app_name,再执行后续必要的查询)

DEBUG [main] - ==>  Preparing: select t1.* ,t2.dict_code as auth_type_dc,t2.dict_name as auth_type_dn,t2.dict_type as auth_type_dt,t2.dict_sort as auth_type_ds from ( select id,app_name,app_code,auth_type,create_date,creator,app_status from app_test where id=? ) t1 left join ( select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_auth_type' ) t2 on t1.auth_type=t2.dict_code
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - <==      Total: 1
主查询结束
查询结果app_name=公共应用1
获取子查询结果
DEBUG [main] - ==>  Preparing: select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_status' and dict_code=?
DEBUG [main] - ==> Parameters: 0(String)
DEBUG [main] - <==      Total: 1
子查询结果app_status_dict=DictTest{dictName='临时应用', dictCode='0', dictType='app_status', dictSort=0}

细节:这里需要注意resultMap中设定的 fetchType属性,一个resultMap终端关联关系是否延迟加载取决于fetchType的设置,和整体配置无关。fetchType属性的可选值包括

  1. lazy:延迟加载
  2. eager:非延迟加载

如:可以修改这个resultMap,自定义appStatusDict属性延迟加载 services属性不延迟

<resultMap id="appDetail" type="appTestEntity" autoMapping="true">  ...<association fetchType="lazy" property="appStatusDict" javaType="dictTest" select="queryAppStatus" column="app_status"></association>  <collection fetchType="eager" property="services" column="id" select="queryServices" javaType="ArrayList" ofType="serviceTestEntity"/>  
</resultMap>

细节: 另一个需要注意的是 aggressiveLazyLoading这个配置 👇

aggressiveLazyLoading

备注:开启该配置后,查询结果对象的任意方法调用,都会触发延迟加载属性的加载
默认值:false
建议值:false
建议原因:
任意方法包括getter、setter方法,而getter、setter方法的调用频率极高。而Mybatis自动映射通过setter方法实现,因此开启这个配置后延迟加载也就相当于关闭了(包括fetchType)

开启此配置后,上例的测试代码输出内容直接锁定为

DEBUG [main] - ==>  Preparing: select t1.* ,t2.dict_code as auth_type_dc,t2.dict_name as auth_type_dn,t2.dict_type as auth_type_dt,t2.dict_sort as auth_type_ds from ( select id,app_name,app_code,auth_type,create_date,creator,app_status from app_test where id=? ) t1 left join ( select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_auth_type' ) t2 on t1.auth_type=t2.dict_code
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - ====>  Preparing: select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_status' and dict_code=?
DEBUG [main] - ====> Parameters: 0(String)
DEBUG [main] - <====      Total: 1
DEBUG [main] - ====>  Preparing: select * from service_test where app_id=?
DEBUG [main] - ====> Parameters: 2(Integer)
DEBUG [main] - <====      Total: 2
DEBUG [main] - <==      Total: 1
主查询结束
查询结果app_name=公共应用1
获取子查询结果
子查询结果app_status_dict=DictTest{dictName='临时应用', dictCode='0', dictType='app_status', dictSort=0}

即便设置了fetchType也失效

<resultMap id="appDetail" type="appTestEntity" autoMapping="true"><association fetchType="lazy" property="appStatusDict" javaType="dictTest" select="queryAppStatus" column="app_status"></association>  <collection fetchType="lazy" property="services" column="id" select="queryServices" javaType="ArrayList" ofType="serviceTestEntity"/>
</resultMap>

lazyLoadTriggerMethods

备注:指定对象的哪些方法触发延迟加载,方法名用 ,分隔
默认值:equals,clone,hashCode,toString
建议值:
建议原因:

继续修改方法的内容如下:

public class EnvConfigTest {  private SqlSessionFactory sqlSessionFactory;@Test  public void testLazyLoad(){  SqlSession session = this.sqlSessionFactory.openSession();  SimpleQueryMapper mapper = session.getMapper(SimpleQueryMapper.class);  AppTestEntity entity = mapper.queryAppDetail(2);  System.out.println("主查询结束");  System.out.println("查询结果app_name="+entity.getAppName());  int row = entity.hashCode();  
//        System.out.println("获取子查询结果");  
//        DictTest appStatusDict = entity.getAppStatusDict();  
//        System.out.println("子查询结果app_status_dict="+appStatusDict);  }  
}

默认配置下的输出:(hashCode方法被调用后,执行了所有的延迟加载)

DEBUG [main] - ==>  Preparing: select t1.* ,t2.dict_code as auth_type_dc,t2.dict_name as auth_type_dn,t2.dict_type as auth_type_dt,t2.dict_sort as auth_type_ds from ( select id,app_name,app_code,auth_type,create_date,creator,app_status from app_test where id=? ) t1 left join ( select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_auth_type' ) t2 on t1.auth_type=t2.dict_code
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - <==      Total: 1
主查询结束
查询结果app_name=公共应用1
DEBUG [main] - ==>  Preparing: select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_status' and dict_code=?
DEBUG [main] - ==> Parameters: 0(String)
DEBUG [main] - <==      Total: 1
DEBUG [main] - ==>  Preparing: select * from service_test where app_id=?
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - <==      Total: 2

修改配置 <setting name="lazyLoadTriggerMethods" value="toString"/>后的输出:( hashCode方法调用不再执行延迟加载)

DEBUG [main] - ==>  Preparing: select t1.* ,t2.dict_code as auth_type_dc,t2.dict_name as auth_type_dn,t2.dict_type as auth_type_dt,t2.dict_sort as auth_type_ds from ( select id,app_name,app_code,auth_type,create_date,creator,app_status from app_test where id=? ) t1 left join ( select dict_code,dict_name,dict_type,dict_sort from dict_test where dict_type='app_auth_type' ) t2 on t1.auth_type=t2.dict_code
DEBUG [main] - ==> Parameters: 2(Integer)
DEBUG [main] - <==      Total: 1
主查询结束
查询结果app_name=公共应用1

multipleResultSetsEnabled

备注:是否支持单次查询返回多个结果集,此配置需要数据库驱动的支持。Mysql数据库多结果集查询方法见[[Mybatis结果映射#collection集合类型的多结果集查询]]
默认值:true
建议值:不设置
建议原因:mysql-connector-javaV8数据库驱动中,此项配置无效

useColumnLabel

备注:是否使用列标签代替列名。依赖于数据库驱动
默认值:true
建议值:不设置
建议原因:mysql-connector-java数据库驱动中,此项配置无效
失效原因:
此项设置的区别在于,在对resultSet的处理过程中是调用 ResultSetMetaData#getColumnLabel方法还是 ResultSetMetaData#getColumnName方法,(源码见UnknownTypeHandler#resolveTypeHandlerResultSetWrapper构造方法
而对于mysql-connector-java来说,这两个方法最后都是调用的 Field#getName方法,部分源码如下

package com.mysql.cj.jdbc.result;
public class ResultSetMetaData implements java.sql.ResultSetMetaData {@Override  public String getColumnLabel(int column) throws SQLException {  if (this.useOldAliasBehavior) {  return getColumnName(column);  }  return getField(column).getColumnLabel();  }  @Override  public String getColumnName(int column) throws SQLException {  if (this.useOldAliasBehavior) {  return getField(column).getName();  }  String name = getField(column).getOriginalName();  if (name == null) {  return getField(column).getName();  }  return name;  }protected Field getField(int columnIndex) throws SQLException {  if ((columnIndex < 1) || (columnIndex > this.fields.length)) {  throw SQLError.createSQLException(Messages.getString("ResultSetMetaData.46"), MysqlErrorNumbers.SQL_STATE_INVALID_COLUMN_NUMBER,  this.exceptionInterceptor);  }  return this.fields[columnIndex - 1];  }
}package com.mysql.cj.result;
public class Field implements ProtocolEntity {public String getColumnLabel() {  return getName();  }public String getName() {  return this.columnName.toString();  }
}

useGeneratedKeys

备注:允许 JDBC 自动生成主键,需要数据库驱动支持。如果设置为 true,将强制使用自动生成主键。
默认值:false
建议值:不设置
建议原因:主键可通过代码自行生成。另外,mysql-connector-javaV8数据库驱动中,此项配置没有任何影响。

细节:简单的主键生成行为可以参考这篇博客,分布式主键生成方案可参考Twitter雪花算法。

mapUnderscoreToCamelCase

备注:是否开启驼峰命名自动映射
默认值:false
建议值:true
建议原因:可以减少 <resultMap>标签的使用

总结

在这篇文章中,我们介绍了关于Mybatis结果映射的配置项,这些配置项大多与 <resultMap>标签相关,可见,在Mybatis中ResultMap是一个重点。其中最常用的就是 mapUnderscoreToCamelCase这个配置,基本属于必开配置。


📩 联系方式
邮箱:qijilaoli@foxmail.com

❗版权声明
本文为原创文章,版权归作者所有。未经许可,禁止转载。更多内容请访问奇迹老李的博客首页

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

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

相关文章

关于设计模式、Java基础面试题

前言 之前为了准备面试&#xff0c;收集整理了一些面试题。 本篇文章更新时间2023年12月27日。 最新的内容可以看我的原文&#xff1a;https://www.yuque.com/wfzx/ninzck/cbf0cxkrr6s1kniv 设计模式 单例共有几种写法&#xff1f; 细分起来就有9种&#xff1a;懒汉&#x…

【中小型企业网络实战案例 四】配置OSPF动态路由协议

【中小型企业网络实战案例 三】配置DHCP动态分配地址-CSDN博客 【中小型企业网络实战案例 二】配置网络互连互通-CSDN博客 【中小型企业网络实战案例 一】规划、需求和基本配置_大小企业网络配置实例-CSDN博客 配置OSPF 由于内网互联使用的是静态路由&#xff0c;在链路出…

第八章 JPA和缓存

1.JPA 1.1.创建User实体类 public class User {private Integer uId;private String uName;private Integer uGender;private Integer uAge;private String uLoginname;private String uPassword;private Date uBirth;private String uEmail;private String uAddress; } 1.2…

走进电子技术之光敏电阻、电位器、开关

同学们大家好&#xff0c;今天我们继续学习杨欣的《电子设计从零开始》&#xff0c;这本书从基本原理出发&#xff0c;知识点遍及无线电通讯、仪器设计、三极管电路、集成电路、传感器、数字电路基础、单片机及应用实例&#xff0c;可以说是全面系统地介绍了电子设计所需的知识…

Redis 是如何执行的?

文章目录 命令执行流程步骤一&#xff1a;用户输入一条命令步骤二&#xff1a;客户端先将命令转换成 Redis 协议&#xff0c;然后再通过 socket 连接发送给服务器端步骤三&#xff1a;服务器端接收到命令步骤四&#xff1a;执行前准备步骤五&#xff1a;执行最终命令&#xff0…

牛客网SQL训练5—SQL大厂真题面试

文章目录 一、某音短视频1.各个视频的平均完播率2.平均播放进度大于60%的视频类别3.每类视频近一个月的转发量/率4.每个创作者每月的涨粉率及截止当前的总粉丝量5.国庆期间每类视频点赞量和转发量6.近一个月发布的视频中热度最高的top3视频 二、用户增长场景&#xff08;某度信…

idea Spring Boot项目使用JPA创建与数据库链接

1.pom.xml文件中添加依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><dependency><groupId>com.mysql</groupId><artifactId>…

文章智能改写伪原创方法技巧

哈喽&#xff0c;小伙伴们&#xff0c;大家好&#xff0c;我 又回来了。 今天给大家分享一个文章智能改写原创的方法&#xff0c;现在的自媒体平台&#xff0c;做视频流量挺不好做的&#xff0c;除非你有好的方法&#xff0c;文章呢&#xff0c;就相对比较容易点了&#xff0c;…

Graph Transformer2023最新研究成果汇总,附15篇必看论文

图Transformer是一种结合了Transformer模型和图神经网络&#xff08;GNN&#xff09;的框架&#xff0c;用于在图形结构数据上执行预测任务。在图Transformer中&#xff0c;Transformer的自注意力机制被用来学习节点之间的关系&#xff0c;而GNN则被用来生成节点的嵌入表示。通…

Qt学习:Qt的意义安装Qt

Qt 的简介 QT 是一个跨平台的 C图形用户界面应用程序框架。它为程序开发者提供图形界面所需的所有功能。它是完全面向对象的&#xff0c;很容易扩展&#xff0c;并且允许真正地组件编程。 支持平台 xP 、 Vista、Win7、win8、win2008、win10Windows . Unix/Linux: Ubuntu 等…

一、C++简介

C语言的发展史 1983年&#xff0c;贝尔实验室&#xff08;Bell Labs&#xff09;的Bjarne Stroustrup发明了C。 C在C语言的基础上进行了扩充和完善&#xff0c;是一种面向对象程序设计&#xff08;OOP&#xff09;语言。 Stroustrup说&#xff1a;“这个名字象征着源自于C语言变…

离线AI聊天清华大模型(ChatGLM3)本地搭建

在特定的情况下&#xff0c;要保证信息安全的同时还能享受到AIGC大模型带来的乐趣和功能&#xff0c;那么&#xff0c;离线部署就能帮助到你&#xff0c;最起码&#xff0c;它是一个真正可用的方案。 大模型本身清华的 (ChatGLM3)&#xff0c;为的是对中文支持友好&#xff0c…

爬虫基础一(持续更新)

爬虫概念&#xff1a; 通过编写程序&#xff0c;模拟浏览器上网&#xff0c;然后让其去互联网上抓取数据的过程 分类&#xff1a; 1&#xff0c;通用爬虫&#xff1a;抓取一整张页面数据 2&#xff0c;聚焦爬虫&#xff1a;抓取页面中的局部内容 3&#xff0c;增量式爬虫&…

NFC刷卡soc芯片SI3262集成刷卡+触摸+ACD超低功耗一体

简介 13.56mhz刷卡soc芯片SI3262集成刷卡触摸ACD超低功耗&#xff0c;ACD模式刷卡距离可达到5cm以上&#xff0c;非常适用于小体积门锁&#xff0c;密码锁&#xff0c;柜锁&#xff0c;接下来介绍一下这款芯片的具体功能。 优势 1.超低功耗&#xff0c;最低功耗达 1.7uA&…

【网络安全 | Misc】世安杯 适合作为桌面(Stegsolve及Winhex的使用)

正文 解压后得到图片&#xff1a; 图片属性正常&#xff0c;无特殊点&#xff0c;经测试&#xff0c;无隐写文件&#xff1a; Stegsolve 运行方法&#xff1a; 可以看到出现二维码&#xff1a; 对其解密得到&#xff1a; 03F30D0A79CB05586300000000000000000100000040000000…

【起草】【第六章】ChatGPT 在软件测试的应用场景

6.1 、引言 & 背景 在测试领域&#xff0c;AIGC 的爆发引发了对其在软件测试中的应用可能性的广泛研究和探讨。传统的软件测试方法往往需要大量的人力和时间投入&#xff0c;而 AIGC 技术的引入可能为测试领域带来革命性的变化。AIGC 在测试中的优势在于其高效的自动化能力…

R语言学习笔记-R包的安装

推荐在线安装&#xff0c;可以解决包与包之间的依赖关系。 1.首先在RGui&#xff1a; 2.在RStudio 的console下&#xff1a; 如安装ggplot2包&#xff0c;则&#xff1a; install.packages("ggplot2") 生信方面&#xff1a; 首先安装&#xff1a; install.packa…

HDFS客户端UnknownHostException事故解析

文章目录 前言事故现场问题分析是否是整个域名解析服务当时都出问题了是否是出问题的pods本身的域名解析有问题 异常发生的全部过程域名的解析是什么时候发生的&#xff0c;怎么发生的域名解析的详细流程 重试发生在什么地方为什么重试会无效 Bugfix代码详解关于StandardHostRe…

jenkins解决工具找不到的问题

--------------------------插件选择版本最好能跟服务器对上

腾讯云服务器怎么买划算?最新优惠价格表

2023腾讯云轻量应用服务器优惠价格表&#xff0c;12月最新报价&#xff0c;腾讯云轻量2核2G3M带宽62元一年、2核2G4M轻量服务器118元一年&#xff0c;540元三年、2核4G5M带宽218元一年&#xff0c;756元三年、4核8G12M轻量服务器646元15个月&#xff0c;CVM云服务器S5实例2核2G…