国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql

這篇具有很好參考價(jià)值的文章主要介紹了mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

項(xiàng)目結(jié)構(gòu)

mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql,xml配置,mybatis,java,mybatis,xml,sql,動(dòng)態(tài)sql,collection,association

數(shù)據(jù)庫表

student_type 表

mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql,xml配置,mybatis,java,mybatis,xml,sql,動(dòng)態(tài)sql,collection,association

student 表

mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql,xml配置,mybatis,java,mybatis,xml,sql,動(dòng)態(tài)sql,collection,association

依賴

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.30</version>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.5</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

實(shí)體類

Student 類

一個(gè)學(xué)生只有一個(gè)年級

package com.tmg.domain;

public class Student {
    private int id;
    private String name;
    private int age;
    private String email;
    private Integer typeId;
    private Type type;

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public Student(int id, String name, int age, String email) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.email = email;
    }

    public Student() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", email='" + email + '\'' +
                ", typeId=" + typeId +
//                ", type=" + type +
                '}';
    }
}

Type 類

一個(gè)年級有多個(gè)學(xué)生,所以用 list

package com.tmg.domain;

import java.util.List;

public class Type {
    private Integer id;
    private String name;
    private List<Student> students;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Student> getStudents() {
        return students;
    }

    public void setStudents(List<Student> students) {
        this.students = students;
    }

    @Override
    public String toString() {
        return "Type{" +
                "id=" + id +
                ", name='" + name + '\'' +
//                ", students=" + students +
                '}';
    }
}

StudentDao

package com.tmg.dao;

import com.tmg.domain.Student;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StudentDao {


    //多個(gè)參數(shù)的配置
    void insertEmp( @Param("stuName")  String name,
                   @Param("stuAge") int age, @Param("stuEmail")  String email);

    List<Student> selectByStudent(Student student);

    void update(Student employee);

    void update2(Student employee);

    List<Student> selectByIds(@Param("ids") int []id);
//    List<Student> selectById(int id);

    List<Student> selectByTypeId(int id);
    List<Student> selectAll();
}

TypeDao

package com.tmg.dao;

import com.tmg.domain.Type;

import java.util.List;

public interface TypeDao {

    List<Type> selectAll();

    Type  selectById(Integer id);
}

mybatis-config.xml配置數(shù)據(jù)源,日志等

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!--    dddd-->
    <settings>
        <setting name="mapUnderscoreToCamelCase" value="ture"/><!--配置下劃線轉(zhuǎn)換為駝峰命名風(fēng)格-->
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    </settings>

    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"></transactionManager><!--事務(wù)管理器-->
            <dataSource type="POOLED"><!--數(shù)據(jù)源 POOLED代表池化-->
                <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
                <property name="username" value="root"/>
                <property name="password" value="root"/>
            </dataSource>
        </environment>
    </environments>

    <mappers>
        <mapper resource="dao/StudentDao.xml"></mapper>
        <mapper resource="dao/TypeDao.xml"></mapper>
    </mappers>
</configuration>

TypeDao.xml

下列代碼中:
1 resultMap 里面property對應(yīng)實(shí)體類屬性,column對應(yīng)數(shù)據(jù)庫字段名
2 主鍵用 id 標(biāo)簽 其他用result
3 關(guān)聯(lián)查詢(子查詢和連接查詢) 連接查詢查一次
4 一個(gè)年級多個(gè)學(xué)生,所以用collection 如果一對一用association

<?xml version="1.0" encoding="UTF-8" ?>

<!--指定約束文件:定義和限制當(dāng)前文件中可以使用的標(biāo)簽和屬性,以及標(biāo)簽出現(xiàn)的順序
mybatis-3-mapper.dtd 約束文件名稱
-->
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tmg.dao.TypeDao">
    <resultMap id="typeMap" type="com.tmg.domain.Type">
        <id property="id" column="type_id"></id>
        <result property="name" column="type_name"></result>
<!--        連接查詢-->
<!--        <collection property="students"-->
<!--                    javaType="java.util.List" ofType="com.tmg.domain.Student">-->
<!--            <id property="id" column="stu_id" javaType="java.lang.Integer"></id>-->
<!--            <result property="name" column="stu_name"></result>-->
<!--            <result property="age" column="stu_age"></result>-->
<!--            <result property="email" column="stu_email"></result>-->
<!--        </collection>-->

<!--        子查詢-->
        <collection property="students" column="type_id"
                    javaType="java.util.List" ofType="com.tmg.domain.Student"
                    select="com.tmg.dao.StudentDao.selectByTypeId">

        </collection>
<!-- property 實(shí)體類中的屬性名 column 子查詢使用的字段 javaType 集合類型  ofType 集合里面的泛型類型-->
    </resultMap>
    <select id="selectAll" resultMap="typeMap">
        select s.*,t.* from student s join student_type t on s.type_id=t.type_id
    </select>

    <select id="selectById" resultMap="typeMap">
        select * from student_type where type_id=#{id}
    </select>


</mapper>

StudentDao.xml

動(dòng)態(tài)sql不理解可看以下博客:
https://blog.csdn.net/weixin_57689217/article/details/135707991?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22135707991%22%2C%22source%22%3A%22weixin_57689217%22%7D
文章來源地址http://www.zghlxwxcb.cn/news/detail-809993.html

<?xml version="1.0" encoding="UTF-8" ?>

<!--指定約束文件:定義和限制當(dāng)前文件中可以使用的標(biāo)簽和屬性,以及標(biāo)簽出現(xiàn)的順序
mybatis-3-mapper.dtd 約束文件名稱
-->
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--映射的命名空間 = 包名+接口類-->
<mapper namespace="com.tmg.dao.StudentDao">
    <!--配置insert操作 id是方法名 parameterType是參數(shù)類型  #{屬性名}用于讀取對象的屬性值-->
    <!--#{}和${}的區(qū)別,#{}相當(dāng)于PreparedStatement的占位符?提前編譯,避免SQL注入 ${}是Statement字符串拼接,不能避免注入 -->
    <!--獲得最新的自增主鍵值 useGeneratedKeys=true keyProperty主鍵的屬性-->
    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
        insert into student( id,name,age,email) values (#{id},#{name},#{age},#{email});
    </insert>

<!--    問題:查詢出的名稱為多個(gè)單詞的字段出現(xiàn)null值-->
<!--    原因:數(shù)據(jù)庫的字段單詞以下劃線分隔,Java的屬性以駝峰命名,導(dǎo)致部分名稱不一致無法實(shí)現(xiàn)映射-->
    <select id="selectAll" resultMap="student">
        select * from student
    </select>

    <resultMap id="student" type="com.tmg.domain.Student">
        <!--配置主鍵 property是java屬性名 column是表字段名-->
        <id property="id" column="stu_id" javaType="java.lang.Integer"></id>
        <!--普通字段-->
        <result property="name" column="stu_name"></result>
        <result property="age" column="stu_age"></result>
        <result property="email" column="stu_email"></result>
        <result property="typeId" column="type_id"></result>

<!--        <association property="type"-->
<!--                     javaType="com.tmg.domain.Type">-->
<!--            <id property="id" column="type_id"></id>-->
<!--            <result property="name" column="type_name"></result>-->
<!--        </association>-->
        <association property="type" column="type_id"
                     javaType="com.tmg.domain.Type"
                     select="com.tmg.dao.TypeDao.selectById">

        </association>
    </resultMap>


<!--    動(dòng)態(tài)sql-->
<sql id="mySelect">
    select * from student
</sql>
    <select id="selectByStudent" parameterType="com.tmg.domain.Student" resultType="com.tmg.domain.Student" resultMap="student">
        <include refid="mySelect"></include>
        <where>
            <if test="name !=null">

                stu_name like "%"#{name}"%"
            </if>
            <if test="age !=null and age!=0">
                and stu_age=#{age}
            </if>
            <if test="email !=null">
                and stu_email=#{email}
            </if>
        </where>
    </select>

    <update id="update">
        update student
        <set>
            <if test="age !=null and age!=0">
                stu_age=#{age},
            </if>
            <if test="email!=null">
                stu_email=#{email},
            </if>
            <if test="name">
                stu_name=#{name},
            </if>
        </set>
        where stu_id=#{id};
    </update>
    <update id="update2">
        update student
        <trim prefix="set" suffixOverrides=",">
            <if test="age !=null and age!=0">
                stu_age=#{age},
            </if>
            <if test="email!=null">
                stu_email=#{email},
            </if>
            <if test="name">
                stu_name=#{name},
            </if>
        </trim>
        where stu_id=#{id};
    </update>

    <select id="selectByIds" resultMap="student">
        select s.*,t.* from student s join student_type t on s.type_id=t.type_id
        where stu_id in
        <foreach collection="ids" item="id" separator="," open="(" close=")" index="1">
            #{id}
        </foreach>
    </select>

    <select id="selectByTypeId" resultMap="student">
        <include refid="mySelect"></include> where type_id=#{id}
    </select>



</mapper>

TypeDaoText 測試類

package com.tmg.dao;

import com.tmg.domain.Type;
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 org.junit.Test;

import java.io.IOException;
import java.util.List;

public class TypeDaoText {
    @Test
    public void testselectAll() throws IOException {
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        TypeDao mapper = sqlSession.getMapper(TypeDao.class);
        List<Type> typeList = mapper.selectAll();
        for (Type type : typeList) {
            System.out.println(type);
        }
    }


    @Test
    public void testselectById() throws IOException {
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        TypeDao mapper = sqlSession.getMapper(TypeDao.class);
        Type type = mapper.selectById(1);
        System.out.println(type);
    }
}

StudentDaoText 測試類

package com.tmg.dao;

import com.tmg.domain.Student;
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 org.junit.Test;

import java.io.IOException;
import java.util.List;

public class StudentDaoText {

    @Test
    public void testinsertEmp() throws IOException {
        SqlSessionFactoryBuilder factoryBuilder = new SqlSessionFactoryBuilder();
        SqlSessionFactory factory = factoryBuilder.build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = factory.openSession();
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        mapper.insertEmp("tmg",18,"tmg@qq.com");
        sqlSession.commit();
    }

    @Test
    public void testselectByStudent() throws IOException {
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        Student student = new Student();
//        student.setName("z");
//        student.setAge(18);
//        student.setEmail("tmg@qq.com");
        List<Student> students = mapper.selectByStudent(student);
        for (Student student1 : students){
            System.out.println(student1);
        }
    }
    @Test
    public void testupdate() throws IOException {
        //創(chuàng)建會(huì)話工廠構(gòu)建器
        SqlSessionFactoryBuilder factoryBuilder = new SqlSessionFactoryBuilder();
        SqlSessionFactory build = factoryBuilder.build(Resources.getResourceAsStream("mybatis-config.xml"));
        //創(chuàng)建會(huì)話
        SqlSession sqlSession = build.openSession();
        //獲得Mapper對象
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        Student student = new Student();
//        student.setName();
        student.setId(1);
        student.setAge(22);
        mapper.update(student);
        sqlSession.commit();
    }
    @Test
    public void testupdate2() throws IOException {
        SqlSessionFactoryBuilder factoryBuilder = new SqlSessionFactoryBuilder();
        SqlSessionFactory build = factoryBuilder.build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        Student student = new Student();
        student.setId(1);
        student.setAge(44);
        mapper.update2(student);
        sqlSession.commit();
    }

    @Test
    public void testselectByIds() throws IOException {
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        int []a={1};
        List<Student> students = mapper.selectByIds(a);
        for (Student student:students){
            System.out.println(student);
            System.out.println(student.getType());
        }
    }
    @Test
    public void testselectAll() throws IOException {
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-config.xml"));
        SqlSession sqlSession = build.openSession();
        StudentDao mapper = sqlSession.getMapper(StudentDao.class);
        List<Student> students = mapper.selectAll();
        for(Student student : students){
            System.out.println(student);
            System.out.println(student.getType());
        }

    }
}

到了這里,關(guān)于mybatis xml多表查詢,子查詢,連接查詢,動(dòng)態(tài)sql的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Mybatis—XML配置文件、動(dòng)態(tài)SQL

    Mybatis—XML配置文件、動(dòng)態(tài)SQL

    學(xué)習(xí)完Mybatis的基本操作之后,繼續(xù)學(xué)習(xí)Mybatis—XML配置文件、動(dòng)態(tài)SQL。 Mybatis的開發(fā)有兩種方式: 注解 XML 之前學(xué)習(xí)的基本操作都是基于注解開發(fā)。使用Mybatis的注解方式,主要是來完成一些簡單的增刪改查功能。如果需要實(shí)現(xiàn)復(fù)雜的SQL功能,建議使用XML來配置映射語句,也就

    2024年02月06日
    瀏覽(21)
  • Mybatis從0到1 SQL注入 參數(shù)占位符 XML配置 動(dòng)態(tài)SQL

    Mybatis從0到1 SQL注入 參數(shù)占位符 XML配置 動(dòng)態(tài)SQL

    學(xué)習(xí)完mybatis入門后,我們繼續(xù)學(xué)習(xí)mybatis基礎(chǔ)操作。 需求說明: 根據(jù)資料中提供的《tlias智能學(xué)習(xí)輔助系統(tǒng)》頁面原型及需求,完成員工管理的需求開發(fā)。 通過分析以上的頁面原型和需求,我們確定了功能列表: 查詢 根據(jù)主鍵ID查詢 條件查詢 新增 更新 刪除 根據(jù)主鍵ID刪除

    2024年02月16日
    瀏覽(23)
  • Mybatis-plus 配置自定義sql(.xml文件)查詢語句的步驟

    Mybatis-plus 配置自定義sql(.xml文件)查詢語句的步驟

    這是使用Mybatis-plus 的自動(dòng)生成實(shí)體類代碼生成.xml文件, 所以他會(huì)在java目錄下,不在resources目錄下 如果在java目錄下的xml文件,需要分別配置application.yml和pom.xml文件 type-aliases-package:java目錄下邊的第一級包名 mapper-locations: classpath:映射器的地址: 類路徑:也就是.xml所在的包名

    2024年02月16日
    瀏覽(27)
  • 【JaveWeb教程】(27)Mybatis的XML配置文件與Mybatis動(dòng)態(tài)SQL 詳細(xì)代碼示例講解

    【JaveWeb教程】(27)Mybatis的XML配置文件與Mybatis動(dòng)態(tài)SQL 詳細(xì)代碼示例講解

    Mybatis的開發(fā)有兩種方式: 注解 XML 使用Mybatis的注解方式,主要是來完成一些簡單的增刪改查功能。如果需要實(shí)現(xiàn)復(fù)雜的SQL功能,建議使用XML來配置映射語句,也就是將SQL語句寫在XML配置文件中。 在Mybatis中使用XML映射文件方式開發(fā),需要符合一定的規(guī)范: XML映射文件的名稱

    2024年02月01日
    瀏覽(23)
  • SQL——多表連接查詢

    SQL——多表連接查詢

    若一個(gè)查詢同時(shí)涉及兩個(gè)或兩個(gè)以上的表, 則稱之為連接查詢(在FROM子句中體現(xiàn))。 參與連接的表可有多個(gè),但連接操作在兩個(gè)表之間進(jìn)行,即兩兩連接。 連接查詢包括: 內(nèi)連接 等值連接:用“=”比較被連接列的列值 非等值連接:用“、=、、=、”號進(jìn)行比較運(yùn)算 自連接

    2024年02月10日
    瀏覽(16)
  • MyBatis案例 | 使用映射配置文件實(shí)現(xiàn)CRUD操作——?jiǎng)討B(tài)SQL優(yōu)化條件查詢

    MyBatis案例 | 使用映射配置文件實(shí)現(xiàn)CRUD操作——?jiǎng)討B(tài)SQL優(yōu)化條件查詢

    本專欄主要是記錄學(xué)習(xí)完JavaSE后學(xué)習(xí)JavaWeb部分的一些知識(shí)點(diǎn)總結(jié)以及遇到的一些問題等,如果剛開始學(xué)習(xí)Java的小伙伴可以點(diǎn)擊下方連接查看專欄 本專欄地址:??JavaWeb Java入門篇: ??Java基礎(chǔ)學(xué)習(xí)篇 Java進(jìn)階學(xué)習(xí)篇(持續(xù)更新中):??Java進(jìn)階學(xué)習(xí)篇 本系列文章會(huì)將講述有關(guān)

    2024年02月02日
    瀏覽(41)
  • 數(shù)據(jù)庫 SQL高級查詢語句:聚合查詢,多表查詢,連接查詢

    數(shù)據(jù)庫 SQL高級查詢語句:聚合查詢,多表查詢,連接查詢

    創(chuàng)建Students和Courses表 直接查詢 設(shè)置別名查詢 設(shè)置條件查詢 使用COUNT(*) 和 COUNT(StudentID)是一樣的效果,因?yàn)镾tudentID是主鍵,每行記錄的主鍵都不同。另外我們在聚合查詢中還是能使用WHERE子句的,比如我們要 查找年齡大于20歲的學(xué)生數(shù)量 ,可使用以下SQL語句: 函數(shù) 說明 SUM

    2024年02月09日
    瀏覽(104)
  • 【MyBatis】1、MyBatis 核心配置文件、多表查詢、實(shí)體映射文件 ......

    【MyBatis】1、MyBatis 核心配置文件、多表查詢、實(shí)體映射文件 ......

    SSM( S pring、 S pringMVC、 M yBatis) Apache Shiro SpringBoot 事務(wù) :若將 N 個(gè) 數(shù)據(jù)庫操作 (CRUD)放到同一個(gè)事務(wù)中,則這 N 個(gè)數(shù)據(jù)庫操作最終要么全都生效,要么全都不生效 ?? 開啟事務(wù)【 START TRANSACTION 】 ?? 回滾事務(wù):若事務(wù)中的某個(gè)數(shù)據(jù)庫操作失敗,其他所有數(shù)據(jù)庫操作都需要

    2024年02月08日
    瀏覽(58)
  • SQL 相關(guān)子查詢 和 不相關(guān)子查詢、Exists 、Not Exists、 多表連接(包含自連接)

    SQL 相關(guān)子查詢 和 不相關(guān)子查詢、Exists 、Not Exists、 多表連接(包含自連接)

    不相關(guān)子查詢 子查詢的查詢條件不依賴于父查詢,稱不相關(guān)子查詢。子查詢可以單獨(dú)運(yùn)行的 相關(guān)子查詢 ==== 關(guān)聯(lián)子查詢 子查詢的查詢條件依賴于父查詢,稱為 相關(guān)子查詢。子查詢不能單獨(dú)運(yùn)行的 子查詢 也稱 內(nèi)部查詢 父查詢 也稱 外部查詢 如果子查詢的執(zhí)行依賴于外部查

    2024年02月14日
    瀏覽(68)
  • MyBatis XML 映射文件中的 SQL 語句可以分為動(dòng)態(tài)語句和靜態(tài)語句

    目錄 靜態(tài)查詢: 動(dòng)態(tài)查詢: 靜態(tài)更新: 動(dòng)態(tài)更新: 靜態(tài)刪除: 動(dòng)態(tài)刪除: 動(dòng)態(tài)語句和靜態(tài)語句在 MyBatis 中的作用如下: 靜態(tài)查詢: 靜態(tài)查詢是指在 SQL 語句中執(zhí)行固定的查詢操作,查詢的條件和內(nèi)容是預(yù)先確定的,不會(huì)隨著用戶輸入或其他條件的改變而改變。以下是一

    2024年01月18日
    瀏覽(35)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包