update 优化 增加mp填充器兜底策略

2.X
疯狂的狮子Li 7 months ago
parent 24f2d37fcc
commit ad86a52675

@ -47,6 +47,10 @@ public class InjectionMetaObjectHandler implements MetaObjectHandler {
? baseEntity.getCreateDept() : loginUser.getDeptId()); ? baseEntity.getCreateDept() : loginUser.getDeptId());
} }
} }
} else {
Date date = new Date();
this.strictInsertFill(metaObject, "createTime", Date.class, date);
this.strictInsertFill(metaObject, "updateTime", Date.class, date);
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
@ -71,6 +75,8 @@ public class InjectionMetaObjectHandler implements MetaObjectHandler {
if (ObjectUtil.isNotNull(userId)) { if (ObjectUtil.isNotNull(userId)) {
baseEntity.setUpdateBy(userId); baseEntity.setUpdateBy(userId);
} }
} else {
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED); throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);

Loading…
Cancel
Save