package models

//仓库配置
type StorehouseConfig struct {
	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`                         //机构id
	StorehouseInfo     int64 `gorm:"column:storehouse_info" json:"storehouse_info" form:"storehouse_info"`             //耗材 自动入库 的仓库id
	StorehouseOutInfo  int64 `gorm:"column:storehouse_out_info" json:"storehouse_out_info" form:"storehouse_out_info"` //耗材 自动出库 的仓库id
	DrugStorehouseInfo int64 `gorm:"drug_storehouse_info" json:"drug_storehouse_info" form:"drug_storehouse_info"`     //药品 自动入库 的仓库id
	DrugStorehouseOut  int64 `gorm:"drug_storehouse_out" json:"drug_storehouse_out" form:"drug_storehouse_out"`        //药品 自动出库 的仓库id
	Status             int64 `gorm:"status" json:"status" form:"status"`
	Ctime              int64 `gorm:"ctime" json:"ctime" form:"ctime"`
	Mtime              int64 `gorm:"mtime" json:"mtime" form:"mtime"`
}

func (StorehouseConfig) TableName() string {
	return "xt_storehouse_config"
}

type App_Role_byli struct {
	Id          int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	OrgId       int64  `gorm:"column:org_id" json:"org_id"`
	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
	UserName    string `gorm:"column:user_name" json:"user_name"` // 用户名称
}

func (App_Role_byli) TableName() string {
	return "sgj_users.sgj_user_admin_role"
}

type UserOrg struct {
	Id      int64 `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	Creator int64 `gorm:"column:creator" json:"creator"`
}

func (UserOrg) TableName() string {
	return "sgj_users.sgj_user_org"
}

//分页
type Storehouselist struct {
	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
	StorehouseCode      string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`                 //仓库编号
	StorehouseName      string `gorm:"column:storehouse_name" json:"storehouse_name" form:"storehouse_name"`                 //仓库名称
	StorehouseAddress   string `gorm:"column:storehouse_address" json:"storehouse_address" form:"storehouse_address"`        //仓库地址
	StorehouseStatus    int64  `gorm:"column:storehouse_status" json:"storehouse_status" form:"storehouse_status"`           //仓库状态
	Status              int64  `gorm:"column:status" json:"status" form:"status"`                                            //数据状态
	StorehouseAdminId   int64  `gorm:"column:storehouse_admin_id" json:"storehouse_admin_id" form:"storehouse_admin_id"`     //仓库管理员id
	StorehouseAdminName string `gorm:"column:storehouse_admin_name" json:"storehouse_admin_name" form:"storehouse_admin_id"` //仓库管理员名字
	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Ctime               int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

type RolePurviews struct {
	Id         int64 `gorm:"PRIMARY_KEY;AUTO_INCREMENT"`
	RoleId     int64
	OrgId      int64
	AppId      int64
	PurviewIds string `gorm:"column:purview_ids"`
	Status     int8   // 状态 0.无效 1.有效 2.禁用
	CreateTime int64  `gorm:"column:ctime"` // 创建时间
	ModifyTime int64  `gorm:"column:mtime"` // 修改时间
	Role       Role   `gorm:"ForeignKey:RoleId;AssociationForeignKey:ID" json:"role_info"`
}

func (RolePurviews) TableName() string {
	return "sgj_users.sgj_user_role_purview"
}

type XtStorehouse struct {
	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
	StorehouseCode      string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`
	StorehouseName      string `gorm:"column:storehouse_name" json:"storehouse_name" form:"storehouse_name"`
	StorehouseAddress   string `gorm:"column:storehouse_address" json:"storehouse_address" form:"storehouse_address"`
	StorehouseStatus    int64  `gorm:"column:storehouse_status" json:"storehouse_status" form:"storehouse_status"`
	Status              int64  `gorm:"column:status" json:"status" form:"status"`
	StorehouseAdminId   int64  `gorm:"column:storehouse_admin_id" json:"storehouse_admin_id" form:"storehouse_admin_id"`
	StorehouseAdminName string `gorm:"column:storehouse_admin_name" json:"storehouse_admin_name" form:"storehouse_admin_name"`
	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Ctime               int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (XtStorehouse) TableName() string {
	return "xt_storehouse"
}

type VmStorehouseName struct {
	ID               int64  `gorm:"column:id" json:"id" form:"id"`
	StorehouseName   string `gorm:"column:storehouse_name" json:"storehouse_name" form:"storehouse_name"`
	StorehouseId     int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
	StockMaxNumber   int64  `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
	StockMinNumber   int64  `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
	WarehousingCount int64  `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
}

type VmStorehouseNameOne struct {
	ID               int64  `gorm:"column:id" json:"id" form:"id"`
	StorehouseName   string `gorm:"column:storehouse_name" json:"storehouse_name" form:"storehouse_name"`
	StorehouseId     int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
	StockCount       int64  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
	WarehousingCount int64  `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
}

type XtStorehouseConfig struct {
	ID                 int64 `gorm:"column:id" json:"id" form:"id"`
	UserOrgId          int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	StorehouseInfo     int64 `gorm:"column:storehouse_info" json:"storehouse_info" form:"storehouse_info"`
	StorehouseOutInfo  int64 `gorm:"column:storehouse_out_info" json:"storehouse_out_info" form:"storehouse_out_info"`
	DrugStorehouseInfo int64 `gorm:"column:drug_storehouse_info" json:"drug_storehouse_info" form:"drug_storehouse_info"`
	DrugStorehouseOut  int64 `gorm:"column:drug_storehouse_out" json:"drug_storehouse_out" form:"drug_storehouse_out"`
	Status             int64 `gorm:"column:status" json:"status" form:"status"`
	Ctime              int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime              int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (XtStorehouseConfig) TableName() string {
	return "xt_storehouse_config"
}

//二级仓库
type Storehouse struct {
	ID                int64  `gorm:"column:id" json:"id" form:"id"`
	StorehouseCode    string `gorm:"column:storehouse_code" json:"storehouse_code" form:"storehouse_code"`             //仓库编号
	StorehouseName    string `gorm:"column:storehouse_name" json:"storehouse_name" form:"storehouse_name"`             //仓库名称
	StorehouseAddress string `gorm:"column:storehouse_address" json:"storehouse_address" form:"storehouse_address"`    //仓库地址
	StorehouseStatus  int64  `gorm:"column:storehouse_status" json:"storehouse_status" form:"storehouse_status"`       //仓库状态
	Status            int64  `gorm:"column:status" json:"status" form:"status"`                                        //数据状态
	StorehouseAdminId int64  `gorm:"column:storehouse_admin_id" json:"storehouse_admin_id" form:"storehouse_admin_id"` //仓库管理员id
	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (Storehouse) TableName() string {
	return "xt_storehouse"
}

type XtSecondWarehouse struct {
	ID                int64  `gorm:"column:id" json:"id" form:"id"`
	SecondOrderNumber string `gorm:"column:second_order_number" json:"second_order_number" form:"second_order_number"`
	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
	RecordDate        int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
	Checker           int64  `gorm:"column:checker" json:"checker" form:"checker"`
	IsCheck           int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Status            int64  `gorm:"column:status" json:"status" form:"status"`
	Ctime             int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime             int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
	CheckTime         int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
	StorehouseInId    int64  `gorm:"column:storehouse_in_id" json:"storehouse_in_id" form:"storehouse_in_id"`
	StorehouseOutId   int64  `gorm:"column:storehouse_out_id" json:"storehouse_out_id" form:"storehouse_out_id"`
}

func (XtSecondWarehouse) TableName() string {
	return "xt_second_warehouse"
}

type XtSecondWarehouseInfo struct {
	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
	ProjectName             string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
	SecondSpecificationName string  `gorm:"column:second_specification_name" json:"second_specification_name" form:"second_specification_name"`
	ProjectType             string  `gorm:"column:project_type" json:"project_type" form:"project_type"`
	SencondUnit             string  `gorm:"column:sencond_unit" json:"sencond_unit" form:"sencond_unit"`
	Count                   int64   `gorm:"column:count" json:"count" form:"count"`
	SecondTotal             string  `gorm:"column:second_total" json:"second_total" form:"second_total"`
	SecondOrderNumber       string  `gorm:"column:second_order_number" json:"second_order_number" form:"second_order_number"`
	RecordDate              int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
	StorehouseInId          int64   `gorm:"column:storehouse_in_id" json:"storehouse_in_id" form:"storehouse_in_id"`
	StorehouseOutId         int64   `gorm:"column:storehouse_out_id" json:"storehouse_out_id" form:"storehouse_out_id"`
	Creater                 int64   `gorm:"column:creater" json:"creater" form:"creater"`
	ProjectId               int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
	Remake                  string  `gorm:"column:remake" json:"remake" form:"remake"`
	UserOrgId               int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
	MinPrice                float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
	IsSource                int64   `gorm:"column:is_source" json:"is_source" form:"is_source"`
	WarehouseId             int64   `gorm:"column:warehouse_id" json:"warehouse_id" form:"warehouse_id"`
}

func (XtSecondWarehouseInfo) TableName() string {
	return "xt_second_warehouse_info"
}

type VmSecondWarehouse struct {
	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
	SecondOrderNumber   string `gorm:"column:second_order_number" json:"second_order_number" form:"second_order_number"`
	Creater             int64  `gorm:"column:creater" json:"creater" form:"creater"`
	RecordDate          int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
	Checker             int64  `gorm:"column:checker" json:"checker" form:"checker"`
	IsCheck             int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
	Status              int64  `gorm:"column:status" json:"status" form:"status"`
	Ctime               int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
	CheckTime           int64  `gorm:"column:check_time" json:"check_time" form:"check_time"`
	StorehouseInId      int64  `gorm:"column:storehouse_in_id" json:"storehouse_in_id" form:"storehouse_in_id"`
	StorehouseOutId     int64  `gorm:"column:storehouse_out_id" json:"storehouse_out_id" form:"storehouse_out_id"`
	StorehouseAdminName string `gorm:"column:storehouse_admin_name" json:"storehouse_admin_name" form:"storehouse_admin_name"`
}

type PurviewTmp struct {
	Id                  int64      `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	Parentid            int64      `json:"pid"`                                                // 父级ID
	Module              int8       `json:"module"`                                             // 所属应用类型 1.病友经营；2.科普号；3.血透经营；4.慢病管理；
	Name                string     `json:"name"`                                               // 规则名称（也是菜单名）
	Urlfor              string     `json:"urlfor"`                                             // 规则唯一英文标识，(Controller.Method)
	MenuIconClass       string     `gorm:"menu_icon_class" json:"menu_icon_class"`             // 菜单图标的 css 样式
	SuperAdminExclusive int8       `gorm:"super_admin_exclusive" json:"super_admin_exclusive"` // 是否为超级管理员专属 0否1是
	Listorder           int        `json:"-"`                                                  // 排序ID
	Status              int8       `json:"status"`                                             // 状态 0.无效 1.有效 2.禁用
	CreateTime          int64      `gorm:"column:ctime" json:"-"`                              // 创建时间
	ModifyTime          int64      `gorm:"column:mtime" json:"-"`                              // 修改时间
	Purview             []*Purview `gorm:"ForeignKey:Parentid;AssociationForeignKey:ID" json:"sub_purview"`
	IconUrl             string     `gorm:"column:icon_url" json:"icon_url" form:"icon_url"`
	Desc                string     `gorm:"column:desc" json:"desc" form:"desc"`
	ParentUrl           string     `gorm:"column:parent_url" json:"parent_url" form:"parent_url"`
	Link                string     `gorm:"-" json:"link"`   // urlfor 解析后的链接
	Childs              []*Purview `gorm:"-" json:"childs"` // 子节点
}

func (PurviewTmp) TableName() string {
	return "sgj_users.sgj_user_purview"
}
