guodj 4 ani în urmă
comite
729c7b240c

+ 26 - 0
config/config.toml

@@ -0,0 +1,26 @@
+# 应用系统设置
+[setting]
+#    logpath = "/tmp/log/admin"
+    bind-addr = "192.168.0.63:18090"
+#    advertise-addr = "81.68.138.114:19922"
+    need-advertise-addr = false
+    srv-name = "dashoo.reservation.0.1-guodj"
+    env = "dev"
+
+[service_registry]
+    registry = "consul"  # consul 或 peer2peer
+#    server-addr = "192.168.0.63:18090"
+#    server-addr = "81.68.138.114:18500"
+    server-addr = "192.168.0.252:18500"
+
+# 数据库连接
+[database]
+    [[database.default]]
+        Debug = true
+        link = "mysql:root:Dashoo#190801@ali@tcp(192.168.0.252:3306)/lims_dev"
+    [[database.CU7zm9WhZm]]
+        Debug = true
+        link = "mysql:root:Dashoo#190801@ali@tcp(192.168.0.252:3306)/lims_dev"
+
+[micro_srv]
+    auth = "dashoo.labsop.auth-2.1"

+ 438 - 0
dao/internal/meeting.go

@@ -0,0 +1,438 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	"lims_reservation/model"
+)
+
+// MeetingDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type MeetingDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns meetingColumns
+}
+
+// MeetingColumns defines and stores column names for table meeting.
+type meetingColumns struct {
+	Id          string //
+	CreatedBy   string // 创建人姓名
+	CreatedAt   string // 创建时间
+	UpdatedAt   string // 更新时间
+	UpdatedBy   string // 更新人姓名
+	DeletedAt   string // 删除时间
+	UpdatedById string // 更新人ID
+	CreatedById string // 创建人ID
+	Code        string // 会议室编码
+	Name        string // 会议室名称
+	ImgUrl      string // 图片Url
+	Sort        string // 排序
+	Scale       string // 规模/可容纳人数
+	Remark      string // 备注/说明
+	Location    string // 位置
+}
+
+var (
+	// Meeting is globally public accessible object for table meeting operations.
+	Meeting = MeetingDao{
+		M:     g.DB("default").Model("meeting").Safe(),
+		DB:    g.DB("default"),
+		Table: "meeting",
+		Columns: meetingColumns{
+			Id:          "Id",
+			CreatedBy:   "CreatedBy",
+			CreatedAt:   "CreatedAt",
+			UpdatedAt:   "UpdatedAt",
+			UpdatedBy:   "UpdatedBy",
+			DeletedAt:   "DeletedAt",
+			UpdatedById: "UpdatedById",
+			CreatedById: "CreatedById",
+			Code:        "Code",
+			Name:        "Name",
+			ImgUrl:      "ImgUrl",
+			Sort:        "Sort",
+			Scale:       "Scale",
+			Remark:      "Remark",
+			Location:    "Location",
+		},
+	}
+)
+
+func NewMeetingDao(tenant string) MeetingDao {
+	var dao MeetingDao
+	dao = MeetingDao{
+		M:     g.DB(tenant).Model("meeting").Safe(),
+		DB:    g.DB(tenant),
+		Table: "meeting",
+		Columns: meetingColumns{
+			Id:          "Id",
+			CreatedBy:   "CreatedBy",
+			CreatedAt:   "CreatedAt",
+			UpdatedAt:   "UpdatedAt",
+			UpdatedBy:   "UpdatedBy",
+			DeletedAt:   "DeletedAt",
+			UpdatedById: "UpdatedById",
+			CreatedById: "CreatedById",
+			Code:        "Code",
+			Name:        "Name",
+			ImgUrl:      "ImgUrl",
+			Sort:        "Sort",
+			Scale:       "Scale",
+			Remark:      "Remark",
+			Location:    "Location",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *MeetingDao) Ctx(ctx context.Context) *MeetingDao {
+	return &MeetingDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *MeetingDao) As(as string) *MeetingDao {
+	return &MeetingDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *MeetingDao) TX(tx *gdb.TX) *MeetingDao {
+	return &MeetingDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *MeetingDao) Master() *MeetingDao {
+	return &MeetingDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *MeetingDao) Slave() *MeetingDao {
+	return &MeetingDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *MeetingDao) Args(args ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingDao) LeftJoin(table ...string) *MeetingDao {
+	return &MeetingDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingDao) RightJoin(table ...string) *MeetingDao {
+	return &MeetingDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingDao) InnerJoin(table ...string) *MeetingDao {
+	return &MeetingDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *MeetingDao) Fields(fieldNamesOrMapStruct ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *MeetingDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *MeetingDao) Option(option int) *MeetingDao {
+	return &MeetingDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *MeetingDao) OmitEmpty() *MeetingDao {
+	return &MeetingDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *MeetingDao) Filter() *MeetingDao {
+	return &MeetingDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *MeetingDao) Where(where interface{}, args ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *MeetingDao) WherePri(where interface{}, args ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *MeetingDao) And(where interface{}, args ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *MeetingDao) Or(where interface{}, args ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *MeetingDao) Group(groupBy string) *MeetingDao {
+	return &MeetingDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *MeetingDao) Order(orderBy ...string) *MeetingDao {
+	return &MeetingDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *MeetingDao) Limit(limit ...int) *MeetingDao {
+	return &MeetingDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *MeetingDao) Offset(offset int) *MeetingDao {
+	return &MeetingDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *MeetingDao) Page(page, limit int) *MeetingDao {
+	return &MeetingDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *MeetingDao) Batch(batch int) *MeetingDao {
+	return &MeetingDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *MeetingDao) Cache(duration time.Duration, name ...string) *MeetingDao {
+	return &MeetingDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *MeetingDao) Data(data ...interface{}) *MeetingDao {
+	return &MeetingDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.Meeting.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *MeetingDao) All(where ...interface{}) ([]*model.Meeting, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.Meeting
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.Meeting.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *MeetingDao) One(where ...interface{}) (*model.Meeting, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.Meeting
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *MeetingDao) FindOne(where ...interface{}) (*model.Meeting, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.Meeting
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *MeetingDao) FindAll(where ...interface{}) ([]*model.Meeting, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.Meeting
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *MeetingDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *MeetingDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *MeetingDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *MeetingDao) Chunk(limit int, callback func(entities []*model.Meeting, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.Meeting
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *MeetingDao) LockUpdate() *MeetingDao {
+	return &MeetingDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *MeetingDao) LockShared() *MeetingDao {
+	return &MeetingDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *MeetingDao) Unscoped() *MeetingDao {
+	return &MeetingDao{M: d.M.Unscoped()}
+}

+ 453 - 0
dao/internal/meeting_reservation.go

@@ -0,0 +1,453 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	"lims_reservation/model"
+)
+
+// MeetingReservationDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type MeetingReservationDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns meetingReservationColumns
+}
+
+// MeetingReservationColumns defines and stores column names for table meeting_reservation.
+type meetingReservationColumns struct {
+	Id                 string // 主键ID
+	CreatedBy          string // 创建人姓名
+	CreatedAt          string // 创建时间
+	UpdatedAt          string // 更新时间
+	UpdatedBy          string // 更新人姓名
+	DeletedAt          string // 删除时间
+	UpdatedById        string // 更新人ID
+	CreatedById        string // 创建人ID
+	Title              string // 标题
+	StartTime          string // 开始时间
+	EndTime            string // 结束时间
+	UserId             string // 预约人
+	DepartmentId       string // 部门
+	Remark             string // 备注
+	EntityId           string // 关联ID
+	SignInTime         string // 签到时间
+	SignOutTime        string // 签退时间
+	RealityUseDuration string // 实际使用时长
+	UserName           string // 预约人姓名
+	Status             string // 预约状态(1:预定   2:取消)
+}
+
+var (
+	// MeetingReservation is globally public accessible object for table meeting_reservation operations.
+	MeetingReservation = MeetingReservationDao{
+		M:     g.DB("default").Model("meeting_reservation").Safe(),
+		DB:    g.DB("default"),
+		Table: "meeting_reservation",
+		Columns: meetingReservationColumns{
+			Id:                 "Id",
+			CreatedBy:          "CreatedBy",
+			CreatedAt:          "CreatedAt",
+			UpdatedAt:          "UpdatedAt",
+			UpdatedBy:          "UpdatedBy",
+			DeletedAt:          "DeletedAt",
+			UpdatedById:        "UpdatedById",
+			CreatedById:        "CreatedById",
+			Title:              "Title",
+			StartTime:          "StartTime",
+			EndTime:            "EndTime",
+			UserId:             "UserId",
+			DepartmentId:       "DepartmentId",
+			Remark:             "Remark",
+			EntityId:           "EntityId",
+			SignInTime:         "SignInTime",
+			SignOutTime:        "SignOutTime",
+			RealityUseDuration: "RealityUseDuration",
+			UserName:           "UserName",
+			Status:             "Status",
+		},
+	}
+)
+
+func NewMeetingReservationDao(tenant string) MeetingReservationDao {
+	var dao MeetingReservationDao
+	dao = MeetingReservationDao{
+		M:     g.DB(tenant).Model("meeting_reservation").Safe(),
+		DB:    g.DB(tenant),
+		Table: "meeting_reservation",
+		Columns: meetingReservationColumns{
+			Id:                 "Id",
+			CreatedBy:          "CreatedBy",
+			CreatedAt:          "CreatedAt",
+			UpdatedAt:          "UpdatedAt",
+			UpdatedBy:          "UpdatedBy",
+			DeletedAt:          "DeletedAt",
+			UpdatedById:        "UpdatedById",
+			CreatedById:        "CreatedById",
+			Title:              "Title",
+			StartTime:          "StartTime",
+			EndTime:            "EndTime",
+			UserId:             "UserId",
+			DepartmentId:       "DepartmentId",
+			Remark:             "Remark",
+			EntityId:           "EntityId",
+			SignInTime:         "SignInTime",
+			SignOutTime:        "SignOutTime",
+			RealityUseDuration: "RealityUseDuration",
+			UserName:           "UserName",
+			Status:             "Status",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *MeetingReservationDao) Ctx(ctx context.Context) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *MeetingReservationDao) As(as string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *MeetingReservationDao) TX(tx *gdb.TX) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *MeetingReservationDao) Master() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *MeetingReservationDao) Slave() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *MeetingReservationDao) Args(args ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingReservationDao) LeftJoin(table ...string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingReservationDao) RightJoin(table ...string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *MeetingReservationDao) InnerJoin(table ...string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *MeetingReservationDao) Fields(fieldNamesOrMapStruct ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *MeetingReservationDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *MeetingReservationDao) Option(option int) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *MeetingReservationDao) OmitEmpty() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *MeetingReservationDao) Filter() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *MeetingReservationDao) Where(where interface{}, args ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *MeetingReservationDao) WherePri(where interface{}, args ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *MeetingReservationDao) And(where interface{}, args ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *MeetingReservationDao) Or(where interface{}, args ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *MeetingReservationDao) Group(groupBy string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *MeetingReservationDao) Order(orderBy ...string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *MeetingReservationDao) Limit(limit ...int) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *MeetingReservationDao) Offset(offset int) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *MeetingReservationDao) Page(page, limit int) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *MeetingReservationDao) Batch(batch int) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *MeetingReservationDao) Cache(duration time.Duration, name ...string) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *MeetingReservationDao) Data(data ...interface{}) *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.MeetingReservation.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *MeetingReservationDao) All(where ...interface{}) ([]*model.MeetingReservation, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.MeetingReservation
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.MeetingReservation.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *MeetingReservationDao) One(where ...interface{}) (*model.MeetingReservation, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.MeetingReservation
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *MeetingReservationDao) FindOne(where ...interface{}) (*model.MeetingReservation, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.MeetingReservation
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *MeetingReservationDao) FindAll(where ...interface{}) ([]*model.MeetingReservation, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.MeetingReservation
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *MeetingReservationDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *MeetingReservationDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *MeetingReservationDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *MeetingReservationDao) Chunk(limit int, callback func(entities []*model.MeetingReservation, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.MeetingReservation
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *MeetingReservationDao) LockUpdate() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *MeetingReservationDao) LockShared() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *MeetingReservationDao) Unscoped() *MeetingReservationDao {
+	return &MeetingReservationDao{M: d.M.Unscoped()}
+}

+ 36 - 0
dao/meeting.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package dao
+
+import (
+	"lims_reservation/dao/internal"
+)
+
+// meetingDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type meetingDao struct {
+	internal.MeetingDao
+}
+
+var (
+	// Meeting is globally public accessible object for table meeting operations.
+	Meeting = meetingDao{
+		internal.Meeting,
+	}
+)
+
+type MeetingDao struct {
+	internal.MeetingDao
+}
+
+func NewMeetingDao(tenant string) *MeetingDao {
+	dao := internal.NewMeetingDao(tenant)
+	return &MeetingDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 36 - 0
dao/meeting_reservation.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package dao
+
+import (
+	"lims_reservation/dao/internal"
+)
+
+// meetingReservationDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type meetingReservationDao struct {
+	internal.MeetingReservationDao
+}
+
+var (
+	// MeetingReservation is globally public accessible object for table meeting_reservation operations.
+	MeetingReservation = meetingReservationDao{
+		internal.MeetingReservation,
+	}
+)
+
+type MeetingReservationDao struct {
+	internal.MeetingReservationDao
+}
+
+func NewMeetingReservationDao(tenant string) *MeetingReservationDao {
+	dao := internal.NewMeetingReservationDao(tenant)
+	return &MeetingReservationDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 103 - 0
go.mod

@@ -0,0 +1,103 @@
+module lims_reservation
+
+go 1.17
+
+require (
+	dashoo.cn/common_definition v0.0.0
+	dashoo.cn/micro_libary v0.0.0
+	github.com/gogf/gf v1.16.4
+	github.com/smallnest/rpcx v1.6.10
+)
+
+require (
+	github.com/BurntSushi/toml v0.3.1 // indirect
+	github.com/apache/thrift v0.14.0 // indirect
+	github.com/armon/go-metrics v0.3.6 // indirect
+	github.com/cenk/backoff v2.2.1+incompatible // indirect
+	github.com/cenkalti/backoff v2.2.1+incompatible // indirect
+	github.com/cespare/xxhash/v2 v2.1.1 // indirect
+	github.com/cheekybits/genny v1.0.0 // indirect
+	github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 // indirect
+	github.com/dgryski/go-jump v0.0.0-20170409065014-e1f439676b57 // indirect
+	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+	github.com/edwingeng/doublejump v0.0.0-20200219153503-7cfc0ed6e836 // indirect
+	github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
+	github.com/fatih/color v1.10.0 // indirect
+	github.com/fsnotify/fsnotify v1.4.9 // indirect
+	github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663 // indirect
+	github.com/go-redis/redis/v8 v8.8.2 // indirect
+	github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
+	github.com/gogf/mysql v1.6.1-0.20210603073548-16164ae25579 // indirect
+	github.com/gogo/protobuf v1.3.1 // indirect
+	github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
+	github.com/golang/snappy v0.0.2 // indirect
+	github.com/gomodule/redigo v2.0.0+incompatible // indirect
+	github.com/gorilla/websocket v1.4.1 // indirect
+	github.com/grandcat/zeroconf v0.0.0-20180329153754-df75bb3ccae1 // indirect
+	github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf // indirect
+	github.com/hashicorp/consul/api v1.8.1 // indirect
+	github.com/hashicorp/errwrap v1.0.0 // indirect
+	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
+	github.com/hashicorp/go-hclog v0.16.0 // indirect
+	github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
+	github.com/hashicorp/go-multierror v1.1.0 // indirect
+	github.com/hashicorp/go-rootcerts v1.0.2 // indirect
+	github.com/hashicorp/golang-lru v0.5.4 // indirect
+	github.com/hashicorp/serf v0.9.5 // indirect
+	github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab // indirect
+	github.com/juju/ratelimit v1.0.1 // indirect
+	github.com/julienschmidt/httprouter v1.3.0 // indirect
+	github.com/kavu/go_reuseport v1.5.0 // indirect
+	github.com/klauspost/cpuid/v2 v2.0.2 // indirect
+	github.com/klauspost/reedsolomon v1.9.10 // indirect
+	github.com/lucas-clemente/quic-go v0.23.0 // indirect
+	github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect
+	github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect
+	github.com/mattn/go-colorable v0.1.8 // indirect
+	github.com/mattn/go-isatty v0.0.12 // indirect
+	github.com/mattn/go-runewidth v0.0.10 // indirect
+	github.com/miekg/dns v1.1.27 // indirect
+	github.com/mitchellh/go-homedir v1.1.0 // indirect
+	github.com/mitchellh/mapstructure v1.4.1 // indirect
+	github.com/nxadm/tail v1.4.8 // indirect
+	github.com/olekukonko/tablewriter v0.0.5 // indirect
+	github.com/onsi/ginkgo v1.16.4 // indirect
+	github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
+	github.com/rivo/uniseg v0.2.0 // indirect
+	github.com/rpcxio/libkv v0.5.1-0.20210420120011-1fceaedca8a5 // indirect
+	github.com/rs/cors v1.7.0 // indirect
+	github.com/rubyist/circuitbreaker v2.2.1+incompatible // indirect
+	github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 // indirect
+	github.com/smallnest/quick v0.0.0-20200505103731-c8c83f9c76d3 // indirect
+	github.com/soheilhy/cmux v0.1.4 // indirect
+	github.com/syndtr/goleveldb v1.0.0 // indirect
+	github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
+	github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
+	github.com/tjfoc/gmsm v1.4.0 // indirect
+	github.com/valyala/bytebufferpool v1.0.0 // indirect
+	github.com/valyala/fastrand v1.0.0 // indirect
+	github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect
+	github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
+	github.com/xtaci/kcp-go v5.4.20+incompatible // indirect
+	go.opencensus.io v0.22.2 // indirect
+	go.opentelemetry.io/otel v0.19.0 // indirect
+	go.opentelemetry.io/otel/metric v0.19.0 // indirect
+	go.opentelemetry.io/otel/trace v0.19.0 // indirect
+	golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee // indirect
+	golang.org/x/mod v0.4.2 // indirect
+	golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
+	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
+	golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
+	golang.org/x/text v0.3.6 // indirect
+	golang.org/x/tools v0.1.1 // indirect
+	golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
+	google.golang.org/protobuf v1.26.0 // indirect
+	gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
+	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
+)
+
+replace dashoo.cn/micro_libary => ../micro_libary_v2
+
+replace dashoo.cn/common_definition => ../micro_common_definition

+ 16 - 0
handler/base.go

@@ -0,0 +1,16 @@
+package handler
+
+import "errors"
+
+/*
+	定义统一方法或者错误
+*/
+
+const (
+	DefaultPageNum     = 10
+	DefaultPageCurrent = 0
+)
+
+var (
+	NoParamsErr = errors.New("参数为空,操作失败")
+)

+ 139 - 0
handler/meeting.go

@@ -0,0 +1,139 @@
+package handler
+
+import (
+	"context"
+	"dashoo.cn/common_definition/comm_def"
+	"dashoo.cn/micro_libary/micro_srv"
+	"dashoo.cn/micro_libary/myerrors"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/util/gvalid"
+	"lims_reservation/model"
+	"lims_reservation/service"
+)
+
+// Meeting 会议室
+type Meeting struct{}
+
+// List 会议室列表
+func (m *Meeting) List(ctx context.Context, req model.ListReq, rsp comm_def.CommonMsg) error {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return err
+	}
+	g.Log().Info("Received Meeting.List request @ " + tenant)
+	if req.Size == 0 {
+		req.Size = DefaultPageNum
+	}
+	if req.Current < 0 {
+		req.Current = DefaultPageCurrent
+	}
+	list, err := service.NewSrv(tenant).List(req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = list
+	return nil
+}
+
+func (m *Meeting) Add(ctx context.Context, req model.MeetingReq, rsp comm_def.CommonMsg) error {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return err
+	}
+	g.Log().Info("Received Meeting.Add request @ " + tenant)
+	// 校验
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if err != nil {
+		return validErr.Current()
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return err
+	}
+
+	err = service.NewSrv(tenant).Add(userInfo, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}
+
+func (m *Meeting) Update(ctx context.Context, req model.MeetingReq, rsp comm_def.CommonMsg) error {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return err
+	}
+	g.Log().Info("Received Meeting.Update request @ " + tenant)
+	// 校验
+	if req.Id == 0 {
+		return NoParamsErr
+	}
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if err != nil {
+		return validErr.Current()
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return err
+	}
+	err = service.NewSrv(tenant).Update(userInfo, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}
+
+func (m *Meeting) Get(ctx context.Context, req model.MeetingReq, rsp comm_def.CommonMsg) error {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return err
+	}
+	g.Log().Info("Received Meeting.List Get @ " + tenant)
+	// 校验
+	if req.Id == 0 {
+		return NoParamsErr
+	}
+	entity, err := service.NewSrv(tenant).Get(req.Id)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = entity
+	return nil
+}
+
+func (m *Meeting) Delete(ctx context.Context, req model.MeetingReq, rsp comm_def.CommonMsg) error {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return err
+	}
+	g.Log().Info("Received Meeting.Delete request @ " + tenant)
+	// 校验
+	if req.Id == 0 {
+		return NoParamsErr
+	}
+	err = service.NewSrv(tenant).Delete(req.Id)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}

+ 1 - 0
handler/reservation.go

@@ -0,0 +1 @@
+package handler

+ 35 - 0
main.go

@@ -0,0 +1,35 @@
+package main
+
+import (
+	"context"
+	"lims_reservation/handler"
+
+	"dashoo.cn/micro_libary/micro_srv"
+	"github.com/gogf/gf/frame/g"
+	"github.com/smallnest/rpcx/protocol"
+)
+
+func main() {
+	srvAddr := g.Config().GetString("setting.bind-addr")
+	basePath := g.Config().GetString("setting.srv-name")
+	// 创建总服务包
+	s := micro_srv.CreateAndInitService(basePath)
+
+	// 注册服务对象
+	s.RegisterName("Meeting", new(handler.Meeting), "")
+
+	// 注册auth处理
+	s.AuthFunc = handleAuth
+	// 运行服务
+	if err := s.Serve("tcp", srvAddr); err != nil {
+		g.Log().Fatal(err)
+	}
+}
+
+// AuthExcludePaths 设定不需要认证的路径
+var AuthExcludePaths = []string{}
+
+// 处理Auth
+func handleAuth(ctx context.Context, req *protocol.Message, token string) error {
+	return micro_srv.HandleAuth(ctx, req, token, AuthExcludePaths)
+}

+ 24 - 0
model/base.go

@@ -0,0 +1,24 @@
+package model
+
+/*
+	基础字段
+*/
+
+// Page 分页
+type Page struct {
+	Current int `json:"current"`
+	Size    int `json:"size"`
+}
+
+// OrderBy 排序
+type OrderBy struct {
+	Type  string `json:"type"`  // desc asc 正序倒序
+	Value string `json:"value"` // 字段名称
+}
+
+// ListReq 列表请求实体
+type ListReq struct {
+	Page
+	OrderBy
+	Entity interface{} `json:"entity"`
+}

+ 28 - 0
model/internal/meeting.go

@@ -0,0 +1,28 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// Meeting is the golang structure for table meeting.
+type Meeting struct {
+	Id          int         `orm:"Id,primary"  json:"id"`          //
+	CreatedBy   string      `orm:"CreatedBy"   json:"createdBy"`   // 创建人姓名
+	CreatedAt   *gtime.Time `orm:"CreatedAt"   json:"createdAt"`   // 创建时间
+	UpdatedAt   *gtime.Time `orm:"UpdatedAt"   json:"updatedAt"`   // 更新时间
+	UpdatedBy   string      `orm:"UpdatedBy"   json:"updatedBy"`   // 更新人姓名
+	DeletedAt   *gtime.Time `orm:"DeletedAt"   json:"deletedAt"`   // 删除时间
+	UpdatedById int         `orm:"UpdatedById" json:"updatedById"` // 更新人ID
+	CreatedById int         `orm:"CreatedById" json:"createdById"` // 创建人ID
+	Code        string      `orm:"Code"        json:"code"`        // 会议室编码
+	Name        string      `orm:"Name"        json:"name"`        // 会议室名称
+	ImgUrl      string      `orm:"ImgUrl"      json:"imgUrl"`      // 图片Url
+	Sort        int         `orm:"Sort"        json:"sort"`        // 排序
+	Scale       int         `orm:"Scale"       json:"scale"`       // 规模/可容纳人数
+	Remark      string      `orm:"Remark"      json:"remark"`      // 备注/说明
+	Location    string      `orm:"Location"    json:"location"`    // 位置
+}

+ 33 - 0
model/internal/meeting_reservation.go

@@ -0,0 +1,33 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// MeetingReservation is the golang structure for table meeting_reservation.
+type MeetingReservation struct {
+	Id                 uint        `orm:"Id,primary"         json:"id"`                 // 主键ID
+	CreatedBy          string      `orm:"CreatedBy"          json:"createdBy"`          // 创建人姓名
+	CreatedAt          *gtime.Time `orm:"CreatedAt"          json:"createdAt"`          // 创建时间
+	UpdatedAt          *gtime.Time `orm:"UpdatedAt"          json:"updatedAt"`          // 更新时间
+	UpdatedBy          string      `orm:"UpdatedBy"          json:"updatedBy"`          // 更新人姓名
+	DeletedAt          *gtime.Time `orm:"DeletedAt"          json:"deletedAt"`          // 删除时间
+	UpdatedById        int         `orm:"UpdatedById"        json:"updatedById"`        // 更新人ID
+	CreatedById        int         `orm:"CreatedById"        json:"createdById"`        // 创建人ID
+	Title              string      `orm:"Title"              json:"title"`              // 标题
+	StartTime          *gtime.Time `orm:"StartTime"          json:"startTime"`          // 开始时间
+	EndTime            *gtime.Time `orm:"EndTime"            json:"endTime"`            // 结束时间
+	UserId             int         `orm:"UserId"             json:"userId"`             // 预约人
+	DepartmentId       int         `orm:"DepartmentId"       json:"departmentId"`       // 部门
+	Remark             string      `orm:"Remark"             json:"remark"`             // 备注
+	EntityId           int         `orm:"EntityId"           json:"entityId"`           // 关联ID
+	SignInTime         *gtime.Time `orm:"SignInTime"         json:"signInTime"`         // 签到时间
+	SignOutTime        *gtime.Time `orm:"SignOutTime"        json:"signOutTime"`        // 签退时间
+	RealityUseDuration float64     `orm:"RealityUseDuration" json:"realityUseDuration"` // 实际使用时长
+	UserName           string      `orm:"UserName"           json:"userName"`           // 预约人姓名
+	Status             int         `orm:"Status"             json:"status"`             // 预约状态(1:预定   2:取消)
+}

+ 25 - 0
model/meeting.go

@@ -0,0 +1,25 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package model
+
+import (
+	"lims_reservation/model/internal"
+)
+
+// Meeting is the golang structure for table meeting.
+type Meeting internal.Meeting
+
+// Fill with you ideas below.
+
+type MeetingReq struct {
+	Id       int    `orm:"Id,primary"  json:"id"`                            //
+	Code     string `orm:"Code"        json:"code"   v:"required#会议室编码不能为空"` // 会议室编码
+	Name     string `orm:"Name"        json:"name" v:"required#会议室名称不能为空"`   // 会议室名称
+	Scale    int    `orm:"Scale"       json:"scale"`                         // 规模/可容纳人数
+	Remark   string `orm:"Remark"      json:"remark"`                        // 备注/说明
+	Location string `orm:"Location"    json:"location"`                      // 位置
+	ImgUrl   string `orm:"ImgUrl"      json:"imgUrl"`                        // 图片Url
+	Sort     int    `orm:"Sort"        json:"sort"`                          // 排序
+}

+ 14 - 0
model/meeting_reservation.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package model
+
+import (
+	"lims_reservation/model/internal"
+)
+
+// MeetingReservation is the golang structure for table meeting_reservation.
+type MeetingReservation internal.MeetingReservation
+
+// Fill with you ideas below.

+ 108 - 0
service/base.go

@@ -0,0 +1,108 @@
+package service
+
+import (
+	"dashoo.cn/micro_libary/request"
+	"errors"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gconv"
+	"strconv"
+)
+
+/*
+	表基础模型
+*/
+
+// BaseModel 基础字段
+type BaseModel struct {
+	CreatedBy   string      `orm:"CreatedBy"          json:"created_by"`    // 创建人姓名
+	CreatedAt   *gtime.Time `orm:"CreatedAt"          json:"created_at"`    // 创建时间
+	UpdatedAt   *gtime.Time `orm:"UpdatedAt"          json:"updated_at"`    // 更新时间
+	UpdatedBy   string      `orm:"UpdatedBy"          json:"updated_by"`    // 更新人姓名
+	DeletedAt   *gtime.Time `orm:"DeletedAt"          json:"deleted_at"`    // 删除时间
+	UpdatedById int         `orm:"UpdatedById"        json:"updated_by_id"` // 更新人ID
+	CreatedById int         `orm:"CreatedById"        json:"created_by_id"` // 创建人ID
+
+	CreateOn       *gtime.Time `orm:"CreateOn"           json:"create_on"`        //
+	CreateUserId   string      `orm:"CreateUserId"       json:"create_user_id"`   //
+	CreateBy       string      `orm:"CreateBy"           json:"create_by"`        //
+	ModifiedOn     *gtime.Time `orm:"ModifiedOn"         json:"modified_on"`      //
+	ModifiedUserId string      `orm:"ModifiedUserId"     json:"modified_user_id"` //
+	ModifiedBy     string      `orm:"ModifiedBy"         json:"modified_by"`      //
+
+	CreatedTime int64 `json:"created_time,omitempty"`
+	UpdatedTime int64 `json:"updated_time,omitempty"`
+
+	Version int `orm:"Version"     json:"version"` // 版本号(乐观锁)
+}
+
+var (
+	BaseColumns = []string{"Id", "CreatedBy", "CreatedAt", "UpdatedAt", "UpdatedBy", "DeletedAt",
+		"UpdatedById", "CreatedById"}
+	// UpdateFieldEx 更新过滤字段
+	UpdateFieldEx = []string{
+		"CreatedBy", "CreatedById", "CreateOn",
+		"CreateUserId", "CreateBy", "CreatedTime",
+		"CreatedUserId", "Id"}
+	UpdateBaseField = []string{"UpdatedBy", "UpdatedById"}
+)
+
+var (
+	NameExistsErr = errors.New("名称不能重复,请重新输入")
+	CodeExistsErr = errors.New("编码不能重复,请重新输入")
+)
+
+// SetCreatedInfo 设置默认创建信息,仅创建时使用
+func (b *BaseModel) SetCreatedInfo(user *request.UserInfo) *BaseModel {
+	b.CreatedBy = user.UserName
+	b.CreatedById = int(user.Id)
+
+	b.CreateOn = gtime.Now()
+	b.CreateUserId = strconv.Itoa(int(user.Id))
+	b.CreateBy = user.UserName
+
+	b.CreatedTime = gtime.Timestamp()
+	return b.SetUpdateInfo(user)
+}
+
+// SetUpdateInfo 设置默认更新信息,仅用于更新
+func (b *BaseModel) SetUpdateInfo(user *request.UserInfo) *BaseModel {
+	b.UpdatedBy = user.UserName
+	b.UpdatedById = int(user.Id)
+
+	b.ModifiedOn = gtime.Now()
+	b.ModifiedUserId = strconv.Itoa(int(user.Id))
+	b.ModifiedBy = user.UserName
+
+	b.UpdatedTime = gtime.Timestamp()
+	return b
+}
+
+// SetUpdate 更新实体基础信息处理
+func SetUpdate(user *request.UserInfo, data interface{}) {
+	base := new(BaseModel).SetUpdateInfo(user)
+	_ = gconv.Struct(base, data)
+}
+
+// SetCreate 创建实体基础信息处理
+func SetCreate(user *request.UserInfo, data interface{}) {
+	base := new(BaseModel).SetCreatedInfo(user)
+	_ = gconv.Struct(base, data)
+}
+
+// SetUpdatedMap 生成用户信息
+func SetUpdatedMap(user *request.UserInfo) g.Map {
+	return g.Map{
+		"UpdatedBy":   gtime.Now(),
+		"UpdatedById": user.Id,
+	}
+}
+
+// SetModifiedMap 生成用户信息
+func SetModifiedMap(user *request.UserInfo) g.Map {
+	return g.Map{
+		"ModifiedOn":     gtime.Now(),
+		"ModifiedUserId": user.Id,
+		"ModifiedBy":     user.UserName,
+	}
+}

+ 1 - 0
service/check.go

@@ -0,0 +1 @@
+package service

+ 126 - 0
service/meeting.go

@@ -0,0 +1,126 @@
+package service
+
+import (
+	"dashoo.cn/micro_libary/request"
+	"github.com/gogf/gf/util/gconv"
+	"lims_reservation/dao"
+	"lims_reservation/model"
+)
+
+// MeetingService 会议室服务
+type MeetingService struct {
+	Dao *dao.MeetingDao
+}
+
+// NewSrv 服务初始化
+func NewSrv(tenant string) MeetingService {
+	return MeetingService{dao.NewMeetingDao(tenant)}
+}
+
+// List 会议室列表
+func (m MeetingService) List(req model.ListReq) ([]model.Meeting, error) {
+	entityModel := m.Dao.M
+
+	if req.Entity != nil {
+		if entity, ok := req.Entity.(model.MeetingReq); ok {
+			if entity.Name != "" {
+				entityModel = entityModel.WhereLike(m.Dao.Columns.Name, "%"+entity.Name+"%")
+			}
+			if entity.Code != "" {
+				entityModel = entityModel.WhereLike(m.Dao.Columns.Code, "%"+entity.Code+"%")
+			}
+			if entity.Scale != 0 {
+				entityModel = entityModel.Where(m.Dao.Columns.Scale, entity.Scale)
+			}
+			if entity.Location != "" {
+				entityModel = entityModel.WhereLike(m.Dao.Columns.Location, "%"+entity.Location+"%")
+			}
+		}
+	}
+
+	if req.Value != "" {
+		entityModel = entityModel.Order(req.Value, req.Type)
+	}
+	res, err := entityModel.Page(req.Current, req.Size).FindAll()
+	if err != nil {
+		return nil, err
+	}
+	if res.IsEmpty() {
+		return nil, nil
+	}
+	list := make([]model.Meeting, 0)
+	res.Structs(&list)
+	return list, nil
+}
+
+func (m MeetingService) Add(userInfo request.UserInfo, req model.MeetingReq) error {
+	entity := new(model.Meeting)
+	// 唯一校验
+	count, err := m.Dao.M.Fields(m.Dao.Columns.Id).Where(m.Dao.Columns.Name, req.Name).FindCount()
+	if err != nil {
+		return err
+	}
+	if count > 0 {
+		return NameExistsErr
+	}
+	count, err = m.Dao.M.Fields(m.Dao.Columns.Id).Where(m.Dao.Columns.Code, req.Code).FindCount()
+	if err != nil {
+		return err
+	}
+	if count > 0 {
+		return CodeExistsErr
+	}
+	gconv.Struct(req, entity)
+
+	SetCreate(&userInfo, entity)
+
+	_, err = m.Dao.M.Insert(entity)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+func (m MeetingService) Update(userInfo request.UserInfo, req model.MeetingReq) error {
+	entity := new(model.Meeting)
+	// 唯一校验
+	count, err := m.Dao.M.Fields(m.Dao.Columns.Id).
+		Where(m.Dao.Columns.Name, req.Name).WhereNot(m.Dao.Columns.Id, req.Id).
+		FindCount()
+	if err != nil {
+		return err
+	}
+	if count > 0 {
+		return NameExistsErr
+	}
+	count, err = m.Dao.M.Fields(m.Dao.Columns.Id).
+		Where(m.Dao.Columns.Code, req.Code).WhereNot(m.Dao.Columns.Id, req.Id).
+		FindCount()
+	if err != nil {
+		return err
+	}
+	if count > 0 {
+		return CodeExistsErr
+	}
+	gconv.Struct(req, entity)
+
+	SetCreate(&userInfo, entity)
+
+	_, err = m.Dao.M.WherePri(req.Id).Update(entity)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+func (m MeetingService) Get(id int) (*model.Meeting, error) {
+	return m.Dao.WherePri(id).FindOne()
+}
+
+func (m MeetingService) Delete(id int) error {
+	_, err := m.Dao.WherePri(id).Delete()
+	if err != nil {
+		return err
+	}
+	return nil
+}