package cn.lihongjie.coal.deviceCategory.entity;

import cn.lihongjie.coal.base.entity.OrgCommonEntity;
import cn.lihongjie.coal.user.entity.UserEntity;

import jakarta.persistence.*;

import lombok.Data;

import org.hibernate.annotations.Comment;

import java.util.List;

@Data
@Entity

@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_device_category_org_id", columnList = "organization_id"))

public class DeviceCategoryEntity extends OrgCommonEntity {


    @ManyToMany
    private List<UserEntity> users;


    @Comment("设备编码生成规则")
    private String deviceCodeGenRule;

    private Integer codeLength;

    private String codePrefix;

    @ManyToOne private DeviceCategoryEntity parent;

    @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
    private List<DeviceCategoryEntity> children;



}