package cn.sagacloud.server.datacenter.models.entities

import cn.sagacloud.server.datacenter.models.entities.base.BaseInfo
import com.alibaba.fastjson.annotation.JSONField
import com.sybotan.service.models.annotations.SCascade
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 * 竖井信息实体类
 *
 * @author  张维新
 */
@ApiModel(description = "竖井信息实体类")
@Table(name = "shaft")
class Shaft : BaseInfo() {

    /** 竖井id */
    @ApiModelProperty(value = "竖井id")
    @Id
    @Column(name = "id")
    @JSONField(name = "ShaftID")
    var id: String? = null

    /** 竖井名称 */
    @ApiModelProperty(value = "竖井名称")
    @Column(name = "name")
    @JSONField(name = "ShaftName")
    var name: String? = null

    /** 竖井本地编码 */
    @ApiModelProperty(value = "竖井本地编码")
    @Column(name = "local_id")
    @JSONField(name = "ShaftLocalID")
    var localId: String? = null

    /** 竖井本地名称 */
    @ApiModelProperty(value = "竖井本地名称")
    @Column(name = "local_name")
    @JSONField(name = "ShaftLocalName")
    var localName: String? = null

    /** BIM模型中编码 */
    @ApiModelProperty(value = "BIM模型中编码")
    @Column(name = "bim_id")
    @JSONField(name = "BIMID")
    var bimId: String? = null

    /** 项目id */
    @ApiModelProperty(value = "项目id")
    @Column(name = "project_id")
    @JSONField(name = "ProjectId")
    var projectId: String? = null

    /** 结构信息 */
    @ApiModelProperty(value = "结构信息")
    @Column(name = "structure_info")
    @JSONField(name = "StructureInfo")
    var structureInfo: HashMap<String, Any?>? = null

//    /** 建筑id集合 */
//    @ApiModelProperty(value = "建筑id集合")
//    @JSONField(name = "BuildingList")
//    var buildingList:List<String>? = null
//
//    /** 楼层id集合 */
//    @ApiModelProperty(value = "楼层id集合")
//    @JSONField(name = "FloorList")
//    var floorList:List<String>? = null

    /** 对象类型 */
    @ApiModelProperty(value = "对象类型")
    @Column(name = "object_type")
    @JSONField(name = "ObjectType")
    override var objectType: String? = "Shaft"


    /** 级联-竖井内的设备 */
    @ApiModelProperty(value = "级联-竖井内的设备")
    @SCascade(table="r_eq_in_sh", idColumn="shaft_id", childIdColumn="equip_id")
    @JSONField(name = "EquipmentList")
    var equipmentList: ArrayList<Equipment>? = null

    /** 级联-竖井内的系统 */
    @ApiModelProperty(value = "级联-竖井内的系统")
    @SCascade(table="r_sy_in_sh", idColumn="shaft_id", childIdColumn="sys_id")
    @JSONField(name = "SystemList")
    var systemList: ArrayList<GeneralSystem>? = null


    /** 贯通关系   self = true  同样的对象查询时 id可以互相调换查询   */
    @ApiModelProperty(value = "级联-贯通关系")
    @SCascade(table="r_sh_through_sh", idColumn="shaft_id", childIdColumn="shaft_other_id", self = true)
    @JSONField(name = "ShaftThroughList")
    var shaftThroughList: ArrayList<Shaft>? = null

    /** 竖井内的业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
    @ApiModelProperty(value = "级联-竖井内的业务空间")
    @SCascade(table="relationship.r_sh2sp", idColumn="sh_id", childIdColumn="sp_id", self = false,filter = "type = 'sh2sp'")
    @JSONField(name = "SpaceList")
    var spaceList: ArrayList<ZoneSpaceBaseTable>? = null


} // Class Shaft