mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
test: 测试 QueryWrapper 传入 null 值。
This commit is contained in:
parent
af85476c82
commit
996310456c
@ -16,6 +16,8 @@
|
||||
|
||||
package com.mybatisflex.test.model;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -25,6 +27,7 @@ import java.util.List;
|
||||
public class BaseEntity<T, ID, L> extends IdEntity<ID> {
|
||||
|
||||
protected T userName;
|
||||
@Column(ignore = true)
|
||||
protected List<L> roles;
|
||||
|
||||
public List<L> getRoles() {
|
||||
|
||||
@ -4,7 +4,7 @@ spring:
|
||||
# console:
|
||||
# enabled: true
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/flex_test
|
||||
username: root
|
||||
password: 12345678
|
||||
|
||||
@ -17,14 +17,18 @@
|
||||
package com.mybatisflex.test.mapper;
|
||||
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.row.Db;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.test.model.Account;
|
||||
import com.mybatisflex.test.model.AccountVO;
|
||||
import com.mybatisflex.test.model.Gender;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT;
|
||||
import static com.mybatisflex.test.model.table.RoleTableDef.ROLE;
|
||||
@ -86,4 +90,26 @@ class AccountMapperTest {
|
||||
accountMapper.update(account);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSelectList() {
|
||||
List<Account> accounts = accountMapper.selectListByQuery(null);
|
||||
System.out.println(accounts);
|
||||
List<Row> account = Db.selectListByQuery("tb_account", null);
|
||||
System.out.println(account);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdateAll() {
|
||||
Account account = new Account();
|
||||
account.setAge(10);
|
||||
Assertions.assertThrows(Exception.class, () ->
|
||||
accountMapper.updateByQuery(account, QueryWrapper.create()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteAll() {
|
||||
Assertions.assertThrows(Exception.class, () ->
|
||||
accountMapper.deleteByQuery(QueryWrapper.create()));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user