From caa272cb5f4bf6fa90d6d2b85ba078b08eb79427 Mon Sep 17 00:00:00 2001 From: zhou-hao Date: Fri, 30 Nov 2018 22:16:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/hswebframework/web/service/GenericEntityService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java index c3863f6ba..6f7db4695 100644 --- a/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java +++ b/hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/java/org/hswebframework/web/service/GenericEntityService.java @@ -29,6 +29,7 @@ import org.hswebframework.web.validator.group.UpdateGroup; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.PostConstruct; @@ -142,7 +143,7 @@ public abstract class GenericEntityService, PK> @Override @Transactional(readOnly = true) public E selectByPk(PK pk) { - if (null == pk) { + if (StringUtils.isEmpty(pk)) { return null; } return createQuery().where(GenericEntity.id, pk).single(); @@ -151,7 +152,7 @@ public abstract class GenericEntityService, PK> @Override @Transactional(readOnly = true) public List selectByPk(List id) { - if (id == null || id.isEmpty()) { + if (CollectionUtils.isEmpty(id)) { return new ArrayList<>(); } return createQuery().where().in(GenericEntity.id, id).listNoPaging();