mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复Db.findAll全局忽略大小写无效问题
This commit is contained in:
parent
91ad2349f1
commit
66883b42ae
@ -606,7 +606,7 @@ public abstract class AbstractDb<R extends AbstractDb<R>> extends DefaultConnect
|
|||||||
* @throws DbRuntimeException SQL执行异常
|
* @throws DbRuntimeException SQL执行异常
|
||||||
*/
|
*/
|
||||||
public List<Entity> findAll(final Entity where) throws DbRuntimeException {
|
public List<Entity> findAll(final Entity where) throws DbRuntimeException {
|
||||||
return find(where, EntityListHandler.of());
|
return find(where, new EntityListHandler(this.caseInsensitive));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,17 +23,20 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 结果集处理类 ,处理出的结果为Entity列表
|
* 结果集处理类 ,处理出的结果为Entity列表
|
||||||
* @author loolly
|
|
||||||
*
|
*
|
||||||
|
* @author loolly
|
||||||
*/
|
*/
|
||||||
public class EntityListHandler implements RsHandler<List<Entity>> {
|
public class EntityListHandler implements RsHandler<List<Entity>> {
|
||||||
private static final long serialVersionUID = -2846240126316979895L;
|
private static final long serialVersionUID = -2846240126316979895L;
|
||||||
|
|
||||||
/** 是否大小写不敏感 */
|
/**
|
||||||
|
* 是否大小写不敏感
|
||||||
|
*/
|
||||||
private final boolean caseInsensitive;
|
private final boolean caseInsensitive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个 EntityListHandler对象
|
* 创建一个 EntityListHandler对象,默认大小写敏感
|
||||||
|
*
|
||||||
* @return EntityListHandler对象
|
* @return EntityListHandler对象
|
||||||
*/
|
*/
|
||||||
public static EntityListHandler of() {
|
public static EntityListHandler of() {
|
||||||
@ -41,7 +44,7 @@ public class EntityListHandler implements RsHandler<List<Entity>>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造,默认大小写敏感
|
||||||
*/
|
*/
|
||||||
public EntityListHandler() {
|
public EntityListHandler() {
|
||||||
this(false);
|
this(false);
|
||||||
|
@ -114,7 +114,7 @@ public class CRUDTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void findTest() {
|
public void findTest() {
|
||||||
final List<Entity> find = db.find(ListUtil.of("name AS name2"), Entity.of("user"), new EntityListHandler());
|
final List<Entity> find = db.find(ListUtil.of("name AS name2"), Entity.of("user"), EntityListHandler.of());
|
||||||
Assertions.assertFalse(find.isEmpty());
|
Assertions.assertFalse(find.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class ConcurentTest {
|
|||||||
for(int i = 0; i < 10000; i++) {
|
for(int i = 0; i < 10000; i++) {
|
||||||
ThreadUtil.execute(() -> {
|
ThreadUtil.execute(() -> {
|
||||||
final List<Entity> find;
|
final List<Entity> find;
|
||||||
find = db.find(ListUtil.of("name AS name2"), Entity.of("user"), new EntityListHandler());
|
find = db.find(ListUtil.of("name AS name2"), Entity.of("user"), EntityListHandler.of());
|
||||||
Console.log(find);
|
Console.log(find);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class DbTest {
|
|||||||
ps.setFetchSize(Integer.MIN_VALUE);
|
ps.setFetchSize(Integer.MIN_VALUE);
|
||||||
ps.setFetchDirection(ResultSet.FETCH_FORWARD);
|
ps.setFetchDirection(ResultSet.FETCH_FORWARD);
|
||||||
return ps;
|
return ps;
|
||||||
}), new EntityListHandler());
|
}), EntityListHandler.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user