mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
fixed and close #I6X4U8
This commit is contained in:
parent
9265fa7755
commit
3af6c82c67
@ -54,6 +54,10 @@ public class Brackets extends QueryCondition {
|
|||||||
return checkEffective() ? WrapperUtil.getValues(childCondition) : null;
|
return checkEffective() ? WrapperUtil.getValues(childCondition) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QueryCondition getChildCondition(){
|
||||||
|
return childCondition;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toSql(List<QueryTable> queryTables, IDialect dialect) {
|
public String toSql(List<QueryTable> queryTables, IDialect dialect) {
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|||||||
@ -38,6 +38,17 @@ class WrapperUtil {
|
|||||||
List<QueryWrapper> list = null;
|
List<QueryWrapper> list = null;
|
||||||
while (condition != null) {
|
while (condition != null) {
|
||||||
if (condition.checkEffective()) {
|
if (condition.checkEffective()) {
|
||||||
|
if (condition instanceof Brackets) {
|
||||||
|
List<QueryWrapper> childQueryWrapper = getChildSelect(((Brackets) condition).getChildCondition());
|
||||||
|
if (!childQueryWrapper.isEmpty()) {
|
||||||
|
if (list == null) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
}
|
||||||
|
list.addAll(childQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not Brackets
|
||||||
|
else {
|
||||||
Object value = condition.getValue();
|
Object value = condition.getValue();
|
||||||
if (value instanceof QueryWrapper) {
|
if (value instanceof QueryWrapper) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
@ -58,6 +69,7 @@ class WrapperUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
condition = condition.next;
|
condition = condition.next;
|
||||||
}
|
}
|
||||||
return list == null ? Collections.emptyList() : list;
|
return list == null ? Collections.emptyList() : list;
|
||||||
|
|||||||
@ -64,6 +64,19 @@ public class EntityTestStarter {
|
|||||||
// Page<Account> paginate = accountMapper.paginate(1,10,queryWrapper);
|
// Page<Account> paginate = accountMapper.paginate(1,10,queryWrapper);
|
||||||
// System.out.println(paginate);
|
// System.out.println(paginate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// QueryWrapper query = QueryWrapper.create()
|
||||||
|
// .where(ACCOUNT.ID.in(
|
||||||
|
// select(ACCOUNT.ID).from(ACCOUNT)
|
||||||
|
// .where(ACCOUNT.ID.eq(1))
|
||||||
|
// ).and("1 = 1")
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// List<Account> accounts = accountMapper.selectListByQuery(query);
|
||||||
|
// System.out.println(accounts);
|
||||||
|
|
||||||
|
|
||||||
// List<Account> accounts = new ArrayList<>();
|
// List<Account> accounts = new ArrayList<>();
|
||||||
// for (int i = 0; i < 10; i++) {
|
// for (int i = 0; i < 10; i++) {
|
||||||
// Account account = new Account();
|
// Account account = new Account();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user