feat: 添加日志配置和Logback依赖
refactor: 重构实体类equals和hashCode方法 fix: 修复WebSocketService消息发送逻辑 style: 格式化代码和优化导入 docs: 更新JacksonConfig日期序列化格式 test: 添加CompanyFilePathTableCell测试类 chore: 清理无用代码和注释
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.ecep.contract.util;
|
||||
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
public class HibernateProxyUtils {
|
||||
private static boolean useProxy = true;
|
||||
|
||||
public static void useProxy(boolean b) {
|
||||
useProxy = b;
|
||||
}
|
||||
|
||||
public static boolean isNotEffectiveClassEquals(Object the, Object that) {
|
||||
if (!useProxy) {
|
||||
return false;
|
||||
}
|
||||
Class<?> oEffectiveClass = the instanceof HibernateProxy
|
||||
? ((HibernateProxy) the).getHibernateLazyInitializer().getPersistentClass()
|
||||
: the.getClass();
|
||||
Class<?> thisEffectiveClass = that instanceof HibernateProxy
|
||||
? ((HibernateProxy) that).getHibernateLazyInitializer().getPersistentClass()
|
||||
: that.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int hashCode(Object that) {
|
||||
if (!useProxy) {
|
||||
return that.hashCode();
|
||||
}
|
||||
return that instanceof HibernateProxy
|
||||
? ((HibernateProxy) that).getHibernateLazyInitializer().getPersistentClass().hashCode()
|
||||
: that.getClass().hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user