MyBatis持久层实现

MyBatis持久层实现

package com.example.usermanagement.mapper;import com.example.usermanagement.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;/*** 用户Mapper接口* @Mapper: 标识这是MyBatis的Mapper接口*/
@Mapper
public interface UserMapper {// 插入用户int insert(User user);// 根据ID删除用户int deleteById(Long id);// 更新用户信息int update(User user);// 根据ID查询用户User selectById(Long id);// 根据用户名查询用户User selectByUsername(String username);// 查询所有用户List<User> selectAll();// 分页查询用户List<User> selectByPage(@Param("offset") Integer offset,@Param("limit") Integer limit);// 统计用户总数int count();/*** 根据邮箱查询用户* @param email 邮箱地址* @return 用户信息*/User selectByEmail(String email);List<User> searchByUsername(@Param("username") String username,@Param("offset") int offset,@Param("limit") int limit);int countByUsername(@Param("username") String username);
}
<?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.example.usermanagement.mapper.UserMapper"><!-- 结果映射:定义数据库字段与实体类属性的映射关系 --><resultMap id="BaseResultMap" type="com.example.usermanagement.entity.User"><id column="id" property="id"/><result column="username" property="username"/><result column="password" property="password"/><result column="email" property="email"/><result column="phone" property="phone"/><result column="status" property="status"/><result column="score" property="score"/><result column="create_time" property="createTime"/><result column="update_time" property="updateTime"/></resultMap><!-- 基础字段列表 --><sql id="Base_Column_List">id, username, password, email, phone, status, score, create_time, update_time</sql><!-- 插入用户 --><!-- 原来的写法 --><insert id="insert" parameterType="com.example.usermanagement.entity.User"useGeneratedKeys="true" keyProperty="id">INSERT INTO user (username, password, email, phone, status, score)VALUES (#{username}, #{password}, #{email}, #{phone}, #{status}, #{score})</insert><!-- 根据ID删除 --><delete id="deleteById" parameterType="Long">DELETE FROM user WHERE id = #{id}</delete><!-- 更新用户 --><update id="update" parameterType="com.example.usermanagement.entity.User">UPDATE user<set><if test="username != null">username = #{username},</if><if test="password != null">password = #{password},</if><if test="email != null">email = #{email},</if><if test="phone != null">phone = #{phone},</if><if test="status != null">status = #{status},</if><if test="score != null">score = #{score},</if></set>WHERE id = #{id}</update><!-- 根据ID查询 --><select id="selectById" parameterType="Long" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE id = #{id}</select><!-- 根据用户名查询 --><select id="selectByUsername" parameterType="String" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE username = #{username}</select><!-- 查询所有用户 --><select id="selectAll" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userORDER BY id DESC</select><!-- 分页查询 --><select id="selectByPage" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userORDER BY id DESCLIMIT #{offset}, #{limit}</select><!-- 统计总数 --><select id="count" resultType="int">SELECT COUNT(*) FROM user</select><!-- 根据邮箱查询用户 --><select id="selectByEmail" parameterType="String" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE email = #{email}</select><!-- 根据用户名搜索(模糊查询) --><select id="searchByUsername" resultMap="BaseResultMap">SELECT<include refid="Base_Column_List" />FROM userWHERE username LIKE CONCAT('%', #{username}, '%')ORDER BY id DESCLIMIT #{offset}, #{limit}</select><!-- 统计搜索结果数量 --><select id="countByUsername" resultType="int">SELECT COUNT(*)FROM userWHERE username LIKE CONCAT('%', #{username}, '%')</select></mapper>

1. Mapper接口设计分析

1.1 接口声明与注解

@Mapper
public interface UserMapper {// 方法定义
}

@Mapper注解详解:

  • MyBatis标识:告诉Spring这是MyBatis的Mapper接口
  • 自动代理:Spring自动创建接口的实现类
  • 依赖注入:可以被@Autowired注入到Service中
  • 类型安全:编译时检查方法签名

接口vs实现类:

// 传统DAO实现
public class UserDaoImpl implements UserDao {// 需要手写JDBC代码
}// MyBatis Mapper
public interface UserMapper {// 只需要定义方法签名,XML中写SQL
}

1.2 方法命名规范

// 查询类方法
User selectById(Long id);
User selectByUsername(String username);
List<User> selectAll();// 插入类方法
int insert(User user);// 更新类方法
int update(User user);// 删除类方法
int deleteById(Long id);// 统计类方法
int count();

命名约定分析:

  • select:查询操作,返回实体或集合
  • insert:插入操作,返回影响行数
  • update:更新操作,返回影响行数
  • delete:删除操作,返回影响行数
  • count:统计操作,返回数量

1.3 参数传递设计

// 单个参数(MyBatis自动处理)
User selectById(Long id);// 多个参数(使用@Param注解)
List<User> selectByPage(@Param("offset") Integer offset,@Param("limit") Integer limit);// 复杂对象参数
int insert(User user);

@Param注解作用:

  • 参数命名:在XML中可以通过名称引用参数
  • 多参数支持:避免MyBatis的参数0、参数1命名
  • 可读性增强:XML中的参数名更有意义

2. XML映射文件结构解析

2.1 文件头声明

<?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">

作用说明:

  • XML声明:指定版本和编码
  • DTD约束:定义XML文件的结构规范
  • MyBatis验证:确保XML语法正确

2.2 命名空间配置

<mapper namespace="com.example.usermanagement.mapper.UserMapper">

namespace重要性:

  • 接口绑定:必须与Mapper接口全限定名一致
  • 方法映射:XML中的SQL语句与接口方法一一对应
  • 避免冲突:不同Mapper的同名方法不会冲突

3. 结果映射深度解析

3.1 ResultMap配置

<resultMap id="BaseResultMap" type="com.example.usermanagement.entity.User"><id column="id" property="id"/><result column="username" property="username"/><result column="password" property="password"/><result column="email" property="email"/><result column="phone" property="phone"/><result column="status" property="status"/><result column="score" property="score"/><result column="create_time" property="createTime"/><result column="update_time" property="updateTime"/>
</resultMap>

ResultMap核心作用:

字段映射:

  • 数据库字段Java属性
  • create_timecreateTime(下划线转驼峰)
  • update_timeupdateTime

标签区别:

  • <id>:主键字段,MyBatis优化处理
  • <result>:普通字段映射

类型映射:

type="com.example.usermanagement.entity.User"
  • 指定返回的Java对象类型
  • MyBatis自动创建对象并设置属性

3.2 字段列表复用

<sql id="Base_Column_List">id, username, password, email, phone, status, score, create_time, update_time
</sql>

设计优势:

  • DRY原则:避免重复定义字段列表
  • 维护性:字段变更只需修改一处
  • 可读性:SQL语句更简洁

使用方式:

<select id="selectById" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE id = #{id}
</select>

4. SQL语句详细分析

4.1 插入语句设计

<insert id="insert" parameterType="com.example.usermanagement.entity.User"useGeneratedKeys="true" keyProperty="id">INSERT INTO user (username, password, email, phone, status, score)VALUES (#{username}, #{password}, #{email}, #{phone}, #{status}, #{score})
</insert>

核心配置解析:

useGeneratedKeys=“true”:

  • 自动生成主键:数据库自增ID
  • 回写主键:插入后ID自动设置到对象
  • 便于后续操作:可以直接使用生成的ID

keyProperty=“id”:

  • 指定主键属性:告诉MyBatis将生成的主键值设置给哪个属性
  • 对象更新:插入后User对象的id字段会被自动设置

参数绑定:

#{username}, #{password}, #{email}
  • 预编译SQL:防止SQL注入
  • 类型转换:自动处理Java类型到数据库类型的转换
  • 空值处理:null值自动处理

使用效果:

User user = new User();
user.setUsername("testuser");
user.setPassword("123456");userMapper.insert(user);
// 插入后,user.getId() 会自动获得生成的主键值
System.out.println("生成的ID: " + user.getId());

4.2 动态更新语句

<update id="update" parameterType="com.example.usermanagement.entity.User">UPDATE user<set><if test="username != null">username = #{username},</if><if test="password != null">password = #{password},</if><if test="email != null">email = #{email},</if><if test="phone != null">phone = #{phone},</if><if test="status != null">status = #{status},</if><if test="score != null">score = #{score},</if></set>WHERE id = #{id}
</update>

动态SQL优势:

<set>标签作用:

  • 智能组装:自动处理SET子句
  • 逗号处理:自动去除末尾多余的逗号
  • 条件更新:只更新有值的字段

<if>条件判断:

<if test="username != null">username = #{username},</if>
  • 空值检查:只有非null字段才会被更新
  • 灵活更新:支持部分字段更新
  • 避免覆盖:不会将现有数据置为null

生成的SQL示例:

-- 如果只更新用户名和邮箱
UPDATE user SET username = ?, email = ? WHERE id = ?-- 如果只更新状态
UPDATE user SET status = ? WHERE id = ?

4.3 分页查询实现

<select id="selectByPage" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userORDER BY id DESCLIMIT #{offset}, #{limit}
</select>

MySQL分页语法:

  • LIMIT offset, limit:MySQL特有语法
  • offset:跳过的记录数
  • limit:返回的记录数

分页计算:

// 第1页,每页10条:LIMIT 0, 10
// 第2页,每页10条:LIMIT 10, 10
// 第3页,每页10条:LIMIT 20, 10
Integer offset = (pageNum - 1) * pageSize;

排序策略:

ORDER BY id DESC
  • ID倒序:最新数据在前
  • 稳定排序:确保分页结果一致性

4.4 模糊搜索实现

<select id="searchByUsername" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE username LIKE CONCAT('%', #{username}, '%')ORDER BY id DESCLIMIT #{offset}, #{limit}
</select>

LIKE查询分析:

CONCAT函数:

  • 字符串拼接:MySQL的CONCAT函数
  • 防止SQL注入:参数化查询
  • 跨数据库:不同数据库有不同语法

不同数据库的写法:

<!-- MySQL -->
WHERE username LIKE CONCAT('%', #{username}, '%')<!-- Oracle -->
WHERE username LIKE '%' || #{username} || '%'<!-- SQL Server -->
WHERE username LIKE '%' + #{username} + '%'

性能考虑:

-- 前置通配符影响索引
WHERE username LIKE '%zhang%'  -- 不能使用索引-- 后置通配符可以使用索引
WHERE username LIKE 'zhang%'   -- 可以使用索引

4.5 统计查询

<select id="count" resultType="int">SELECT COUNT(*) FROM user
</select><select id="countByUsername" resultType="int">SELECT COUNT(*)FROM userWHERE username LIKE CONCAT('%', #{username}, '%')
</select>

resultType vs resultMap:

  • resultType=“int”:直接返回基本类型
  • resultMap:返回复杂对象类型
  • 自动转换:MyBatis自动处理类型转换

5. 参数传递机制

5.1 单参数传递

User selectById(Long id);
<select id="selectById" parameterType="Long" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userWHERE id = #{id}
</select>

单参数特点:

  • 自动识别:MyBatis自动识别参数类型
  • 直接引用:XML中直接使用#{参数名}
  • parameterType可选:通常可以省略

5.2 多参数传递

List<User> selectByPage(@Param("offset") Integer offset,@Param("limit") Integer limit);
<select id="selectByPage" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM userORDER BY id DESCLIMIT #{offset}, #{limit}
</select>

@Param注解必要性:

// 不使用@Param(不推荐)
List<User> selectByPage(Integer offset, Integer limit);
// XML中需要使用:#{param1}, #{param2} 或 #{0}, #{1}// 使用@Param(推荐)
List<User> selectByPage(@Param("offset") Integer offset,@Param("limit") Integer limit);
// XML中可以使用:#{offset}, #{limit}

5.3 对象参数传递

int insert(User user);
<insert id="insert" parameterType="com.example.usermanagement.entity.User">INSERT INTO user (username, password, email, phone, status, score)VALUES (#{username}, #{password}, #{email}, #{phone}, #{status}, #{score})
</insert>

对象属性访问:

  • 直接访问#{username} 等价于 user.getUsername()
  • 嵌套对象#{address.city} 访问嵌套属性
  • 类型安全:编译时检查属性是否存在

6. MyBatis配置优化

6.1 application.yml中的MyBatis配置

mybatis:mapper-locations: classpath:mapper/*.xmltype-aliases-package: com.example.usermanagement.entityconfiguration:map-underscore-to-camel-case: truelog-impl: org.apache.ibatis.logging.stdout.StdOutImpl

配置说明:

  • mapper-locations:XML文件位置
  • type-aliases-package:实体类包路径
  • map-underscore-to-camel-case:自动驼峰转换
  • log-impl:SQL执行日志

6.2 自动驼峰转换效果

// 数据库字段 → Java属性
create_time → createTime
update_time → updateTime
user_name → userName

开启前后对比:

<!-- 未开启驼峰转换 -->
<resultMap id="UserResultMap" type="User"><result column="create_time" property="createTime"/><result column="update_time" property="updateTime"/>
</resultMap><!-- 开启驼峰转换后 -->
<!-- 可以省略ResultMap,MyBatis自动映射 -->
<select id="selectById" resultType="User">SELECT * FROM user WHERE id = #{id}
</select>

7. 性能优化要点

7.1 索引使用建议

-- 为常用查询字段建索引
CREATE INDEX idx_username ON user(username);
CREATE INDEX idx_email ON user(email);
CREATE INDEX idx_status ON user(status);-- 复合索引
CREATE INDEX idx_status_create_time ON user(status, create_time);

7.2 分页性能优化

<!-- 大数据量分页优化 -->
<select id="selectByPageOptimized" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM user WHERE id > #{lastId}ORDER BY idLIMIT #{limit}
</select>

游标分页 vs 传统分页:

-- 传统分页(深分页性能差)
SELECT * FROM user ORDER BY id LIMIT 100000, 10;-- 游标分页(性能稳定)
SELECT * FROM user WHERE id > 100000 ORDER BY id LIMIT 10;

7.3 批量操作支持

<!-- 批量插入 -->
<insert id="batchInsert" parameterType="list">INSERT INTO user (username, password, email)VALUES<foreach collection="list" item="user" separator=",">(#{user.username}, #{user.password}, #{user.email})</foreach>
</insert><!-- 批量删除 -->
<delete id="batchDelete" parameterType="list">DELETE FROM user WHERE id IN<foreach collection="list" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>

8. 常见问题与解决方案

8.1 SQL注入防护

<!-- 安全的参数绑定 -->
WHERE username = #{username}    <!-- 推荐:预编译SQL --><!-- 危险的字符串拼接 -->
WHERE username = '${username}'  <!-- 不推荐:SQL注入风险 -->

#{}与${}区别:

  • #{}:预编译参数,防SQL注入
  • ${}:字符串替换,有注入风险

8.2 空值处理

<update id="update">UPDATE user<set><if test="username != null and username != ''">username = #{username},</if><if test="email != null and email != ''">email = #{email},</if></set>WHERE id = #{id}
</update>

8.3 数据库兼容性

<!-- MySQL -->
<select id="selectByPage" resultMap="BaseResultMap">SELECT * FROM user LIMIT #{offset}, #{limit}
</select><!-- Oracle -->
<select id="selectByPage" resultMap="BaseResultMap">SELECT * FROM (SELECT ROWNUM rn, t.* FROM user t WHERE ROWNUM <= #{offset} + #{limit}) WHERE rn > #{offset}
</select>

9. 高级特性应用

9.1 动态SQL复杂示例

<select id="searchUsers" resultMap="BaseResultMap">SELECT <include refid="Base_Column_List"/>FROM user<where><if test="username != null and username != ''">AND username LIKE CONCAT('%', #{username}, '%')</if><if test="email != null and email != ''">AND email = #{email}</if><if test="status != null">AND status = #{status}</if><if test="minScore != null">AND score >= #{minScore}</if><if test="maxScore != null">AND score <= #{maxScore}</if></where>ORDER BY <choose><when test="sortBy == 'score'">score DESC</when><when test="sortBy == 'createTime'">create_time DESC</when><otherwise>id DESC</otherwise></choose>
</select>

9.2 结果集嵌套

<!-- 一对多关联查询 -->
<resultMap id="UserWithOrdersMap" type="User"><id column="id" property="id"/><result column="username" property="username"/><collection property="orders" ofType="Order"><id column="order_id" property="id"/><result column="order_amount" property="amount"/></collection>
</resultMap>
  1. 接口简洁:只需定义方法签名
  2. SQL分离:业务逻辑与SQL解耦
  3. 类型安全:编译时检查
  4. 动态SQL:灵活的条件查询
  5. 结果映射:自动对象转换
  6. 参数绑定:防SQL注入
  • 预编译SQL:性能优化

  • 结果缓存:二级缓存支持

  • 批量操作:减少数据库交互

  • 分页查询:大数据量处理

  • XML配置:SQL变更无需重编译

  • 代码复用:SQL片段共享

  • 规范统一:标准化的CRUD操作

  • 易于测试:接口便于Mock测试

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

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

相关文章

BW处理链日志存储分析与清理

处理链日志存储分析使用程序 RSPC_LOGS_ANALYZE 分析处理链日志占用空间*&---------------------------------------------------------------------* *& Report RSPC_LOGS_ANALYZE *&---------------------------------------------------------------------* *&a…

mysql 简单操作手册

以下是一份 MySQL 日常操作速查手册&#xff0c;包含启动/停止服务、连接/退出客户端、数据库管理、用户权限等常用命令&#xff0c;适用于 macOS&#xff08;Homebrew 安装&#xff09;和 Linux 系统&#xff1a;一、服务管理 &#x1f6a6;操作命令&#xff08;Homebrew&…

HTML5 Web Workers 深度剖析:助力网页性能飞速提升

在当今数字化时代&#xff0c;Web 应用的性能已成为决定用户体验和业务成功的关键因素。随着 Web 应用的复杂性不断增加&#xff0c;如何高效利用设备资源、提升网页响应速度成为开发者面临的重大挑战。 HTML5 Web Workers 的诞生与意义 在传统的网页开发中&#xff0c;JavaScr…

调度系统部署架构是什么样的呢?

简单示例一个部署架构图&#xff0c;如下所示&#xff1a;&#x1f4d8; 各组件说明&#xff1a;✅ 服务器端组件&#xff08;控制节点&#xff09;Slurm&#xff1a;slurmctld&#xff08;主控调度器&#xff09;&#xff0c;slurmdbd&#xff08;数据库服务&#xff09;PBS P…

SQL 与 NoSQL 的核心区别

数据库是存储、管理和检索数据的系统。根据数据模型和设计理念&#xff0c;可分为SQL 数据库&#xff08;关系型数据库&#xff09; 和NoSQL 数据库&#xff08;非关系型数据库&#xff09;。两者的核心区别在于数据的组织方式、灵活性、事务支持和适用场景。&#x1f4a1;一、…

力扣 hot100 Day71

45. 跳跃游戏 II 给定一个长度为 n 的 0 索引整数数组 nums。初始位置为 nums[0]。 每个元素 nums[i] 表示从索引 i 向后跳转的最大长度。换句话说&#xff0c;如果你在索引 i 处&#xff0c;你可以跳转到任意 (i j) 处&#xff1a; 0 < j < nums[i] 且i j < n …

什么是 Spring MVC?

题目详细答案Spring MVC 是 Spring 框架中的一个模块&#xff0c;用于构建基于 Web 的应用程序。它遵循 Model-View-Controller#&#xff08;MVC&#xff09;设计模式&#xff0c;将业务逻辑、用户界面和数据分离&#xff0c;以促进代码的可维护性和可扩展性。主要包含几个概念…

第十篇:3D模型性能优化:从入门到实践

第十篇&#xff1a;3D模型性能优化&#xff1a;从入门到实践 引言 在3D开发中&#xff0c;性能优化是区分普通应用和卓越应用的关键。Three.js应用的流畅运行需要60FPS的渲染效率&#xff0c;而移动端设备更面临严格的资源限制。本文将深入解析性能优化核心技术&#xff0c;并通…

基于 Easy Rules 的电商订单智能决策系统:构建可扩展的业务规则引擎实践

Easy Rules 是一个轻量级且易于使用的规则引擎&#xff0c;适用于Java应用。下面是一个简单的示例&#xff0c;演示如何使用 Easy Rules 定义和执行规则。 添加依赖 首先&#xff0c;在你的Java项目中添加 Easy Rules 的 Maven 依赖&#xff08;如果你使用的是Maven构建工具&am…

如何使用gpt进行模型微调?

对 GPT 类大语言模型&#xff08;如 GPT-3、GPT-2、Hugging Face 的 GPT 系列、ChatGLM 等开源或闭源模型&#xff09;进行微调&#xff08;Fine-tuning&#xff09;&#xff0c;目的是让模型在特定任务或领域&#xff08;如法律、医疗、客服、代码生成等&#xff09;上表现更优…

数据可视化与人机交互技术

人机交互技术(HumanComputer Interaction&#xff0c;HCI)是21世纪信息领域需要发展的重大课题。例如&#xff0c;美国21世纪信息技术计划中的基础研究内容定为四项&#xff0c;即软件、人机交互、网络、高性能计算。其目标就是要开发21世纪个性化的信息环境。其中&#xff0…

MP2662GC-0000-Z降压转换器 MPS电源芯片 集成电路IC

MP2662GC-0000-Z 是MPS&#xff08;Monolithic Power Systems&#xff09;公司推出的一款高性能电源管理集成电路&#xff08;PMIC&#xff09;&#xff0c;属于其电池管理或电源转换产品线的一部分。以下是关于该器件的详细解析&#xff1a;1. 核心功能高效电源转换&#xff1…

Go 语言中的切片排序:从原理到实践玩转 sort 包

🚀 Go 语言中的切片排序:从原理到实践玩转 sort 包 在Go语言的日常开发中,切片(Slice)作为动态、灵活的数据结构,几乎无处不在。而排序作为数据处理的基础操作,更是高频需求。 Go标准库中的sort包凭借其优雅的设计和高效的实现,成为切片排序的“瑞士军刀”。本文将带…

PCB焊盘脱落的补救办法与猎板制造优势解析

PCB焊盘脱落是电子维修中常见的问题&#xff0c;轻则导致元件虚焊&#xff0c;重则引发电路板报废。遇到这种情况不必慌张&#xff0c;掌握正确的补救方法能最大限度挽回损失。一、焊盘脱落的应急处理方案若脱落焊盘未完全脱离基板&#xff0c;可用镊子夹住残留部分缓慢抬起&am…

python3.10.6+flask+sqlite开发一个越南留学中国网站的流程与文件组织结构说明

采用python3.10.6flasksqlite技术栈&#xff0c;开发一个越南留学中国网站&#xff08;vietnam-study-in-china&#xff09;。开发流程与文件组织结构说明 一、项目概述与规划 &#xff08;一&#xff09;项目背景与意义 留学趋势分析 近年来&#xff0c;中越两国教育交流日益…

uView Pro 正式开源!70+ Vue3 组件重构完成,uni-app 组件库新晋之星

一、项目背景 uni-app 作为一款优秀的跨平台框架&#xff0c;凭借其“一套代码&#xff0c;多端运行”的理念&#xff0c;受到了广大移动端开发者的青睐。 而在 uni-app 的生态中&#xff0c;uView UI 作为一款基于 Vue2 开发的开源组件库&#xff0c;凭借其丰富的组件、完善…

Qwen3 技术报告 的 Strong-to-Weak Distillation 强到弱蒸馏 和 代码实现

Qwen3 技术报告 的 Strong-to-Weak Distillation 强到弱蒸馏 和 代码实现 flyfish 代码在文末 技术报告就是不一定经过严格的学术期刊同行评审&#xff0c;但具有较强的专业性和实用性。 The post-training pipeline of Qwen3 is strategically designed with two core ob…

一体化步进伺服电机在无人机舱门应用中的应用案例

在无人机的设计过程中&#xff0c;舱门的快速、稳定开合对于无人机的任务执行效率和安全性至关重要。传统的舱门驱动方式存在响应速度慢、控制精度不足等问题&#xff0c;难以满足无人机复杂任务的需求。因此&#xff0c;某客户无人机选择了‌一体化步进伺服电机‌作为舱门的驱…

Ansible 面试题 20250811

1. 你使用过哪些 Ansible 模块? Ansible 常用的模块: file 、copy 、template 、yum 、apt 、service 、user 、group 、shell 、script 、command 、cron 等等。 这些模块可以用来管理文件、软件包、服务、用户、组、计划任务等等。 Docker相关模块: docker_container:用…

安路Anlogic FPGA下载器的驱动安装与测试教程

参考链接&#xff1a;安路下载器JTAG驱动安装 - 米联客(milianke) - 博客园 安路支持几款下载器&#xff1a; AL-LINK在线下载器是基于上海安路信息科技股份科技有限公司全系列 CPLD/FPGA 器件&#xff0c;结合公司自研的 TD 软件&#xff0c;可实现在线 JTAG 程序下载、Chip…