This commit is contained in:
Looly 2023-03-17 00:55:08 +08:00
parent ed512e3377
commit bcb83e87de
2 changed files with 14 additions and 1 deletions

View File

@ -35,7 +35,7 @@ public class StringConverter extends AbstractConverter {
* @param stringFunction 序列化函数
* @return this
*/
public StringConverter putStringer(Class<?> clazz, Function<Object, String> stringFunction){
public StringConverter putStringer(final Class<?> clazz, final Function<Object, String> stringFunction){
if(null == stringer){
stringer = new HashMap<>();
}

View File

@ -55,6 +55,19 @@ public class DbTest {
Assert.assertEquals(1, page1.size());
}
@Test
public void pageBySqlWithInTest() {
// in和其他条件混用
final String sql = "select * from user where age > :age and name in (:names) order by name";
// 测试数据库中一共4条数据第0页有3条第1页有1条
final List<Entity> page0 = Db.of().page(
sql, Page.of(0, 3),
Entity.of().set("age", 12)
.set("names", new String[]{"张三", "王五"})
);
Assert.assertEquals(1, page0.size());
}
@Test
public void pageWithParamsTest() {
final String sql = "select * from user where name = ?";