This commit is contained in:
admin 2021-01-28 11:00:50 +08:00
parent b668d64c71
commit 1f29d3c16d

View File

@ -26,6 +26,7 @@
查询user表中的head_img,name和user_address表中的address,tel 查询user表中的head_img,name和user_address表中的address,tel
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/select.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/select.png)
对应sql 对应sql
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectSql.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectSql.png)
#### selectAll(UserEntity.class) 查询UserEntity全部字段 #### selectAll(UserEntity.class) 查询UserEntity全部字段
@ -33,6 +34,7 @@
查询user全部字段和user_address表中的address,tel 查询user全部字段和user_address表中的address,tel
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAll.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAll.png)
对应sql 对应sql
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAllSql.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAllSql.png)
#### as(UserEntity::getHeadImg,UserDTO::getUserHeadImg) #### as(UserEntity::getHeadImg,UserDTO::getUserHeadImg)
@ -40,6 +42,7 @@
查询字段head_img as userHeadImg 查询字段head_img as userHeadImg
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAs.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAs.png)
对应sql 对应sql
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAsSql.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectAsSql.png)
#### 左连接 leftJoin(UserEntity::getId,UserAddressEntity::getUserId,right -> right) #### 左连接 leftJoin(UserEntity::getId,UserAddressEntity::getUserId,right -> right)
@ -52,6 +55,7 @@ user left join user_address on user.id = User_address.user_id
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectEq.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectEq.png)
对应sql 对应sql
![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectEqSql.png) ![image](https://gitee.com/best_handsome/mybatis-plus-join/raw/master/doc/selectEqSql.png)
#### [参考测试类](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/test/java/com/example/mp/MpJoinTest.java) #### [参考测试类](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/test/java/com/example/mp/MpJoinTest.java)