MyBatis從入門到“入土“

?💕喜歡的朋友可以關注一下,下次更新不迷路!💕(●'?'●)

目錄

一、Mybatis為何物?👌

二、快速入門🤣

?1、新建項目😊

2、數據庫建表😊

3、導入依賴的jar包😊

4、根據表建pojo類😊

5、編寫mapper映射文件(編寫sql)😊

?6、編寫全局配置文件(主要是配置數據源信息)😊

7、測試😊

三、快速入土😢

代理開發😂

1、定義與SQL映射文件同名的Mapper接口,并且將Mapper接口和SQL映射文件放置在同一目錄下。

2、設置SQL映射文件的namespace屬性為Mapper接口全限定名。

3、在Mapper接口中定義方法,方法名就是SQL映射文件中sql語句的id,并保持參數類型和返回值類型一致。

4、通過SqlSession的getMapper方法獲取Mapper接口的代理對象,并調用對應方法。

?Mybatis核心配置--mybatis-config.xml😂

1、可以連接多個數據庫

?2、配置標簽

案例😂

1、?建表

2、實體類

3、測試類

4、mybatisx插件

根據方法自動生成mapper映射文件

?5、查詢(查詢所有)

6、查看詳情(根據id查詢一個)

7、條件查詢

?根據參數接收(無參/一個參數/兩個參數/)

散裝參數(模糊匹配)

對象參數

map參數

?動態條件查詢(用戶輸入條件時,是否所有條件都會填寫。不是,哥們🤣👌)

?使用if,choose,when設定條件

?8、添加

?主鍵返回

?9、修改

修改全部字段

?修改動態字段

10、刪除

單個刪除

批量刪除

?注解開發😍


?

一、Mybatis為何物?👌

🤦?♂?惡臭的描述:?MyBatis 是一個優秀的持久層框架,它對JDBC的操作數據庫的過程進行封裝,讓開發者只需要關注 SQL 本身,而不需要花費精力去處理例如注冊驅動、創建connection、創建statement、手動設置參數、結果集檢索等JDBC繁瑣的過程代碼。

??舒服的描述:

不需要手動編寫 JDBC 代碼來執行 SQL 語句,也不需要處理數據庫連接的創建和關閉。

所有的數據庫操作都被抽象成了簡單的 Mapper 方法調用。 (偉大無需多言!)

Mybatis中文官網

二、快速入門🤣

?前言:

完整結構圖

只需要通過如下幾個步驟,即可用mybatis快速進行持久層的開發

  1. 編寫全局配置文件
  2. 編寫mapper映射文件
  3. 加載全局配置文件,生成SqlSessionFactory
  4. 創建SqlSession,調用mapper映射文件中的SQL語句來執行CRUD操作

🤣話不多說,直接Mybatis啟動!🤣

?1、新建項目😊

java8

2、數據庫建表😊

3、導入依賴的jar包😊

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.itqingshui</groupId><artifactId>mybatis-test1</artifactId><version>1.0-SNAPSHOT</version><name>Archetype - mybatis-test1</name><url>http://maven.apache.org</url><dependencies><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.6</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.21</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.30</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source> <!-- 替換為你的JDK版本 --><target>1.8</target> <!-- 替換為你的JDK版本 --></configuration></plugin></plugins></build></project>

4、根據表建pojo類😊

package pojo;import lombok.*;@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Student{private Integer id;private String name;private Integer score;private Integer age;private Integer gender;
}
@Getter
@Setter:省略set,get方法。
@NoArgsConstructor:建立一個無參構造器。
@AllArgsConstructor:建立一個全參構造器。
@ToString:建立一個tostring方法。

5、編寫mapper映射文件(編寫sql)😊

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pojo.StudentMapper"><select id="findAll" resultType="pojo.Student">select * from student</select><insert id="insert" parameterType="pojo.Student">insert into student(name,gender,age,score) values(#{name},#{gender},#{age},#{score})</insert><delete id="delete" parameterType="int">delete from student where id=#{id}</delete><update id="update" parameterType="pojo.Student">update student set name=#{name},gender=#{gender},age=#{age},score=#{score} where id=#{id}</update></mapper>

?6、編寫全局配置文件(主要是配置數據源信息)😊

resources包下?

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration><environments default="development"><environment id="development"><transactionManager type="JDBC"/><dataSource type="POOLED"><property name="driver" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/ssm?useSSL=false&amp;serverTimezone=UTC"/><property name="username" value="lovertx"/><property name="password" value="1234567"/></dataSource></environment></environments><mappers><!-- 加載編寫的SQL語句 --><mapper resource="StudentMapper.xml"/></mappers>
</configuration>

7、測試😊

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;import pojo.Student;import java.io.IOException;
import java.io.InputStream;
import java.util.List;public class MybatisDemo {public static void main(String[] args) throws IOException, ClassNotFoundException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();List<Student> student = sqlSession.selectList("pojo.StudentMapper.findAll");for (Student s : student){System.out.println(s);}sqlSession.close();}
}

三、快速入土😢

代理開發😂

對于

  List<Student> student = sqlSession.selectList("pojo.StudentMapper.findAll");

目的:

解決原生方式中的硬編碼。

簡化后期執行SQL

?

1、定義與SQL映射文件同名的Mapper接口,并且將Mapper接口和SQL映射文件放置在同一目錄下。

在resources包下創建mapper包并放入StudentMapper.xml

2、設置SQL映射文件的namespace屬性為Mapper接口全限定名。

<mapper namespace="pojo.StudentMapper">

改為?

<mapper namespace="mapper.StudentMapper">

3、在Mapper接口中定義方法,方法名就是SQL映射文件中sql語句的id,并保持參數類型和返回值類型一致。

StudentMapper中?

package mapper;import pojo.Student;import java.util.List;public interface StudentMapper {List<Student>  findAll();
}

4、通過SqlSession的getMapper方法獲取Mapper接口的代理對象,并調用對應方法。

StudentMapper userMapper = sqlSession.getMapper(StudentMapper.class);
userMapper.findAll().forEach(System.out::println);

?Mybatis核心配置--mybatis-config.xml😂

1、可以連接多個數據庫

可以配置多個environment,通過default屬性切換不同的environment?

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration><environments default="development"><environment id="development"><transactionManager type="JDBC"/><dataSource type="POOLED"><property name="driver" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/ssm?useSSL=false&amp;serverTimezone=UTC"/><property name="username" value="lovertx"/><property name="password" value="1234567"/></dataSource></environment></environments><environments default="development"><environment id="development"><transactionManager type="JDBC"/><dataSource type="POOLED"><property name="driver" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/ssm?useSSL=false&amp;serverTimezone=UTC"/><property name="username" value="lovertx"/><property name="password" value="1234567"/></dataSource></environment></environments><mappers><!-- 加載編寫的SQL語句 --><mapper resource="mapper/StudentMapper.xml"/></mappers>
</configuration>

?2、配置標簽

案例😂

1、?建表

id:主鍵

brand_name:品牌名稱

company_name:企業名稱

ordered:排序字段

description:描述信息

status:狀態(0:禁用,1啟用)

2、實體類

package pojo;import lombok.*;@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Brand {private Integer id;private String brand_name;private String company_name;private Integer ordered;private String description;private Integer status;
}

3、測試類

4、mybatisx插件

通過點擊左邊的紅色小鳥?

?

可以找到藍色小鳥

?

?

根據方法自動生成mapper映射文件

1、第一步:在StudentMapper中

package mapper;import pojo.Student;import java.util.List;public interface StudentMapper {List<Student>  findAll();Student findById(int id);
}

2、使用插件自動生成

<select id="findById" resultType="pojo.Student"></select>

3、補充實際操作

<select id="findById" resultType="pojo.Student">select * from student where id=#{id}</select>

?5、查詢(查詢所有)

1、創建BrandMapper(先寫方法,后自動寫sql)

?

package mapper;import pojo.Brand;
import java.util.List;public interface BrandMapper {List<Brand> findAll();
}

2、創建BrandMapper.xml

package mapper;import pojo.Brand;
import java.util.List;public interface BrandMapper {List<Brand> findAll();
}

?3、配置映射文件

在mybatis-config.xml添加?<mapper resource="mapper/BrandMapper.xml"/>

<mappers><!-- 加載編寫的SQL語句 --><mapper resource="mapper/StudentMapper.xml"/><mapper resource="mapper/BrandMapper.xml"/></mappers>

?4、測試類

import mapper.BrandMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;import java.io.IOException;
import java.io.InputStream;public class MybatisDemo3 {public static void main(String[] args) throws IOException, ClassNotFoundException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper userMapper = sqlSession.getMapper(BrandMapper.class);userMapper.findAll().forEach(System.out::println);sqlSession.close();}
}

6、查看詳情(根據id查詢一個)

BrandMapper中寫:?

Brand findById(int id);
public interface BrandMapper {List<Brand> findAll();Brand findById(int id);
}

BrandMapper.xml中寫:

<select id="findById" resultType="pojo.Brand">select * from tb_brand where id = #{id}</select>

?測試類中寫:

public class MybatisDemo {public static void main(String[] args) throws IOException, ClassNotFoundException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);Brand brand = brandMapper.findById(1);System.out.println(brand);sqlSession.close();}
}

7、條件查詢

類似于實現這樣的功能:

?根據參數接收(無參/一個參數/兩個參數/)
散裝參數(模糊匹配)

因模糊匹配需要處理參數

接口方法

List<Brand> selectByCondition(@Param("status") int status, @Param("company_name") String company_name, @Param("brand_name") String brand_name);

sql語句

<select id="selectByCondition" resultType="pojo.Brand">select * from tb_brandwhere status = #{status}and brand_name like #{brand_name}and company_name like #{company_name}</select>

測試類?

public class MybatisDemo {public static void main(String[] args) throws IOException {//接收參數int status = 1;String company_name = "華為";String brand_name = "華為";//因模糊匹配,所有處理參數company_name = "%" + company_name + "%";brand_name = "%" + brand_name + "%";String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);List<Brand> brands = brandMapper.selectByCondition(status, company_name, brand_name);for (Brand brand : brands) {System.out.println(brand);}sqlSession.close();}
}

?

對象參數

對象的屬性名稱要和參數占位符名稱一致


Mapper接口:

List<Brand> selectByCondition(Brand brand);

sql語句:

<select id="selectByCondition" resultType="pojo.Brand">select * from tb_brandwhere status = #{status}and brand_name like #{brand_name}and company_name like #{company_name}</select>

?測試類:

多了個封裝對象

public class MybatisDemo {public static void main(String[] args) throws IOException {//接收參數int status = 1;String company_name = "華為";String brand_name = "華為";//因模糊匹配,所有處理參數company_name = "%" + company_name + "%";brand_name = "%" + brand_name + "%";//封裝對象Brand brand = new Brand();brand.setStatus(status);brand.setCompany_name(company_name);brand.setBrand_name(brand_name);String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);//      List<Brand> brands = brandMapper.selectByCondition(status, company_name, brand_name);List<Brand> brands = brandMapper.selectByCondition(brand);for (Brand brand1 : brands) {System.out.println(brand1);}sqlSession.close();}
}

map參數

?Mapper接口:

List<Brand> selectByCondition(Map map);

sql語句:

<select id="selectByCondition" resultType="pojo.Brand">select * from tb_brandwhere status = #{status}and brand_name like #{brand_name}and company_name like #{company_name}</select>

測試類:

public class MybatisDemo {public static void main(String[] args) throws IOException {//接收參數int status = 1;String company_name = "華為";String brand_name = "華為";//因模糊匹配,所有處理參數company_name = "%" + company_name + "%";brand_name = "%" + brand_name + "%";//封裝對象
//        Brand brand = new Brand();
//        brand.setStatus(status);
//        brand.setCompany_name(company_name);
//        brand.setBrand_name(brand_name);Map map = new HashMap();map.put("status",status);map.put("company_name",company_name);map.put("brand_name",brand_name);String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);//      List<Brand> brands = brandMapper.selectByCondition(status, company_name, brand_name);
//      List<Brand> brands = brandMapper.selectByCondition(brand);List<Brand> brands = brandMapper.selectByCondition(map);for (Brand brand1 : brands) {System.out.println(brand1);}sqlSession.close();}
}
?動態條件查詢(用戶輸入條件時,是否所有條件都會填寫。不是,哥們🤣👌)

只需要修改sql語句:

<select id="selectByCondition" resultType="pojo.Brand">select * from tb_brandwhere<if test="status != null">status = #{status}</if><if test="brand_name != null and brand_name != ''">and brand_name like #{brand_name}</if><if test="company_name != null and company_name != ''">and company_name like #{company_name}</if></select>

??可是當特殊條件缺少時會出現錯誤:

 Map map = new HashMap();//map.put("status",status);map.put("company_name",company_name);//map.put("brand_name",brand_name);

?解決:恒等式

將sql語句修改為:

<select id="selectByCondition" resultType="pojo.Brand">select * from tb_brand<where><if test="status != null">and status = #{status}</if><if test="brand_name != null and brand_name != ''">and brand_name like #{brand_name}</if><if test="company_name != null and company_name != ''">and company_name like #{company_name}</if></where></select>
?使用if,choose,when設定條件
<select id="selectByConditionOne" resultType="pojo.Brand">select * from tb_brandwhere<choose><!--相當于switch--><when test="status != null"><!--相當于case-->status = #{status}</when><when test="brand_name != null and brand_name != ''">brand_name like #{brand_name}</when><when test="company_name != null and company_name != ''">company_name like #{company_name}</when><otherwise><!--當用戶一個條件都不給-->1=1</otherwise></choose></select>

?8、添加

?接口方法

void add(Brand brand);

sql語句

<insert id="add">insert into tb_brand(brand_name,company_name,ordered,description,status)values(#{brand_name},#{company_name},#{ordered},#{description},#{status})</insert>

?測試類

public class MybatisDemo3 {public static void main(String[] args) throws IOException, ClassNotFoundException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession();BrandMapper userMapper = sqlSession.getMapper(BrandMapper.class);int status = 1;String company_name = "菠蘿手機";String brand_name = "菠蘿";int ordered = 1;String description = "美國有蘋果,中國有菠蘿";Brand brand = new Brand();brand.setStatus(status);brand.setCompany_name(company_name);brand.setBrand_name(brand_name);brand.setOrdered(ordered);brand.setDescription(description);userMapper.add(brand);
//事務提交sqlSession.commit();sqlSession.close();}
}
?主鍵返回

實現可查詢主鍵id的值

?因為事務回滾導致少了id=4

因此查詢菠蘿的id的值為5


將sql語句改為

<insert id="add" useGeneratedKeys="true" keyProperty="id">insert into tb_brand(brand_name,company_name,ordered,description,status)values(#{brand_name},#{company_name},#{ordered},#{description},#{status})</insert>

即添加

useGeneratedKeys="true" keyProperty="id"

?9、修改

修改全部字段

實現

?Mapper接口

void update(Brand brand);

SQL語句

<update id="update">update tb_brand<set><if test="brand_name != null and brand_name != ''">brand_name = #{brand_name},</if><if test="company_name != null and company_name != ''">company_name = #{company_name},</if><if test="ordered != null">ordered = #{ordered},</if><if test="description != null and description != ''">description =#{description},status = #{status}</if>where id = #{id}</set></update>

測試類

public class UpdateTest {public static void main(String[] args) throws IOException{String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession(true);BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);Brand brand = new Brand();brand.setId(5);brand.setBrand_name("香飄飄");brand.setCompany_name("香飄飄");brand.setDescription("香飄飄");brand.setOrdered(100);brand.setStatus(1);brandMapper.update(brand);sqlSession.close();}
}
?修改動態字段

實現修改密碼功能(想單獨改哪個值就改哪個值)

如果調用接口卻不給參數,則數據庫會出現null值🤦?♂?

?實現

只需要在SQL語句中添加條件,添加<set>標簽

<update id="update">update tb_brand<set><if test="brand_name != null and brand_name != ''">brand_name = #{brand_name},</if><if test="company_name != null and company_name != ''">company_name = #{company_name},</if><if test="ordered != null">ordered = #{ordered},</if><if test="description != null and description != ''">description =#{description},status = #{status}</if>where id = #{id}</set></update>

10、刪除

單個刪除

Mapper接口

void delete(int id);

?SQL語句

<delete id="delete">delete from tb_brand where id = #{id}</delete>

測試類

public class DeleteTest {public static void main(String[] args) throws IOException, IOException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession(true);BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);brandMapper.delete(2);sqlSession.close();}
}
批量刪除

???????

?實現

傳id數組,sql遍歷數組,一個一個刪掉

Mapper接口

void deleteByIds(@Param("ids") int[] ids);

?SQL語句

<delete id="deleteByIds">delete from tb_brand where id in<foreach collection="ids" item="id" open="(" separator="," close=")">#{id}</foreach></delete>

?測試類

public class DeleteTest2 {public static void main(String[] args) throws IOException, IOException {String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession = sqlSessionFactory.openSession(true);BrandMapper brandMapper = sqlSession.getMapper(BrandMapper.class);int []ids = {5,6};brandMapper.deleteByIds(ids);sqlSession.close();}
}

?注解開發😍

優點:對于簡單的SQL語句使用注解開發會非常便捷。

@Select("select * from tb_user where id = #{id}")
public User selectById(int id);

查詢:@Select

添加:@Insert

修改:? @Update

刪除:@Delete?

缺點:對于復雜的SQL語句應使用xml映射文件編寫。

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="mapper.BrandMapper"><insert id="add" useGeneratedKeys="true" keyProperty="id">insert into tb_brand(brand_name,company_name,ordered,description,status)values(#{brand_name},#{company_name},#{ordered},#{description},#{status})</insert><update id="update">update tb_brand<set><if test="brand_name != null and brand_name != ''">brand_name = #{brand_name},</if><if test="company_name != null and company_name != ''">company_name = #{company_name},</if><if test="ordered != null">ordered = #{ordered},</if><if test="description != null and description != ''">description =#{description},status = #{status}</if>where id = #{id}</set></update><delete id="delete">delete from tb_brand where id = #{id}</delete><delete id="deleteByIds">delete from tb_brand where id in<foreach collection="ids" item="id" open="(" separator="," close=")">#{id}</foreach></delete><select id="findAll" resultType="pojo.Brand">select * from tb_brand</select><select id="findById" resultType="pojo.Brand">select * from tb_brand where id = #{id}</select><!--    <select id="selectByCondition" resultType="pojo.Brand">-->
<!--        select * from tb_brand-->
<!--        where status = #{status}-->
<!--            and brand_name like #{brand_name}-->
<!--            and company_name like #{company_name}-->
<!--    </select>--><select id="selectByCondition" resultType="pojo.Brand">select * from tb_brand<where><if test="status != null">and status = #{status}</if><if test="brand_name != null and brand_name != ''">and brand_name like #{brand_name}</if><if test="company_name != null and company_name != ''">and company_name like #{company_name}</if></where></select><select id="selectByConditionOne" resultType="pojo.Brand">select * from tb_brandwhere<choose><!--相當于switch--><when test="status != null"><!--相當于case-->status = #{status}</when><when test="brand_name != null and brand_name != ''">brand_name like #{brand_name}</when><when test="company_name != null and company_name != ''">company_name like #{company_name}</when><otherwise><!--當用戶一個條件都不給-->1=1</otherwise></choose></select>
</mapper>

?💕完結撒花!💕

?

?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/14545.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/14545.shtml
英文地址,請注明出處:http://en.pswp.cn/web/14545.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Linux學習筆記6

TFTP 服務器搭建和測試 關于TFTP:TFTP&#xff08;Trivial File Transfer Protocol&#xff0c;簡單文件傳輸協議&#xff09;&#xff0c;是一個基于UDP 協議實現 的用于在客戶機和服務器之間進行簡單文件傳輸的協議&#xff0c;適合于開銷不大、不復雜的應用場合 搭建服務器…

后量子密碼的發展和應用

后量子算法&#xff0c;特別是后量子密碼(PQC)&#xff0c;是近年來密碼學領域的一個熱門話題。隨著量子計算技術的快速發展&#xff0c;傳統的公鑰密碼算法面臨著被量子計算機破解的威脅。為了應對這一挑戰&#xff0c;后量子密碼應運而生&#xff0c;成為了一種能夠抵抗量子計…

【論文筆記】| 蛋白質大模型ProLLaMA

【論文筆記】| 蛋白質大模型ProLLaMA ProLLaMA: A Protein Large Language Model for Multi-Task Protein Language Processing Peking University Theme: Domain Specific LLM Main work&#xff1a; 當前 ProLLM 的固有局限性&#xff1a;&#xff08;i&#xff09;缺乏自然…

Redis篇 在linux系統上安裝Redis

安裝Redis 在Ubuntu上安裝Redis 在Ubuntu上安裝Redis 在linux系統中,我們安裝Redis,必須先使它有root權限. 那么在linux中,如何切換到root用戶權限呢? sudo su 就可切換到用戶權限了. 在切換到用戶權限后,我們需要用一條命令來搜索Redis相關的軟件包 apt search redis 會出現非…

ROS2學習——節點話題通信(2)

目錄 一、ROS2節點 1.概念 2.實例 &#xff08;1&#xff09;ros2 run &#xff08;2&#xff09;ros2 node list &#xff08;3&#xff09;remapping重映射 &#xff08;4&#xff09;ros2 node info 二、話題 &#xff08;1&#xff09; ros2 topic list &#xf…

頭歌openGauss-存儲過程第1關:創建存儲過程

編程要求 1、創建第1個存儲過程&#xff0c;并調用&#xff1b; 1&#xff09;創建存儲過程&#xff0c;查詢emp表數據&#xff1b; 2&#xff09;調用存儲過程&#xff1b; --創建存儲過程&#xff0c;獲得計算機&#xff08;cs&#xff09;系學生選課情況并將結果寫入臨時表t…

人臉識別:基于卷積神經網絡(CNN)分類思想的人臉識別系統

本文來自公眾號 “AI大道理” —————— 項目配套視頻課程&#xff1a; 平臺&#xff1a;荔枝微課 鏈接&#xff1a;十方教育 項目地址&#xff1a;https://github.com/AIBigTruth/CNN_faces_recognition 之前很多人來詢問這個項目怎么做&#xff0c;代碼跑不起來&#…

數據庫讀寫分離

實現 MySQL 的讀寫分離主要可以通過以下幾種方式&#xff1a; 一主多從架構&#xff1a; 設置一個主數據庫&#xff08;Master&#xff09;來處理寫操作&#xff08;如 INSERT、UPDATE、DELETE&#xff09;。 設置多個從數據庫&#xff08;Slave&#xff09;來處理讀操作&…

USB數據恢復軟件:輕松找回U盤重要數據!

USB數據丟失的原因 USB數據丟失有一些常見原因&#xff0c;了解這些原因有利于恢復數據。 文件意外刪除病毒攻擊軟件錯誤未安全彈出USB設備格式化USB設備 順便一提&#xff0c;如果你通過快捷鍵“Ctrl D”刪除了數據&#xff0c;那你可以從回收站中還原它們。如果你永久刪除…

Isaac Sim仿真平臺學習(1)認識Isaac Sim

0.前言 上一個教程中我們下載好了Isaac Sim&#xff0c;這一章我們將來簡單了解一下Isaac Sim平臺。 isaac Sim仿真平臺安裝-CSDN博客 1.Isaac Sim是啥&#xff1f; What Is Isaac Sim? — Omniverse IsaacSim latest documentation Isaac Sim是NVDIA Omniverse平臺的機器…

【編譯原理復習筆記】屬性文法

屬性文法 也稱為屬性翻譯文法&#xff0c;由 Knuth 提出&#xff0c;以上下文無關文法為基礎 &#xff08;1&#xff09;為每個文法符號&#xff08;終結符與非終結符&#xff09;配備相關的屬性&#xff0c;代表與該文法符號相關的信息 &#xff08;2&#xff09;屬性文法對于…

【LSTM】基于Matlab的LSTM模型建模(代碼)

訓練目標&#xff1a;用LSTM訓練數據 數據&#xff1a;隨時間遞增&#xff0c;患者患病的概率&#xff08;橫坐標1個單位代表1個時間單位&#xff09; 以下代碼可直接運行 clc clear close all warning off % 關閉報警信息 %% 1.數據操作 % 1.1.導入數據&#x…

數據鏈路層協議——以太網協議

1. 數據鏈路層 網絡層用于將數據從一臺主機發送到另一臺主機。傳輸層用于將數據可靠的從一臺主機發送到另一臺主機。&#xff08;網絡層沒有保證可靠性的策略&#xff0c;傳輸過程中可能會出現各種意外&#xff0c;例如&#xff1a;丟包&#xff0c;網絡擁塞等。通過傳輸層可以…

跨域問題的4種解決方案

文章導讀 前言 跨域問題指的是在Web開發中&#xff0c;由于瀏覽器的同源策略限制&#xff0c;當一個網頁嘗試訪問與它不同源&#xff08;協議、域名或端口不同&#xff09;的資源時&#xff0c;可能會遇到安全限制導致無法正常訪問的問題。這種策略旨在防止惡意網站讀取或修改其…

yarn的基本命令和用法

Yarn通過并行安裝、離線模式、確定性安裝以及更好的依賴解析算法&#xff0c;為開發者提供了更快、更穩定、更安全的包管理體驗。它保留了npm的大部分功能&#xff0c;并在此基礎上做了大量優化&#xff0c;下面我們就來詳述Yarn的核心命令和實用技巧。&#x1f4da; 安裝Yarn…

【MySQL精通之路】InnoDB(7)-鎖和事務模型(2)-事務模型

主博客&#xff1a; 【MySQL精通之路】InnoDB(7)-鎖和事務模型-CSDN博客 上一篇&#xff1a; 【MySQL精通之路】InnoDB(7)-鎖和事務模型(1)-鎖-CSDN博客 下一篇&#xff1a; 目錄 1.事務隔離級別 2.1 可重復讀 2.2 讀已提交 2.3 讀取未提交 2.4 序列化讀 2.自動提交、…

訂餐系統總結、

應用層&#xff1a; SpringBoot:快速構建Spring項目&#xff0c;采用“約定大于配置”的思想&#xff0c;簡化Spring項目的配置開發。 SpringMvc&#xff1a;Spring框架的一個模塊&#xff0c;springmvc和spring無需通過中間整合層進行整合&#xff0c;可以無縫集成。 Sprin…

完整的數據可視化方法集

在當前的大數據時代&#xff0c;了解如何可視化數據是UI/UX設計師技能的重要組成部分。如今&#xff0c;幾乎所有的公司都需要良好的數據可視化作為確定業務方向和決策的參考。數據的可視化結果越好&#xff0c;用戶的決策就越科學。 1、什么是數據可視化 數據可視化是將信息…

張量 t-product 積(matlab代碼)

參考文獻&#xff1a;Tensor Robust Principal Component Analysis with a New Tensor Nuclear Norm 首先是文章2.3節中 t-product 的定義&#xff1a; 塊循環矩陣&#xff1a; 參考知乎博主的例子及代碼&#xff1a;&#xff08;t-product與t-QR分解&#xff0c;另一篇傅里葉對…

HTML5 設備訪問及輸入輸出設備交互

目錄 設備訪問輸入設備交互輸出設備交互設備訪問 設備信息訪問 navigator.userAgent:獲取瀏覽器的用戶代理字符串,從中可以解析出設備類型、操作系統、瀏覽器版本等信息。 const userAgent = navigator.userAgent; console.log(userAgent); // 輸出類似 "Mozilla/5.0…