mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
ed512e3377
commit
bcb83e87de
@ -35,7 +35,7 @@ public class StringConverter extends AbstractConverter {
|
|||||||
* @param stringFunction 序列化函数
|
* @param stringFunction 序列化函数
|
||||||
* @return this
|
* @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){
|
if(null == stringer){
|
||||||
stringer = new HashMap<>();
|
stringer = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,19 @@ public class DbTest {
|
|||||||
Assert.assertEquals(1, page1.size());
|
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
|
@Test
|
||||||
public void pageWithParamsTest() {
|
public void pageWithParamsTest() {
|
||||||
final String sql = "select * from user where name = ?";
|
final String sql = "select * from user where name = ?";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user