|
8 | 8 | import org.hswebframework.web.commons.entity.Entity;
|
9 | 9 | import org.hswebframework.web.commons.entity.RecordCreationEntity;
|
10 | 10 | import org.hswebframework.web.commons.entity.param.QueryParamEntity;
|
| 11 | +import org.hswebframework.web.commons.model.Model; |
11 | 12 | import org.slf4j.Logger;
|
12 | 13 | import org.slf4j.LoggerFactory;
|
13 | 14 |
|
@@ -51,22 +52,21 @@ public boolean doAccess(String action, Set<FieldAccess> accesses, ParamContext p
|
51 | 52 | * @see org.apache.commons.beanutils.PropertyUtilsBean
|
52 | 53 | */
|
53 | 54 | protected boolean doUpdateAccess(Set<FieldAccess> accesses, ParamContext params) {
|
54 |
| - Entity entity = params.getParams().values().stream() |
55 |
| - .filter(Entity.class::isInstance) |
56 |
| - .map(Entity.class::cast) |
| 55 | + Object supportParam = params.getParams().values().stream() |
| 56 | + .filter(param -> (param instanceof Entity) | (param instanceof Model)) |
57 | 57 | .findAny().orElse(null);
|
58 |
| - if (null != entity) { |
| 58 | + if (null != supportParam) { |
59 | 59 | for (FieldAccess access : accesses) {
|
60 | 60 | try {
|
61 | 61 | //设置值为null,跳过修改
|
62 | 62 | BeanUtilsBean.getInstance()
|
63 | 63 | .getPropertyUtils()
|
64 |
| - .setProperty(entity, access.getField(), null); |
| 64 | + .setProperty(supportParam, access.getField(), null); |
65 | 65 | } catch (Exception e) {
|
66 | 66 | }
|
67 | 67 | }
|
68 |
| - if (entity instanceof RecordCreationEntity) { |
69 |
| - RecordCreationEntity creationEntity = ((RecordCreationEntity) entity); |
| 68 | + if (supportParam instanceof RecordCreationEntity) { |
| 69 | + RecordCreationEntity creationEntity = ((RecordCreationEntity) supportParam); |
70 | 70 | creationEntity.setCreateTime(null);
|
71 | 71 | creationEntity.setCreatorId(null);
|
72 | 72 | }
|
|
0 commit comments