package io.github.coinsjack.pojo;
Area area;
} |
public class Area implements Serializable{
|
<resultMap id="simpleResultMap" type="Shop">
|
这里需要注意, association必须放置在result后面
<?xml version="1.0" encoding="UTF-8" ?>
|
public interface AreaMapper {
|
@Test
|
2018-12-28 20:33:07,171 [main] DEBUG [io.github.coinsjack.dao.ShopMapper] - Cache Hit Ratio [io.github.coinsjack.dao.ShopMapper]: 0.0 2018-12-28 20:33:07,565 [main] DEBUG [io.github.coinsjack.dao.ShopMapper.getShopById] - ==> Preparing: select * from tb_shop where `shop_id` = ? 2018-12-28 20:33:07,655 [main] DEBUG [io.github.coinsjack.dao.ShopMapper.getShopById] - ==> Parameters: 1(Integer) 2018-12-28 20:33:07,728 [main] DEBUG [io.github.coinsjack.dao.AreaMapper.getAreaById] - ====> Preparing: select * from tb_area WHERE `area_id` = ?; 2018-12-28 20:33:07,729 [main] DEBUG [io.github.coinsjack.dao.AreaMapper.getAreaById] - ====> Parameters: 3(Integer) 2018-12-28 20:33:07,736 [main] DEBUG [io.github.coinsjack.dao.AreaMapper.getAreaById] - <==== Total: 1 2018-12-28 20:33:07,737 [main] DEBUG [io.github.coinsjack.dao.ShopMapper.getShopById] - <== Total: 1 Shop{id=1, ownerId=1, area=Area{id=3, name=‘长治学院‘, priority=2, createTime=null, lastEditTime=null}, categoryId=14, name=‘new 正式店铺名称‘, desc=‘测试描述‘, addr=‘正式地址‘, phone=‘13810524086‘, image=‘/upload/item/shop/1/2017091621545314507.jpg‘, priority=10, createTime=2017-08-03, lastEditTime=2017-09-16, enableStatus=0, advice=‘审核中‘} |
Mybatis学习第17节 -- 嵌套查询(多对一和一对一)
原文:https://www.cnblogs.com/litran/p/10545901.html