-
Notifications
You must be signed in to change notification settings - Fork 5
4.2 multi table query
xphsc edited this page Jul 9, 2018
·
1 revision
3.2 链式API 多表查询
List<User> users = easyJdbcTemplate.selector()
.SELECT("u.user_name")
.FROM("t_user u")
.JOIN("t_user1 u1 on u1.uid = u.id")//JOIN语句
.WHERE("u.user_name=?")
.entityClass(User.class)
.parameters("张三")
.list();
List<User> users = easyJdbcTemplate.selector()
.SELECT("u.user_name")
.FROM("t_user u")
.INNER_JOIN("t_user1 u1 on u1.uid = u.id")//innerJoin语句
.WHERE("u.user_name=?")
.entityClass(User.class)
.parameters("张三")
.list();
List<User> users = easyJdbcTemplate.selector()
.SELECT("u.user_name")
.FROM("t_user u")
.OUTER_JOIN("t_user1 u1 on u1.uid = u.id") //OUTER_JOIN语句
.WHERE("u.user_name=?")
.entityClass(User.class)
.parameters("张三")
.list();
List<User> users = easyJdbcTemplate.selector()
.SELECT("u.user_name")
.FROM("t_user u")
.LEFT_OUTER_JOIN("t_user1 u1 on u1.uid = u.id")//LEFT_OUTER_JOIN语句
.WHERE("u.user_name=?")
.entityClass(User.class)
.parameters("张三")
.list();
List<User> users = easyJdbcTemplate.selector()
.SELECT("u.user_name")
.FROM("t_user u")
.RIGHT_OUTER_JOIN("t_user1 u1 on u1.uid = u.id")//RIGHT_OUTER_JOIN语句
.WHERE("u.user_name=?")
.entityClass(User.class)
.parameters("张三")
.list();
assassination