From a1bdbd827f36579566adaaf55fd6503f31a0a5cb Mon Sep 17 00:00:00 2001 From: "wei.peng" Date: Sat, 27 Oct 2018 18:31:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=A8=E6=88=B7=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=20SQL=20BUG=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/pojo/base/enumutil/CommonEnumUtil.java | 23 ++++++++++++++++------ .../pojo/base/jpa/daoimpl/BaseRepositoryImpl.java | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java index a6e8712..c3ca7d7 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/CommonEnumUtil.java @@ -233,11 +233,13 @@ public class CommonEnumUtil { */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum USER_STATUS { - NORMAL(1, "NORMAL", "正常"), - FREEZE(2, "FREEZE", "冻结"), - ABERRANT(3, "ABERRANT", "异常"), - RESIGNATION(4, "RESIGNATION", "离职"), - EXPIRE(5, "EXPIRE", "服务到期"); + NORMAL(1, "正常", "正常_NORMAL"), + FREEZE(2, "冻结", "冻结_FREEZE"), + ABERRANT(3, "异常", "异常_ABERRANT"), + RESIGNATION(4, "离职", "离职_RESIGNATION"), + EXPIRE(5, "服务到期", "服务到期_EXPIRE"), + LOCKING(6, "锁定", "fa cell-fa fa-lock"), + ENABLE(7, "启用", "fa fa-success cell-fa fa-check"); private int value; private String code; @@ -282,9 +284,18 @@ public class CommonEnumUtil { } } + + /** + * 数据状态 + * 1 启用 + * 2 禁用 + * 3 锁定 + */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum DATA_STATUS { - Enable(1, "启用", "fa fa-success cell-fa fa-check"), Disable(2, "禁止", "fa fa-disabled cell-fa fa-times-circle"), locking(3, "锁定", "fa cell-fa fa-lock"); + ENABLE(1, "启用", "fa fa-success cell-fa fa-check"), + DISABLE(2, "禁止", "fa fa-disabled cell-fa fa-times-circle"), + LOCKING(3, "锁定", "fa cell-fa fa-lock"); private int value; private String name; diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java index f978ab6..333cb8b 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseRepositoryImpl.java @@ -129,7 +129,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep @Override public void deleteByProperties(String[] propName, Object[] propValue) { if ((propName != null) && (propName.length > 0) && (propValue != null) && (propValue.length > 0) && (propValue.length == propName.length)) { - StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " o where "); + StringBuffer sb = new StringBuffer("delete from " + persistentClass.getName() + " o where 1=1 "); appendQL(sb,propName,propValue); Query query = entityManager.createQuery(sb.toString()); setParameter(query,propName,propValue); @@ -166,7 +166,7 @@ public class BaseRepositoryImpl extends SimpleJpaRep sb.append(propertyName[i] + " = :p_" + propertyName[i] + ","); } sb.deleteCharAt(sb.length() - 1); - sb.append(" where "); + sb.append(" where 1=1 "); appendQL(sb, conditionName, conditionValue); Query query = entityManager.createQuery(sb.toString()); for (int i = 0; i < propertyName.length; i++) {