mybatis一对一关联查询——(八)

时间:2022-12-30 16:46:13

1.需求

查询所有订单信息,关联查询下单用户信息。

注意:

  因为一个订单信息只会是一个人下的订单,所以从查询订单信息出发关联查询用户信息为一对一查询。如果从用户信息出发查询用户下的订单信息则为一对多查询,因为一个用户可以下多个订单。

2.  方法一:resultType

使用resultType,定义订单信息po类,此po类中包括了订单信息和用户信息:

2.1     sql语句

确定查询的主表:订单表

确定查询的关联表:用户表

关联查询使用内链接?还是外链接?

由于orders表中有一个外键(user_id),通过外键关联查询用户表只能查询出一条记录,可以使用内链接。

SELECT
orders.*,
USER.username,
USER.sex,
USER.address
FROM
orders,
USER
WHERE orders.user_id = user.id

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

2.2     创建pojo

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

将上边sql查询的结果映射到pojo中,pojo中必须包括所有查询列名。

原始的Orders.java不能映射全部字段,需要新创建的pojo。

创建一个pojo继承包括查询字段较多的po类。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAa4AAADSCAIAAACdALPDAAAW0UlEQVR4nO2dO2/jTHSG+bvY+PsTrt0Y+gVfa+hr3GsLAe4DuFGxQBwo7SowkMCAgQTJulERK8AawRrZZrG5bDMpeJvrmSF1G9LPA8OQOBcekoevzsxIh8WPn7+VUv/2z/+kAAA+KgVSCACAFAIAIIUAAEghAIBCCgEAVIIUvt0vr643bz2LAAAOxfPt/Opi+bA75j5iUvhydzG/e4wVXcyvVPPC+tNbWG+F7fqWUKuU0mjN6MbE/uVDSNk+gJSu9jzAlCuYeJX3Z9hJHuw/KbtzHT7dyMSe05uEKqTcj/vcZcd3gIFS2MuSiBQ+roJxn1XkPa2JbjFACt1dWE3cay/7sWBP9Tbq9In7co/Fa498dyUelNCV8Om15+XrZVLouEIM+HAd4D/pdWTzElspn49Fmwg9hzw/xc+FDlNuFrmf0zDgwqmIFL4/XM9v7t997YSiZt/pZyRRCkMKFSpSPg8b4CJRg9Nv9ZAAud0KN3Pi7oTzIx+pcNL2l9SoSPWilxT2Oj9WD9GTKTh8+sUKvY12JZxw5TsDVpN022RX9HZ+FlKc30KSwt3m5mL17G0WKkqRA7maa71bFPUGb2/engWH8B64ZZL7Vr7VZXVI7GfY/R8yJnT23N6ELdGjTpGDAQgH5dbZ33+8N3xoLyEL3fru2Ui5xCl9KudURA0T9ij4sxLPfDWCfFy1R2rMue02N91J0EbBWn27KNQq5eKGEKTw+XZ+dfvibWUXhXxIBS6PRa+7zrs9JBZunagGpdjs1pdPvXxV5GquAfJ9ItxU+mXyHrtworw2JJon2OM9EC+hfXmPd3//8Z4ibyfei2X997qE15hed2+IlFYp5817iqLe5ZbWolYHT2/3y/Z1VdQq49v90j8n+Lhy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nC3xPCKiNDz5XQHrkABmzoT85SCEJ/a1G507ov30tzTT9rUJZSbr00E8oasTuqTmurqb0hIDwcwWkou7AkULoQR5SSEL/bnsGCf1to1p5slO3phU56QurDK9bFXlCgJAQm1zZcGhykEIS+se2izWOkNC/el6dM9Td2umpO70TipQQxMWeEOB/rkCsCKA/WUkhCf1zSOj/a1Ea84MHigqDUpg6Zg9JnlAEkEwOUkhCf73i2RP6uxN23dv1rFXJJnJMKEp+mmjEqoDeeYpICgZ9yUwKSeifQUJ/fexZlK/rxZP1sON2WLpNLBJXOfxPCBCfKyA/cqCqgRZCL3KQQlK3HoncEvqfEh4eAP1ACqdLbgn9T0lmv1CE/EEKJ00uCf1PCWNjGML/A25CruOVMb13AAAAAElFTkSuQmCC" alt="" />

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

2.3 mapper.xml

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqoAAAD6CAIAAADm9vLjAAAbVUlEQVR4nO3dTYvbWL7Hcb2erJtaaFPvIG8gNKGg8TqbLAebgYZa1XXBNOlF7RqKplIhiyGGMISQ0KSboXuyycPCm8ymKSowi9xZ3UV0F7Kl8/A/fx3JsiX7fD8culPWg49l2T+dc2Qp+8///h+FQqFQKJSkSjZ4DSgUCoVCoey4ZAUAAEgM8Q8AQHJaxv8f74/vv/z+j+3UBQAA7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A8U3ZKsJYobEwb0whImgLh4JKcs38ucj+VSCWbM6azT2IBnhYgsLendqOIHoua+927J3Bil/E8XvCll/fLCmyfzB3t82V88OlOU9iRR0NpMOGBmryAehM8ZMQm8lwAAAKiRdoUDBLCwwaPfMKElAACUA/XgHL4oBkQsS0uYV0xoCQAAJeHd+PYd/p7gPCxGS7i3kr6/ur8nGAAAADgBoCUAAABALqAlAAAAQC6gJQAAAEAuoCUAAABALqAlAAAAQC6gJQAAAEAuoCUAAABALqAlAAAAQC6gJQAAAEAuoCUAAABALqAlAAAAQC6gJQAAAEAu/gfZTj6bkGSSPgAAAABJRU5ErkJggg==" alt="" />

2.5  测试

Public void testfindOrdersList()throws Exception{
//获取session
SqlSession session = sqlSessionFactory.openSession();
//获限mapper接口实例
UserMapper userMapper = session.getMapper(UserMapper.class);
//查询订单信息
List<OrdersCustom> list = userMapper.findOrdersList();
System.out.println(list);
//关闭session
session.close();
}

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

总结:

  

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

定义专门的po类作为输出类型,其中定义了sql查询结果集所有的字段。此方法较为简单,企业中使用普遍。

  

  更简单的方法是将返回值置为Map类型(resultType="map"),也就是map的key是查询的列名,更加简单。

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

3. 方法二  resultMap

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

使用resultMap,定义专门的resultMap用于映射一对一查询结果。

3.1  sql语句

SELECT
orders.*,
user.username,
user.address
FROM
orders,
user
WHERE orders.user_id = user.id

3.2      使用resultMap映射的思路

使用resultMap将查询结果中的订单信息映射到Orders对象中,在orders类中添加User属性,将关联查询出来的用户信息映射到orders对象中的user属性中。

3.3     需要Orders类中添加user属性

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASMAAAD4CAIAAAAozBciAAAVMklEQVR4nO2dPY/cthaGVd/fcX+FCnfp02yVXoDT5sJtiiBASm0xlRP/gQGynbCNgU2rwnCzbgQYkyJwYNdb8xb6OjzkoSiN5lCaeR+w8AxFSbPms6S4Gr2ZAQBcniz1CQBwE8A0ADSAafugKrKsqBKeQFPm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5c4jXaf9A47f0e7eZKYxrAEeHxP/sv7zip3/bYHDJ2m3b+vFWkbNk1qtdw0+Qvmr95+4Sc/9PKu69PPInxLPdK0y5wGTIskkWndf2T3su2jbCh7/X78N+3QrN8PI+HYLfwTQuaktHG72TAcsZeLTfOOSM791lSGNx+t48ZNR6dM0zgNtb67L5KYxqdV7X/z9IKHzzT65uv3xrZinPP0TJnW7o1znmn2bkmfdk/P2F18ehCbYZrWaczpfjdEWtO6/2M6pknPWhVNGwV792jVskFs2ZgWWZyvt0od9PvHZvyMgS/FXsY0ldPQ78S7YAPXab0bsmneqzs+YjSfyTRydIbhmDbQ98h21uo9w4kuPm5mX+o4n8Ve6RH68SLT6A67D3Lh03AXpWb3wdsgtWnOytgS04YNmBLEpebtu27Zk+khn8lI3F/wIvfGPiA/VsQCRrCQ3y/v39HH117qNLoZ6biN+18FTOrZI8oVlF/Zr7DUXXqjwDSU88qbjwar/BHANJTFxfojzVAS9+itcsN3Y6FcpqTu0htl/eeIAABcYBoAGvwfdZhi0pae2iAAAAAASUVORK5CYII=" alt="" />

3.4   mapper.xml

3.4.1           定义resultMap

<!-- 订单查询关联用户的resultMap
将整个查询的结果映射到cn.itcast.mybatis.po.Orders中
-->
<resultMap type="cn.itcast.mybatis.po.Orders" id="OrdersUserResultMap">
<!-- 配置映射的订单信息 -->
<!-- id:指定查询列中的唯 一标识,订单信息的中的唯 一标识,如果有多个列组成唯一标识,配置多个id
column:订单信息的唯 一标识 列
property:订单信息的唯 一标识 列所映射到Orders中哪个属性
-->
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="number" property="number"/>
<result column="createtime" property="createtime"/>
<result column="note" property=note/> <!-- 配置映射的关联的用户信息 -->
<!-- association:用于映射关联查询单个对象的信息
property:要将关联查询的用户信息映射到Orders中哪个属性
-->
<association property="user" javaType="cn.itcast.mybatis.po.User">
<!-- id:关联查询用户的唯 一标识
column:指定唯 一标识用户信息的列
javaType:映射到user的哪个属性
-->
<id column="user_id" property="id"/>
<result column="username" property="username"/>
<result column="sex" property="sex"/>
<result column="address" property="address"/> </association>
</resultMap>

  3.4.2          statement定义

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnYAAADuCAIAAAA7nN2pAAAbmUlEQVR4nO3dT2sUy/7H8Xk8rg9ZzCa/R3CegBwkILN241JmuCBkld8ErugiOyEcYsTFwQG5iDciejnozcboYjZxIyHuxHX6Lrqnu/5+u/pPdWom7xfNOWb6X/Vkej5dVZ2uUQYAACIYXXcBAADYTEQsAABRELEAAERBxAIAEAURCwBAFEQsAABRdIvYT2fbd948/NRTWYCUfTrbvvMmn/jMAwjRLWK/n98d9utm+84b+UXnArWz5MXaveKc5Vusy3E11bGoPZYn0gFGdvnQ+Zn/dLZ95+zdNZQHQLqCI/b7+V37GyR+xJb1Bt9ULiYsr26tdpmseSjaqxtbVv/b+3HVbkQuvPC680qi6b4E8vvc7776s3ER+/387p2/D79fdzGATRQWsZ/Otu+8ufvXL/P1AWuxvqyylwl50Te3r691uZy+Jdsdly+omh6acP3h3FdtCWW1lzuBxzW4jYvYLHv35M02rd9ABPUR++2vv72n31AR66zVOZfx1SBrt2z/KPy7NoaN4PRFdS/HFR6xmUttfBoL91WzrC1e0HF9Ott+cP4tu3zo7CVVek+3n1yqG88/1aupisZ3T7QljR+zLLMjVt9UMRXXo9/P7945O8wXeHD+rSiPksRqCR+cf1P2e/evX3nymavEkR+F4zIaQAc1EfvuyZttoREpfhOTM7qMWXLVx4goe/v27sIjRHhdKHmPxxVeZvkQjH3Jlw6+jYQzjtG5u6DjKiKq+BB+++vvMo3Uf2fZr8MHSlj6a5wtIlba5vfzu3l2lv9QV/9+frfa+OVD5TqgCNfiR73w8eSFHGBHwI0hROyvwwe1l8+XDx0RW1UpjGtzcZYkPD+EKMpcSSDkUJdoCdl11tNxBZa59hBCYrLpJYiwR99RNDuuT2faJWB1zffr8IFeJ1Mj0H8nfISI/fvwu9re41ld35e539BW6O6n3uXDJicmAFm3Wqw7YvsXHo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MSSSMQCALBpiFgAAKIgYtEj5223nhZtANh0RCwAAFH0HLGfk9fv8QIA4EPEAgAQBRELAEAURCwAAFH0ErE/5o9n47c/si4R++pgezrNp/uv+ktUSx/HCwBAvT4i9svz0ex5/uyZzgn46n6PEfvqYHt6cKi/1sPxAgAQIDhif7wdr3LUsHheVGGzdYnYH2/Hs8fzH328fwAAeIRF7Jfno1mVoxo9rrqn4jC12MXz2Wg2m3zp5T0EAMChPmKXbx8LabR8+3j0vJqXx9jro72yY9UMOaXPdfvAzlJPxEprvd/bK/c1vX303iqANss4Lvd1AwAAndVE7OL5bCS1qX6Z6Onrqzsq0VvOer+3Z+elI2LFtV7dd0d1GcxiX+yPt+PZTL1EAACgL0LE/pg/no08/a8F5UanXFnjdDX2vt/bK6qS/gi0I1Za6/XR3vbe0Wt3wAbe7vRlMpuNHr/lCboAgH51qcVWf6tTWsXi0W29ebaMT6v9tjZipbUOD/xV2JCIpRYLAIimQ1+s675cM+TeH92uUjbkViZ3xPrWOjyYtq/FCvdwAQDQWfs7ihfPHfU/K+W0Zl69VzUwYsW1tAh3zzW2VhWeO4oBADG1/rtY80an3Gfrbl4j/8x7fVfNvIcHVmuw0gLsW6vM0ZDdVXcU83exAID4Wj7dafn2sfMWIamCmoaO7xcAAIHaRazjRqfcdQdovY7vFwAAgRhpBwCAKIhYAACi6DliAQBAjogFACAKIhYAgCiIWAAAoiBiAQCIgogFACAKIhYAgCj+B6sGwPbyyyy2AAAAAElFTkSuQmCC" alt="" />

  

  3.4.3 mapper接口

public List<Orders> findOrdersListResultMap() throws Exception;

3.5  总结:

使用association完成关联查询,将关联查询信息映射到pojo对象中。

4.两种方法比较

  resultType:使用resultType实现较为简单,如果pojo中没有包括查询出来的列名,需要增加列名对应的属性,即可完成映射。(也可以直接将返回类型置为map)

  如果没有查询结果的特殊要求建议使用resultType。

  resultMap:需要单独定义resultMap,实现有点麻烦,如果对查询结果有特殊的要求,使用resultMap可以完成将关联查询映射pojo的属性中。

  resultMap可以实现延迟加载,resultType无法实现延迟加载。

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}