1
This commit is contained in:
102
src/main/java/cn/van/business/model/wx/SuperAdmin.java
Normal file
102
src/main/java/cn/van/business/model/wx/SuperAdmin.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package cn.van.business.model.wx;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 超级管理员实体类
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "super_admin")
|
||||
public class SuperAdmin {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 微信ID
|
||||
*/
|
||||
@Column(name = "wxid", nullable = false, length = 64)
|
||||
private String wxid;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@Column(name = "name", nullable = false, length = 50)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联盟ID
|
||||
*/
|
||||
@Column(name = "union_id", nullable = false, length = 64)
|
||||
private String unionId;
|
||||
|
||||
/**
|
||||
* 应用密钥
|
||||
*/
|
||||
@Column(name = "app_key", nullable = false, length = 100)
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 秘密密钥
|
||||
*/
|
||||
@Column(name = "secret_key", nullable = false, length = 100)
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 是否激活: 0-否, 1-是
|
||||
*/
|
||||
@Column(name = "is_active", nullable = false)
|
||||
private Integer isActive = 1;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private java.sql.Timestamp createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "updated_at", nullable = false)
|
||||
private java.sql.Timestamp updatedAt;
|
||||
|
||||
@PrePersist
|
||||
protected void onCreate() {
|
||||
createdAt = new java.sql.Timestamp(System.currentTimeMillis());
|
||||
updatedAt = new java.sql.Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
protected void onUpdate() {
|
||||
updatedAt = new java.sql.Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null) return false;
|
||||
Class<?> oEffectiveClass = o instanceof HibernateProxy ? ((HibernateProxy) o).getHibernateLazyInitializer().getPersistentClass() : o.getClass();
|
||||
Class<?> thisEffectiveClass = this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass() : this.getClass();
|
||||
if (thisEffectiveClass != oEffectiveClass) return false;
|
||||
SuperAdmin that = (SuperAdmin) o;
|
||||
return getId() != null && Objects.equals(getId(), that.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.van.business.repository;
|
||||
|
||||
import cn.van.business.model.wx.SuperAdmin;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface SuperAdminRepository extends JpaRepository<SuperAdmin, Long> {
|
||||
|
||||
/**
|
||||
* 根据微信ID查找超级管理员
|
||||
* @param wxid 微信ID
|
||||
* @return 超级管理员对象
|
||||
*/
|
||||
Optional<SuperAdmin> findByWxid(String wxid);
|
||||
|
||||
/**
|
||||
* 根据联盟ID查找超级管理员
|
||||
* @param unionId 联盟ID
|
||||
* @return 超级管理员对象
|
||||
*/
|
||||
Optional<SuperAdmin> findByUnionId(String unionId);
|
||||
|
||||
/**
|
||||
* 根据应用密钥查找超级管理员
|
||||
* @param appKey 应用密钥
|
||||
* @return 超级管理员对象
|
||||
*/
|
||||
Optional<SuperAdmin> findByAppKey(String appKey);
|
||||
|
||||
/**
|
||||
* 根据名称查找超级管理员列表
|
||||
* @param name 名称
|
||||
* @return 超级管理员列表
|
||||
*/
|
||||
List<SuperAdmin> findByName(String name);
|
||||
|
||||
/**
|
||||
* 查找所有激活状态的超级管理员
|
||||
* @param isActive 是否激活
|
||||
* @return 超级管理员列表
|
||||
*/
|
||||
List<SuperAdmin> findByIsActive(Integer isActive);
|
||||
}
|
||||
Reference in New Issue
Block a user