Skip to content

Commit

Permalink
update pg sqlbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
lhpqaq committed Sep 18, 2024
1 parent 3427284 commit 1107671
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,15 @@ public static <Entity> String update(TableMetaData tableMetaData, Entity entity,
continue;
}
PropertyDescriptor ps = BeanUtils.getPropertyDescriptor(entityClass, entry.getKey());
if (ps == null || ps.getReadMethod() == null) {
continue;
}
Object value = ReflectionUtils.invokeMethod(ps.getReadMethod(), entity);
if (!ObjectUtils.isEmpty(value)) {
sql.SET("\"" + getEquals(entry.getValue() + "\"", entry.getKey()));
Field field = ReflectionUtils.findField(entityClass, entry.getKey());
if (field != null) {
Column column = field.getAnnotation(Column.class);
if (column != null && !column.nullable() && value == null) {
continue;
}
}
sql.SET("\"" + getEquals(entry.getValue() + "\"", entry.getKey()));
}
sql.WHERE(getEquals(tableMetaData.getPkColumn(), tableMetaData.getPkProperty()));
break;
Expand Down

0 comments on commit 1107671

Please sign in to comment.