use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn3.
/**
* 测试无外键情况下condition:in功能且变量类型为数字的情况
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn3.xml")
public void testConditionIn3() {
Account_Condition ac = new Account_Condition();
List<Integer> opLockC = new ArrayList<>();
opLockC.add(1);
opLockC.add(2);
ac.setOpLockIn(opLockC);
int count = accountService.count(ac);
Assert.assertEquals(2, count);
}
use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.
the class ConditionInTest method testConditionIn2.
/**
* 测试有外键情况下condition:in功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionInTest/testConditionIn2.xml")
public void testConditionIn2() {
LoginLog_Condition lc = new LoginLog_Condition();
List<String> loginIpC = new ArrayList<>();
loginIpC.add("11");
loginIpC.add("22");
lc.setLoginIPIn(loginIpC);
Account_Condition ac = new Account_Condition();
List<String> nameC = new ArrayList<>();
nameC.add("ann");
nameC.add("bob");
ac.setNameIn(nameC);
lc.setAccount(ac);
Collection<LoginLog_> c = loginLogService.selectAll(lc);
Assert.assertEquals(2, c.size());
int count = loginLogService.count(lc);
Assert.assertEquals(2, count);
}
use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.
the class ConditionNotInTest method testConditionNotIn2.
/**
* 测试有外键情况下condition:notIn功能
*/
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionNotInTest/testConditionIn2.xml")
public void testConditionNotIn2() {
LoginLog_Condition lc = new LoginLog_Condition();
Account_Condition ac = new Account_Condition();
List<String> nameC = new ArrayList<>();
nameC.add("ann");
nameC.add("bob");
ac.setNameNotIn(nameC);
lc.setAccount(ac);
Collection<LoginLog_> c = loginLogService.selectAll(lc);
Assert.assertEquals(0, c.size());
int count = loginLogService.count(lc);
Assert.assertEquals(0, count);
}
use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.
the class ConditionTest method testMultiLikeAND.
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeAND.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/conditionTest/testMultiLikeAND.xml")
public void testMultiLikeAND() {
Account_Condition ac = new Account_Condition();
ac.setName("ann");
ac.setEmailLike("as");
List<String> multi = new ArrayList<>();
multi.add("a");
multi.add("s");
multi.add("d");
ac.setMultiLike(multi);
Collection<Account_> c = accountService.selectAll(ac);
Assert.assertEquals(1, c.size());
int conut = accountService.count(ac);
Assert.assertEquals(1, conut);
Account_Condition ac2 = new Account_Condition();
ac2.setName("ann");
ac2.setEmailLike("as");
List<String> multi2 = new LinkedList<>();
ac2.setMultiLike(multi2);
Collection<Account_> c2 = accountService.selectAll(ac2);
Assert.assertEquals(1, c2.size());
Account_Condition ac3 = new Account_Condition();
List<String> multi3 = new ArrayList<>();
multi3.add(null);
multi3.add("a");
multi3.add(null);
ac3.setMultiLike(multi3);
Collection<Account_> c3 = accountService.selectAll(ac3);
Assert.assertEquals(1, c3.size());
LoginLog_ lc = new LoginLog_();
Account_Condition ac4 = new Account_Condition();
List<String> multi4 = new ArrayList<>();
multi4.add("a");
ac4.setMultiLike(multi4);
lc.setAccount(ac4);
Collection<LoginLog_> c4 = loginLogService.selectAll(lc);
Assert.assertEquals(1, c4.size());
}
use of indi.mybatis.flying.pojo.condition.Account_Condition in project mybatis.flying by limeng32.
the class OrTest method testOr5.
@Test
@DatabaseSetup(type = DatabaseOperation.CLEAN_INSERT, value = "/indi/mybatis/flying/test/orTest/testOr5.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml")
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/orTest/testOr5.result.xml")
public void testOr5() {
LoginLog_Condition lc = new LoginLog_Condition();
lc.setAccount(new Account_Condition());
lc.getAccount().setRole(new Role_Condition());
lc.getAccount().setRoleDeputy(new Role_Condition());
((Role_Condition) lc.getAccount().getRole()).setNameEqualsOrAccountNameEquals("user", "bob");
((Role_Condition) lc.getAccount().getRoleDeputy()).setNameEqualsOrAccountNameEquals("silver", "bob");
Collection<LoginLog_> loginLogC = loginLogService.selectAll(lc);
Assert.assertEquals(2, loginLogC.size());
}
Aggregations