forked from kidgrow-microservices-platform

zhaoxiaohao
2020-11-17 b7265cdd6f3e1fbb0d428c27e5b5e29e34d56953
kidgrow-commons/kidgrow-common-spring-boot-starter/src/main/java/com/kidgrow/common/service/impl/SuperServiceImpl.java
@@ -105,8 +105,9 @@
        if (null != entity) {
            Class<?> cls = entity.getClass();
            TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);
            if (null != tableInfo && StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {
                Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());
            if (null != tableInfo && StringUtils.isNotBlank(tableInfo.getKeyProperty())) {
//                Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());
                Object idVal = ReflectionKit.getFieldValue(entity,tableInfo.getKeyProperty());
                if (StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal))) {
                    if (StrUtil.isEmpty(msg)) {
                        msg = "已存在";