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
英文地址,請注明出處:http://en.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…