五表查詢(#千鋒#)

pom文件添加junit,mysql, mybatis(3.4.4)

設(shè)置mybatis的配置文件

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

<!--

? ? 該配置文件中包含一個(gè)configuration節(jié)點(diǎn)

? ? ? ? 里面有配置信息 分別是環(huán)境和映射

? ? ? ?  其中環(huán)境里有datasource,里面有我們熟悉的連接數(shù)據(jù)庫(kù)的四個(gè)字符串

-->

<configuration>

? ? <!--

? ? ? ? 引入db的配置文件信息,后面用到的四個(gè)連接字符串就可以直接使用 ${}的方式來(lái)動(dòng)態(tài)引入

? ? -->

? ? <properties resource="db.properties" />

? ? <!--

? ? ? ? 給當(dāng)前mybatis項(xiàng)目添加日志功能,該STDOUT_LOGGING值的好處是不用添加第三方j(luò)ar包就可以有日志的輸出

? ? -->

? ? <settings>

? ? ? ? <setting name="logImpl" value="STDOUT_LOGGING"/>

? ? </settings>

? ? <environments default="development">

? ? ? ? <environment id="development">

? ? ? ? ? ? <transactionManager type="JDBC"/>

? ? ? ? ? ? <dataSource type="POOLED">

? ? ? ? ? ? ? ? <property name="driver" value="${driver}"/>

? ? ? ? ? ? ? ? <property name="url" value="${url}"/>

? ? ? ? ? ? ? ? <property name="username" value="${user}"/>

? ? ? ? ? ? ? ? <property name="password" value="${pass}"/>

? ? ? ? ? ? </dataSource>

? ? ? ? </environment>

? ? </environments>

? ? <mappers>

? ? ? ? <mapper resource="com/zy/mapper/OrderMapper.xml"/>

? ? ? ? <mapper resource="com/zy/mapper/UserMapper.xml"/>

? ? ? ? <mapper resource="com/zy/mapper/DetailMapper.xml"/>

? ? ? ? <mapper resource="com/zy/mapper/ProductMapper.xml"/>

? ? ? ? <mapper resource="com/zy/mapper/TypeMapper.xml"/>

? ? </mappers>

</configuration>


db.properties數(shù)據(jù)庫(kù)的配置文件

driver=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/mall

user=root

pass=123456


設(shè)計(jì)pojo類

User.java

package com.zy.pojo;

public class User {

? ? private int uid;

? ? private String name;

? ? private String pass;

? ? private String phone;

? ? @Override

? ? public String toString() {

? ? ? ? return "User{" +

? ? ? ? ? ? ? ? "uid=" + uid +

? ? ? ? ? ? ? ? ", name='" + name + '\'' +

? ? ? ? ? ? ? ? ", pass='" + pass + '\'' +

? ? ? ? ? ? ? ? ", phone='" + phone + '\'' +

? ? ? ? ? ? ? ? '}';

? ? }

? ? public int getUid() {

? ? ? ? return uid;

? ? }

? ? public void setUid(int uid) {

? ? ? ? this.uid = uid;

? ? }

? ? public String getName() {

? ? ? ? return name;

? ? }

? ? public void setName(String name) {

? ? ? ? this.name = name;

? ? }

? ? public String getPass() {

? ? ? ? return pass;

? ? }

? ? public void setPass(String pass) {

? ? ? ? this.pass = pass;

? ? }

? ? public String getPhone() {

? ? ? ? return phone;

? ? }

? ? public void setPhone(String phone) {

? ? ? ? this.phone = phone;

? ? }

}


Type.java

package com.zy.pojo;

public class Types {

? ? private String tid;

? ? private String name;

? ? @Override

? ? public String toString() {

? ? ? ? return "Types{" +

? ? ? ? ? ? ? ? "tid=" + tid +

? ? ? ? ? ? ? ? ", name='" + name + '\'' +

? ? ? ? ? ? ? ? '}';

? ? }

? ? public String getTid() {

? ? ? ? return tid;

? ? }

? ? public void setTid(String tid) {

? ? ? ? this.tid = tid;

? ? }

? ? public String getName() {

? ? ? ? return name;

? ? }

? ? public void setName(String name) {

? ? ? ? this.name = name;

? ? }

}


Product.java

package com.zy.pojo;

public class Product {

? ? private String pid;

? ? private String name;

? ? private String img;

? ? private double price;

? ? private Types t;

? ? @Override

? ? public String toString() {

? ? ? ? return "Product{" +

? ? ? ? ? ? ? ? "pid='" + pid + '\'' +

? ? ? ? ? ? ? ? ", name='" + name + '\'' +

? ? ? ? ? ? ? ? ", img='" + img + '\'' +

? ? ? ? ? ? ? ? ", price=" + price +

? ? ? ? ? ? ? ? ", t=" + t +

? ? ? ? ? ? ? ? '}';

? ? }

? ? public String getPid() {

? ? ? ? return pid;

? ? }

? ? public void setPid(String pid) {

? ? ? ? this.pid = pid;

? ? }

? ? public String getName() {

? ? ? ? return name;

? ? }

? ? public void setName(String name) {

? ? ? ? this.name = name;

? ? }

? ? public String getImg() {

? ? ? ? return img;

? ? }

? ? public void setImg(String img) {

? ? ? ? this.img = img;

? ? }

? ? public double getPrice() {

? ? ? ? return price;

? ? }

? ? public void setPrice(double price) {

? ? ? ? this.price = price;

? ? }

? ? public Types getT() {

? ? ? ? return t;

? ? }

? ? public void setT(Types t) {

? ? ? ? this.t = t;

? ? }

}


Detail.java

package com.zy.pojo;

public class Detail {

? ? private String did;

? ? private int count;

? ? private Product pro;

? ? @Override

? ? public String toString() {

? ? ? ? return "Detail{" +

? ? ? ? ? ? ? ? "did='" + did + '\'' +

? ? ? ? ? ? ? ? ", count=" + count +

? ? ? ? ? ? ? ? ", pro=" + pro +

? ? ? ? ? ? ? ? '}';

? ? }

? ? public String getDid() {

? ? ? ? return did;

? ? }

? ? public void setDid(String did) {

? ? ? ? this.did = did;

? ? }

? ? public int getCount() {

? ? ? ? return count;

? ? }

? ? public void setCount(int count) {

? ? ? ? this.count = count;

? ? }

? ? public Product getPro() {

? ? ? ? return pro;

? ? }

? ? public void setPro(Product pro) {

? ? ? ? this.pro = pro;

? ? }

}


Order.java

package com.zy.pojo;

import java.util.List;

public class Order {

? ? private String oid;

? ? private double price;

? ? private String addr;

? ? private String payType;

? ? private User u;

? ? private List<Detail> details;

? ? @Override

? ? public String toString() {

? ? ? ? return "Order{" +

? ? ? ? ? ? ? ? "oid='" + oid + '\'' +

? ? ? ? ? ? ? ? ", price=" + price +

? ? ? ? ? ? ? ? ", addr='" + addr + '\'' +

? ? ? ? ? ? ? ? ", payType='" + payType + '\'' +

? ? ? ? ? ? ? ? ", u=" + u +

? ? ? ? ? ? ? ? ", details=" + details +

? ? ? ? ? ? ? ? '}';

? ? }

? ? public String getOid() {

? ? ? ? return oid;

? ? }

? ? public void setOid(String oid) {

? ? ? ? this.oid = oid;

? ? }

? ? public double getPrice() {

? ? ? ? return price;

? ? }

? ? public void setPrice(double price) {

? ? ? ? this.price = price;

? ? }

? ? public String getAddr() {

? ? ? ? return addr;

? ? }

? ? public void setAddr(String addr) {

? ? ? ? this.addr = addr;

? ? }

? ? public String getPayType() {

? ? ? ? return payType;

? ? }

? ? public void setPayType(String payType) {

? ? ? ? this.payType = payType;

? ? }

? ? public User getU() {

? ? ? ? return u;

? ? }

? ? public void setU(User u) {

? ? ? ? this.u = u;

? ? }

? ? public List<Detail> getDetails() {

? ? ? ? return details;

? ? }

? ? public void setDetails(List<Detail> details) {

? ? ? ? this.details = details;

? ? }

}


設(shè)置映射文件mapper

OrderMapper.xml

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

<!--

? ? 每個(gè)mapper文件都將有一個(gè)自己的映射的namespace,

? ? 每個(gè)方法對(duì)應(yīng)自己的sql語(yǔ)句,每個(gè)sql語(yǔ)句對(duì)應(yīng)有一個(gè)id

? ? 整個(gè)項(xiàng)目中所有的namespace.id必須是唯一的

-->

<mapper namespace="com.zy.pojo.OrderMapper">


? ? <select id="getOrderByOid" resultMap="orderMap">

? ? ? select * from orders where oid = #{oid}

? ? </select>


? ? <resultMap id="orderMap" type="com.zy.pojo.Order">

? ? ? ? <!--

? ? ? ? ? ? id代表主鍵,分別設(shè)置列和屬性的對(duì)應(yīng)關(guān)系

? ? ? ? -->

? ? ? ? <id property="oid" column="oid" ></id>

? ? ? ? <!--

? ? ? ? ? ? result代表普通字段的映射,分別指定列與屬性的對(duì)應(yīng)

? ? ? ? ? ? 如果字段名和屬性名一致,可以省略

? ? ? ? ? ? 屬性名叫做payType,字段名pay_type;

? ? ? ? ? ? <result column="pay_type" property="payType" />

? ? ? ? -->

? ? ? ? <result column="price" property="price" />

? ? ? ? <result column="addr" property="addr" />

? ? ? ? <result column="payType" property="payType" />

? ? ? ? <!--

? ? ? ? ? ? association關(guān)聯(lián),只要是"對(duì)一"的關(guān)系都可以使用association,代表關(guān)聯(lián)

? ? ? ? ? ? property代表Order類中的屬性名u

? ? ? ? ? ? column代表Orders表與Users表之間的關(guān)聯(lián)字段

? ? ? ? ? ? select代表要使用該查詢完成兩表的聯(lián)合查詢得出user對(duì)象

? ? ? ? -->

? ? ? ? <association property="u" column="uid" select="com.zy.pojo.UserMapper.getUserByUid"></association>

? ? ? ? <!--

? ? ? ? ? ? collection設(shè)置集合,只要是"對(duì)多"多關(guān)系,都可以使用collection,代表集合

? ? ? ? ? ? column代表orders表與details表之間的關(guān)聯(lián)字段

? ? ? ? -->

? ? ? ? <collection property="details" column="oid" select="com.zy.pojo.DetailMapper.getDetailsByOid" ofType="com.zy.pojo.Detail" />

? ? </resultMap>

</mapper>


UserMapper.xml

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

<!--

? ? 每個(gè)mapper文件都將有一個(gè)自己的映射的namespace,

? ? 每個(gè)方法對(duì)應(yīng)自己的sql語(yǔ)句,每個(gè)sql語(yǔ)句對(duì)應(yīng)有一個(gè)id

? ? 整個(gè)項(xiàng)目中所有的namespace.id必須是唯一的

-->

<mapper namespace="com.zy.pojo.UserMapper">


? ? <select id="getUserByUid" resultType="com.zy.pojo.User">

? ? ? select * from users where uid = #{uid}

? ? </select>

</mapper>


DetailMapper.xml

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

<!--

? ? 每個(gè)mapper文件都將有一個(gè)自己的映射的namespace,

? ? 每個(gè)方法對(duì)應(yīng)自己的sql語(yǔ)句,每個(gè)sql語(yǔ)句對(duì)應(yīng)有一個(gè)id

? ? 整個(gè)項(xiàng)目中所有的namespace.id必須是唯一的

-->

<mapper namespace="com.zy.pojo.DetailMapper">


? ? <select id="getDetailsByOid" resultMap="detailMap">

? ? ? select * from details where oid = #{oid}

? ? </select>

? ? <resultMap id="detailMap" type="com.zy.pojo.Detail">

? ? ? ? <id column="did" property="did"></id>

? ? ? ? <result property="count" column="count" />

? ? ? ? <association property="pro" column="pid" select="com.qfedu.pojo.ProductMapper.getProductByPid" />

? ? </resultMap>

</mapper>


ProductMapper.xml

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

<!--

? ? 每個(gè)mapper文件都將有一個(gè)自己的映射的namespace,

? ? 每個(gè)方法對(duì)應(yīng)自己的sql語(yǔ)句,每個(gè)sql語(yǔ)句對(duì)應(yīng)有一個(gè)id

? ? 整個(gè)項(xiàng)目中所有的namespace.id必須是唯一的

-->

<mapper namespace="com.zy.pojo.ProductMapper">


? ? <select id="getProductByPid" resultMap="productMap">

? ? ? select * from products where pid = #{uid}

? ? </select>

? ? <resultMap id="productMap" type="com.zy.pojo.Product">

? ? ? ? <id column="pid" property="pid"></id>

? ? ? ? <association property="t" column="tid" select="com.zy.pojo.TypeMapper.getTypesByTid" />

? ? </resultMap>

</mapper>


TypeMapper.xml

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

<!--

? ? 每個(gè)mapper文件都將有一個(gè)自己的映射的namespace,

? ? 每個(gè)方法對(duì)應(yīng)自己的sql語(yǔ)句,每個(gè)sql語(yǔ)句對(duì)應(yīng)有一個(gè)id

? ? 整個(gè)項(xiàng)目中所有的namespace.id必須是唯一的

-->

<mapper namespace="com.zy.pojo.TypeMapper">


? ? <select id="getTypesByTid" resultType="com.zy.pojo.Types">

? ? ? select * from types where tid = #{tid}

? ? </select>

</mapper>


TestOrder.java

package com.zy.test;

import com.zy.pojo.Order;

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.After;

import org.junit.Before;

import org.junit.Test;

import java.io.IOException;

public class TestOrders {

? ? private SqlSessionFactory sf = null;

? ? private SqlSession session = null;

? ? @Before

? ? public void setUp(){

? ? ? ? try {

? ? ? ? ? ? sf = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis.xml"));

? ? ? ? ? ? session = sf.openSession();

? ? ? ? } catch (IOException e) {

? ? ? ? ? ? e.printStackTrace();

? ? ? ? }

? ? }

? ? @After

? ? public void tearDown(){

? ? ? ? if(session != null){

? ? ? ? ? ? session.close();

? ? ? ? ? ? session = null;

? ? ? ? }

? ? }

//? ? @Test

//? ? public void testSession(){

//? ? ? ? System.out.println(session);

//? ? }

? ? @Test

? ? public void testGetOrderByOid(){

? ? ? ? Order order = session.selectOne("com.zy.pojo.OrderMapper.getOrderByOid", "d44e970b629d11eaad320242ac110003");

? ? ? ? System.out.println(order);

? ? }

}


運(yùn)行結(jié)果

/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=50351:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/tools.jar:/Users/james/Documents/NZ1903/lesson/Days22Mybatis2/target/test-classes:/Users/james/Documents/NZ1903/lesson/Days22Mybatis2/target/classes:/Users/james/Documents/doc/repository/junit/junit/4.12/junit-4.12.jar:/Users/james/Documents/doc/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/james/Documents/doc/repository/mysql/mysql-connector-java/5.1.44/mysql-connector-java-5.1.44.jar:/Users/james/Documents/doc/repository/org/mybatis/mybatis/3.4.4/mybatis-3.4.4.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.qfedu.test.TestOrders,testGetOrderByOid

Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.

Opening JDBC Connection

Wed Mar 11 11:34:57 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@79efed2d]

==>? Preparing: select * from orders where oid = ?

==> Parameters: d44e970b629d11eaad320242ac110003(String)

<==? ? Columns: oid, price, addr, payType, uid

<==? ? ? ? Row: d44e970b629d11eaad320242ac110003, 30998, beijingxisanqi, zhibubao, 1

====>? Preparing: select * from users where uid = ?

====> Parameters: 1(Integer)

<====? ? Columns: uid, name, pass, phone

<====? ? ? ? Row: 1, wukong, 888888, 13333333333

<====? ? ? Total: 1

====>? Preparing: select * from details where oid = ?

====> Parameters: d44e970b629d11eaad320242ac110003(String)

<====? ? Columns: did, count, pid, oid

<====? ? ? ? Row: 35984c20629e11eaad320242ac110003, 2, 321607c2629b11eaad320242ac110003, d44e970b629d11eaad320242ac110003

======>? Preparing: select * from products where pid = ?

======> Parameters: 321607c2629b11eaad320242ac110003(String)

<======? ? Columns: pid, name, img, price, tid

<======? ? ? ? Row: 321607c2629b11eaad320242ac110003, iphone x, iphone.jpg, 9999, dd6501cb628111eaad320242ac110003

========>? Preparing: select * from types where tid = ?

========> Parameters: dd6501cb628111eaad320242ac110003(String)

<========? ? Columns: tid, name

<========? ? ? ? Row: dd6501cb628111eaad320242ac110003, digit

<========? ? ? Total: 1

<======? ? ? Total: 1

<====? ? ? ? Row: 569250ff629e11eaad320242ac110003, 1, ba23b88a629b11eaad320242ac110003, d44e970b629d11eaad320242ac110003

======>? Preparing: select * from products where pid = ?

======> Parameters: ba23b88a629b11eaad320242ac110003(String)

<======? ? Columns: pid, name, img, price, tid

<======? ? ? ? Row: ba23b88a629b11eaad320242ac110003, yagao, heiren.jpg, 99, dd64fd48628111eaad320242ac110003

========>? Preparing: select * from types where tid = ?

========> Parameters: dd64fd48628111eaad320242ac110003(String)

<========? ? Columns: tid, name

<========? ? ? ? Row: dd64fd48628111eaad320242ac110003, house

<========? ? ? Total: 1

<======? ? ? Total: 1

<====? ? ? ? Row: 56f00543629e11eaad320242ac110003, 1, f07de571628211eaad320242ac110003, d44e970b629d11eaad320242ac110003

======>? Preparing: select * from products where pid = ?

======> Parameters: f07de571628211eaad320242ac110003(String)

<======? ? Columns: pid, name, img, price, tid

<======? ? ? ? Row: f07de571628211eaad320242ac110003, mac pro, mac.jpg, 21999, dd6501cb628111eaad320242ac110003

<======? ? ? Total: 1

<====? ? ? Total: 3

<==? ? ? Total: 1

Order{oid='d44e970b629d11eaad320242ac110003', price=30998.0, addr='beijingxisanqi', payType='zhibubao', u=User{uid=1, name='wukong', pass='888888', phone='13333333333'}, details=[Detail{did='35984c20629e11eaad320242ac110003', count=2, pro=Product{pid='321607c2629b11eaad320242ac110003', name='iphone x', img='iphone.jpg', price=9999.0, t=Types{tid=dd6501cb628111eaad320242ac110003, name='digit'}}}, Detail{did='569250ff629e11eaad320242ac110003', count=1, pro=Product{pid='ba23b88a629b11eaad320242ac110003', name='yagao', img='heiren.jpg', price=99.0, t=Types{tid=dd64fd48628111eaad320242ac110003, name='house'}}}, Detail{did='56f00543629e11eaad320242ac110003', count=1, pro=Product{pid='f07de571628211eaad320242ac110003', name='mac pro', img='mac.jpg', price=21999.0, t=Types{tid=dd6501cb628111eaad320242ac110003, name='digit'}}}]}

Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@79efed2d]

Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@79efed2d]

Process finished with exit code 0

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 類加載器負(fù)責(zé)的范圍,首先看張圖 通過(guò)代碼驗(yàn)證如下結(jié)論 在idea里面運(yùn)行上述程序,會(huì)的到如下結(jié)果 啟動(dòng)類加載器/L...
    ZFH__ZJ閱讀 570評(píng)論 0 0
  • 下載項(xiàng)https://github.com/ https://gitee.com/ 一,添加依賴 二創(chuàng)建pojo ...
    清風(fēng)_皓月閱讀 194評(píng)論 0 0
  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom閱讀 3,131評(píng)論 0 3
  • 一、什么是Classloader 一個(gè)Java程序要想運(yùn)行起來(lái),首先需要經(jīng)過(guò)編譯生成 .class文件,然后創(chuàng)建一...
    阿里加多閱讀 2,732評(píng)論 1 21
  • macOX環(huán)境搭建 官網(wǎng)下載JDK http://www.oracle.com/technetwork/java/...
    量久閱讀 139評(píng)論 0 0

友情鏈接更多精彩內(nèi)容