|
|
@@ -25,24 +25,23 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|
|
@Override
|
|
|
@SneakyThrows
|
|
|
public void insertFill(MetaObject metaObject) {
|
|
|
- String authorization = httpServletRequest.getHeader("Authorization");
|
|
|
-
|
|
|
- if(authorization != null){
|
|
|
-
|
|
|
- String[] tokens = authorization.split(" ");
|
|
|
- String decrypt = AESSecurityUtil.decrypt(AESKey, tokens[1]);
|
|
|
- String cpIdString = JwtUtil.getCpId(decrypt);
|
|
|
- if (cpIdString!=null){
|
|
|
- //设置企业Id
|
|
|
- Integer cpId = Integer.valueOf(cpIdString);
|
|
|
- this.strictInsertFill(metaObject, "cpId", Integer.class, cpId); // 起始版本 3.3.0(推荐使用)
|
|
|
- }
|
|
|
+ if(httpServletRequest!=null){
|
|
|
+ String authorization = httpServletRequest.getHeader("Authorization");
|
|
|
+ if(authorization != null){
|
|
|
+ String[] tokens = authorization.split(" ");
|
|
|
+ String decrypt = AESSecurityUtil.decrypt(AESKey, tokens[1]);
|
|
|
+ String cpIdString = JwtUtil.getCpId(decrypt);
|
|
|
+ if (cpIdString!=null){
|
|
|
+ //设置企业Id
|
|
|
+ Integer cpId = Integer.valueOf(cpIdString);
|
|
|
+ this.strictInsertFill(metaObject, "cpId", Integer.class, cpId); // 起始版本 3.3.0(推荐使用)
|
|
|
+ }
|
|
|
// // 或者
|
|
|
// this.strictInsertFill(metaObject, "createTime", () -> LocalDateTime.now(), LocalDateTime.class); // 起始版本 3.3.3(推荐)
|
|
|
// // 或者
|
|
|
// this.fillStrategy(metaObject, "createTime", LocalDateTime.now()); // 也可以使用(3.3.0 该方法有bug)
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|