test: 测试复杂嵌套类型映射。

This commit is contained in:
Suomm 2023-06-08 08:15:36 +08:00
parent 7b2c665289
commit 27d2127ed8
16 changed files with 454 additions and 194 deletions

View File

@ -1,23 +1,23 @@
/** /*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p> * <p>
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* <p> * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* <p> * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.mybatisflex.test.model; package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.KeyType; import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.util.Date; import java.util.Date;

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
/**
* 商品
*
* @author 王帅
* @since 2023-06-07
*/
@Table("tb_good")
public class Good {
@Id
private Integer goodId;
private String name;
private double price;
public Integer getGoodId() {
return goodId;
}
public void setGoodId(Integer goodId) {
this.goodId = goodId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
@Override
public String toString() {
return "Good{" +
"goodId=" + goodId +
", name='" + name + '\'' +
", price=" + price +
'}';
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import java.time.LocalDateTime;
/**
* 订单
*
* @author 王帅
* @since 2023-06-07
*/
@Table("tb_order")
public class Order {
@Id
private int orderId;
private LocalDateTime createTime;
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "Order{" +
"orderId=" + orderId +
", createTime=" + createTime +
'}';
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Table;
/**
* 订单与商品连接表
*
* @author 王帅
* @since 2023-06-07
*/
@Table("tb_order_good")
public class OrderGood {
private Integer orderId;
private Integer goodId;
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public Integer getGoodId() {
return goodId;
}
public void setGoodId(Integer goodId) {
this.goodId = goodId;
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import java.time.LocalDateTime;
import java.util.List;
/**
* 订单信息
*
* @author 王帅
* @since 2023-06-07
*/
public class OrderInfo {
private Integer orderId;
private LocalDateTime createTime;
private List<Good> goodList;
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public List<Good> getGoodList() {
return goodList;
}
public void setGoodList(List<Good> goodList) {
this.goodList = goodList;
}
@Override
public String toString() {
return "OrderInfo{" +
"orderId=" + orderId +
", createTime=" + createTime +
", goodList=" + goodList +
'}';
}
}

View File

@ -19,13 +19,13 @@ package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import java.util.Objects;
/** /**
* 角色
*
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
@Table("sys_role") @Table("tb_role")
public class Role { public class Role {
@Id @Id
@ -57,26 +57,6 @@ public class Role {
this.roleName = roleName; this.roleName = roleName;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Role role = (Role) o;
if (!Objects.equals(roleId, role.roleId)) return false;
if (!Objects.equals(roleKey, role.roleKey)) return false;
return Objects.equals(roleName, role.roleName);
}
@Override
public int hashCode() {
int result = roleId != null ? roleId.hashCode() : 0;
result = 31 * result + (roleKey != null ? roleKey.hashCode() : 0);
result = 31 * result + (roleName != null ? roleName.hashCode() : 0);
return result;
}
@Override @Override
public String toString() { public String toString() {
return "Role{" + return "Role{" +

View File

@ -19,19 +19,20 @@ package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import java.util.Objects;
/** /**
* 用户
*
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
@Table("sys_user") @Table("tb_user")
public class User { public class User {
@Id @Id
private Integer userId; private Integer userId;
private String userName; private String userName;
private String password;
public Integer getUserId() { public Integer getUserId() {
return userId; return userId;
@ -49,22 +50,12 @@ public class User {
this.userName = userName; this.userName = userName;
} }
@Override public String getPassword() {
public boolean equals(Object o) { return password;
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
if (!Objects.equals(userId, user.userId)) return false;
return Objects.equals(userName, user.userName);
} }
@Override public void setPassword(String password) {
public int hashCode() { this.password = password;
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
return result;
} }
@Override @Override
@ -72,6 +63,7 @@ public class User {
return "User{" + return "User{" +
"userId=" + userId + "userId=" + userId +
", userName='" + userName + '\'' + ", userName='" + userName + '\'' +
", password='" + password + '\'' +
'}'; '}';
} }
} }

View File

@ -0,0 +1,86 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import java.util.List;
/**
* 用户信息
*
* @author 王帅
* @since 2023-06-07
*/
public class UserInfo {
private Integer userId;
private String userName;
private String password;
private List<Role> roleList;
private List<OrderInfo> orderInfoList;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Role> getRoleList() {
return roleList;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
}
public List<OrderInfo> getOrderInfoList() {
return orderInfoList;
}
public void setOrderInfoList(List<OrderInfo> orderInfoList) {
this.orderInfoList = orderInfoList;
}
@Override
public String toString() {
return "UserInfo{" +
"userId=" + userId +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
", roleList=" + roleList +
", orderInfoList=" + orderInfoList +
'}';
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Table;
/**
* 用户订单映射
*
* @author 王帅
* @since 2023-06-07
*/
@Table("tb_user_order")
public class UserOrder {
private Integer userId;
private Integer orderId;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
}

View File

@ -18,13 +18,13 @@ package com.mybatisflex.test.model;
import com.mybatisflex.annotation.Table; import com.mybatisflex.annotation.Table;
import java.util.Objects;
/** /**
* 用户与角色连接表
*
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
@Table("sys_user_role") @Table("tb_user_role")
public class UserRole { public class UserRole {
private Integer userId; private Integer userId;
@ -45,23 +45,4 @@ public class UserRole {
public void setRoleId(Integer roleId) { public void setRoleId(Integer roleId) {
this.roleId = roleId; this.roleId = roleId;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserRole userRole = (UserRole) o;
if (!Objects.equals(userId, userRole.userId)) return false;
return Objects.equals(roleId, userRole.roleId);
}
@Override
public int hashCode() {
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (roleId != null ? roleId.hashCode() : 0);
return result;
}
} }

View File

@ -17,11 +17,12 @@
package com.mybatisflex.test.model; package com.mybatisflex.test.model;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 用户 VO 对象
*
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
public class UserVO { public class UserVO {
@ -29,7 +30,6 @@ public class UserVO {
private String userId; private String userId;
private String userName; private String userName;
private List<Role> roleList; private List<Role> roleList;
private Role role;
public String getUserId() { public String getUserId() {
return userId; return userId;
@ -55,43 +55,12 @@ public class UserVO {
this.roleList = roleList; this.roleList = roleList;
} }
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserVO userVO = (UserVO) o;
if (!Objects.equals(userId, userVO.userId)) return false;
if (!Objects.equals(userName, userVO.userName)) return false;
if (!Objects.equals(roleList, userVO.roleList)) return false;
return Objects.equals(role, userVO.role);
}
@Override
public int hashCode() {
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (roleList != null ? roleList.hashCode() : 0);
result = 31 * result + (role != null ? role.hashCode() : 0);
return result;
}
@Override @Override
public String toString() { public String toString() {
return "UserVO{" + return "UserVO{" +
"userId='" + userId + '\'' + "userId='" + userId + '\'' +
", userName='" + userName + '\'' + ", userName='" + userName + '\'' +
", roleList=" + roleList + ", roleList=" + roleList +
", role=" + role +
'}'; '}';
} }
} }

View File

@ -17,11 +17,10 @@
package com.mybatisflex.test.model; package com.mybatisflex.test.model;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
public class UserVO1 { public class UserVO1 {
@ -29,6 +28,7 @@ public class UserVO1 {
private String userId; private String userId;
private String userName; private String userName;
private List<Role> roleList; private List<Role> roleList;
private Role role;
public String getUserId() { public String getUserId() {
return userId; return userId;
@ -54,32 +54,21 @@ public class UserVO1 {
this.roleList = roleList; this.roleList = roleList;
} }
@Override public Role getRole() {
public boolean equals(Object o) { return role;
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserVO1 userVO1 = (UserVO1) o;
if (!Objects.equals(userId, userVO1.userId)) return false;
if (!Objects.equals(userName, userVO1.userName)) return false;
return Objects.equals(roleList, userVO1.roleList);
} }
@Override public void setRole(Role role) {
public int hashCode() { this.role = role;
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (roleList != null ? roleList.hashCode() : 0);
return result;
} }
@Override @Override
public String toString() { public String toString() {
return "UserVO{" + return "UserVO1{" +
"userId='" + userId + '\'' + "userId='" + userId + '\'' +
", userName='" + userName + '\'' + ", userName='" + userName + '\'' +
", roleList=" + roleList + ", roleList=" + roleList +
", role=" + role +
'}'; '}';
} }
} }

View File

@ -16,11 +16,9 @@
package com.mybatisflex.test.model; package com.mybatisflex.test.model;
import java.util.Objects;
/** /**
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
public class UserVO2 { public class UserVO2 {
@ -45,7 +43,6 @@ public class UserVO2 {
this.userName = userName; this.userName = userName;
} }
public Role getRole() { public Role getRole() {
return role; return role;
} }
@ -54,29 +51,9 @@ public class UserVO2 {
this.role = role; this.role = role;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserVO2 userVO = (UserVO2) o;
if (!Objects.equals(userId, userVO.userId)) return false;
if (!Objects.equals(userName, userVO.userName)) return false;
return Objects.equals(role, userVO.role);
}
@Override
public int hashCode() {
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (role != null ? role.hashCode() : 0);
return result;
}
@Override @Override
public String toString() { public String toString() {
return "UserVO{" + return "UserVO2{" +
"userId='" + userId + '\'' + "userId='" + userId + '\'' +
", userName='" + userName + '\'' + ", userName='" + userName + '\'' +
", role=" + role + ", role=" + role +

View File

@ -16,11 +16,9 @@
package com.mybatisflex.test.model; package com.mybatisflex.test.model;
import java.util.Objects;
/** /**
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
public class UserVO3 { public class UserVO3 {
@ -71,30 +69,6 @@ public class UserVO3 {
this.roleName = roleName; this.roleName = roleName;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserVO3 userVO3 = (UserVO3) o;
if (!Objects.equals(userId, userVO3.userId)) return false;
if (!Objects.equals(userName, userVO3.userName)) return false;
if (!Objects.equals(roleId, userVO3.roleId)) return false;
if (!Objects.equals(roleKey, userVO3.roleKey)) return false;
return Objects.equals(roleName, userVO3.roleName);
}
@Override
public int hashCode() {
int result = userId != null ? userId.hashCode() : 0;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (roleId != null ? roleId.hashCode() : 0);
result = 31 * result + (roleKey != null ? roleKey.hashCode() : 0);
result = 31 * result + (roleName != null ? roleName.hashCode() : 0);
return result;
}
@Override @Override
public String toString() { public String toString() {
return "UserVO3{" + return "UserVO3{" +

View File

@ -5,7 +5,7 @@ spring:
# enabled: true # enabled: true
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://localhost:3306/mp_test
username: root username: root
password: 12345678 password: 12345678
# sql: # sql:

View File

@ -17,21 +17,25 @@
package com.mybatisflex.test.mapper; package com.mybatisflex.test.mapper;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.test.model.UserInfo;
import com.mybatisflex.test.model.UserVO1; import com.mybatisflex.test.model.UserVO1;
import com.mybatisflex.test.model.UserVO3;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.util.List; import java.util.List;
import static com.mybatisflex.test.model.table.GoodTableDef.GOOD;
import static com.mybatisflex.test.model.table.OrderGoodTableDef.ORDER_GOOD;
import static com.mybatisflex.test.model.table.OrderTableDef.ORDER;
import static com.mybatisflex.test.model.table.RoleTableDef.ROLE; import static com.mybatisflex.test.model.table.RoleTableDef.ROLE;
import static com.mybatisflex.test.model.table.UserOrderTableDef.USER_ORDER;
import static com.mybatisflex.test.model.table.UserRoleTableDef.USER_ROLE; import static com.mybatisflex.test.model.table.UserRoleTableDef.USER_ROLE;
import static com.mybatisflex.test.model.table.UserTableDef.USER; import static com.mybatisflex.test.model.table.UserTableDef.USER;
/** /**
* @author 王帅 * @author 王帅
* @since 2.0 * @since 2023-06-07
*/ */
@SpringBootTest @SpringBootTest
class UserMapperTest { class UserMapperTest {
@ -59,15 +63,32 @@ class UserMapperTest {
void testSelectList() { void testSelectList() {
QueryWrapper queryWrapper = QueryWrapper.create() QueryWrapper queryWrapper = QueryWrapper.create()
.select(USER.USER_ID, USER.USER_NAME, ROLE.ALL_COLUMNS) .select(USER.USER_ID, USER.USER_NAME, ROLE.ALL_COLUMNS)
.from(USER) .from(USER.as("u"))
.leftJoin(USER_ROLE).on(USER_ROLE.USER_ID.eq(USER.USER_ID)) .leftJoin(USER_ROLE).as("ur").on(USER_ROLE.USER_ID.eq(USER.USER_ID))
.leftJoin(ROLE).on(USER_ROLE.ROLE_ID.eq(ROLE.ROLE_ID)); .leftJoin(ROLE).as("r").on(USER_ROLE.ROLE_ID.eq(ROLE.ROLE_ID))
// System.out.println(queryWrapper.toSQL()); .where(USER.USER_ID.ge(2));
System.out.println(queryWrapper.toSQL());
// List<UserVO> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO.class); // List<UserVO> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO.class);
// List<UserVO1> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO1.class); List<UserVO1> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO1.class);
// List<UserVO2> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO2.class); // List<UserVO2> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO2.class);
List<UserVO3> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO3.class); // List<UserVO3> userVOS = userMapper.selectListByQueryAs(queryWrapper, UserVO3.class);
userVOS.forEach(System.err::println); userVOS.forEach(System.err::println);
} }
@Test
void testComplexSelectList() {
QueryWrapper queryWrapper = QueryWrapper.create()
.select(USER.ALL_COLUMNS, ROLE.ALL_COLUMNS, ORDER.ALL_COLUMNS, GOOD.ALL_COLUMNS)
.from(USER.as("u"))
.leftJoin(USER_ROLE).as("ur").on(USER.USER_ID.eq(USER_ROLE.USER_ID))
.leftJoin(ROLE).as("r").on(ROLE.ROLE_ID.eq(USER_ROLE.ROLE_ID))
.leftJoin(USER_ORDER).as("uo").on(USER.USER_ID.eq(USER_ORDER.USER_ID))
.leftJoin(ORDER).as("o").on(ORDER.ORDER_ID.eq(USER_ORDER.ORDER_ID))
.leftJoin(ORDER_GOOD).as("og").on(ORDER.ORDER_ID.eq(ORDER_GOOD.ORDER_ID))
.leftJoin(GOOD).as("g").on(GOOD.GOOD_ID.eq(ORDER_GOOD.GOOD_ID));
System.err.println(queryWrapper.toSQL());
List<UserInfo> userInfos = userMapper.selectListByQueryAs(queryWrapper, UserInfo.class);
userInfos.forEach(System.err::println);
}
} }