diff --git a/mybatis-flex-kotlin/src/test/java/com/mybatisflex/kotlintest/ExtensionTest.kt b/mybatis-flex-kotlin/src/test/java/com/mybatisflex/kotlintest/ExtensionTest.kt index 22aa2f10..d6bb492a 100755 --- a/mybatis-flex-kotlin/src/test/java/com/mybatisflex/kotlintest/ExtensionTest.kt +++ b/mybatis-flex-kotlin/src/test/java/com/mybatisflex/kotlintest/ExtensionTest.kt @@ -57,11 +57,11 @@ fun main() { it }.toList().batchInsert() println("批量插入后————————") - ACCOUNT.all().stream().peek { println(it) }.toList().filter { it.id!!.rem(2) == 0 }.batchDeleteById() + ACCOUNT.all().stream().peek { println(it) }.toList().filter { it.id.rem(2) == 0 }.batchDeleteById() println("批量删除后————————") - //使用DB对象查询时无需指定from表 - DB.query {from(ACCOUNT)}.stream().peek { println(it) }.toList().filter { it.id!!.rem(3) == 0 }.map { it.userName = "哈哈" + //使用DB对象查询时需指定from表 + DB.query {from(ACCOUNT)}.stream().peek { println(it) }.toList().filter { it.id.rem(3) == 0 }.map { it.userName = "哈哈" it }.batchUpdate() println("批量更新后————————") @@ -76,6 +76,9 @@ interface AccountMapper : BaseMapper { fun findByAge(age: Int, vararg ids: Int): List = queryList { select(ACCOUNT.ALL_COLUMNS) from(ACCOUNT) + from { + select() + } where(ACCOUNT) { (AGE `=` age) and `if`(true) { ID `in` ids.asList()