mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-27 03:57:25 +00:00
72 lines
3.3 KiB
Go
72 lines
3.3 KiB
Go
// ==========================================================================
|
|
// This is auto-generated by gf cli tool. You may not really want to edit it.
|
|
// ==========================================================================
|
|
|
|
package sys_dept
|
|
|
|
import (
|
|
"database/sql"
|
|
"github.com/gogf/gf/database/gdb"
|
|
"github.com/gogf/gf/os/gtime"
|
|
)
|
|
|
|
// Entity is the golang structure for table sys_dept.
|
|
type Entity struct {
|
|
DeptId int64 `orm:"dept_id,primary" json:"dept_id"` // 部门id
|
|
ParentId int64 `orm:"parent_id" json:"parent_id"` // 父部门id
|
|
Ancestors string `orm:"ancestors" json:"ancestors"` // 祖级列表
|
|
DeptName string `orm:"dept_name" json:"dept_name"` // 部门名称
|
|
OrderNum int `orm:"order_num" json:"order_num"` // 显示顺序
|
|
Leader string `orm:"leader" json:"leader"` // 负责人
|
|
Phone string `orm:"phone" json:"phone"` // 联系电话
|
|
Email string `orm:"email" json:"email"` // 邮箱
|
|
Status string `orm:"status" json:"status"` // 部门状态(0正常 1停用)
|
|
DelFlag string `orm:"del_flag" json:"del_flag"` // 删除标志(0代表存在 2代表删除)
|
|
CreateBy string `orm:"create_by" json:"create_by"` // 创建者
|
|
CreateTime *gtime.Time `orm:"create_time" json:"create_time"` // 创建时间
|
|
UpdateBy string `orm:"update_by" json:"update_by"` // 更新者
|
|
UpdateTime *gtime.Time `orm:"update_time" json:"update_time"` // 更新时间
|
|
}
|
|
|
|
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
|
|
// the data and where attributes for empty values.
|
|
func (r *Entity) OmitEmpty() *arModel {
|
|
return Model.Data(r).OmitEmpty()
|
|
}
|
|
|
|
// Inserts does "INSERT...INTO..." statement for inserting current object into table.
|
|
func (r *Entity) Insert() (result sql.Result, err error) {
|
|
return Model.Data(r).Insert()
|
|
}
|
|
|
|
// InsertIgnore does "INSERT IGNORE INTO ..." statement for inserting current object into table.
|
|
func (r *Entity) InsertIgnore() (result sql.Result, err error) {
|
|
return Model.Data(r).InsertIgnore()
|
|
}
|
|
|
|
// Replace does "REPLACE...INTO..." statement for inserting current object into table.
|
|
// If there's already another same record in the table (it checks using primary key or unique index),
|
|
// it deletes it and insert this one.
|
|
func (r *Entity) Replace() (result sql.Result, err error) {
|
|
return Model.Data(r).Replace()
|
|
}
|
|
|
|
// Save does "INSERT...INTO..." statement for inserting/updating current object into table.
|
|
// It updates the record if there's already another same record in the table
|
|
// (it checks using primary key or unique index).
|
|
func (r *Entity) Save() (result sql.Result, err error) {
|
|
return Model.Data(r).Save()
|
|
}
|
|
|
|
// Update does "UPDATE...WHERE..." statement for updating current object from table.
|
|
// It updates the record if there's already another same record in the table
|
|
// (it checks using primary key or unique index).
|
|
func (r *Entity) Update() (result sql.Result, err error) {
|
|
return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
|
|
}
|
|
|
|
// Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
|
|
func (r *Entity) Delete() (result sql.Result, err error) {
|
|
return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
|
|
}
|