meeting_reservation.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "database/sql"
  8. "github.com/gogf/gf/database/gdb"
  9. "github.com/gogf/gf/frame/g"
  10. "github.com/gogf/gf/frame/gmvc"
  11. "time"
  12. "lims_adapter/model"
  13. )
  14. // MeetingReservationDao is the manager for logic model data accessing
  15. // and custom defined data operations functions management.
  16. type MeetingReservationDao struct {
  17. gmvc.M
  18. DB gdb.DB
  19. Table string
  20. Columns meetingReservationColumns
  21. }
  22. // MeetingReservationColumns defines and stores column names for table meeting_reservation.
  23. type meetingReservationColumns struct {
  24. Id string // 主键ID
  25. CreatedBy string // 创建人姓名
  26. CreatedAt string // 创建时间
  27. UpdatedAt string // 更新时间
  28. UpdatedBy string // 更新人姓名
  29. DeletedAt string // 删除时间
  30. UpdatedById string // 更新人ID
  31. CreatedById string // 创建人ID
  32. Title string // 标题
  33. StartTime string // 开始时间
  34. EndTime string // 结束时间
  35. UserId string // 预约人
  36. DepartmentId string // 部门
  37. Remark string // 备注
  38. EntityId string // 关联ID
  39. SignInTime string // 签到时间
  40. SignOutTime string // 签退时间
  41. RealityUseDuration string // 实际使用时长
  42. UserName string // 预约人姓名
  43. Status string // 预约状态(1:预定 2:取消)
  44. RealEndTimeNode string // 实际结束时间节点(用于增加预约时的校验)
  45. }
  46. var (
  47. // MeetingReservation is globally public accessible object for table meeting_reservation operations.
  48. MeetingReservation = MeetingReservationDao{
  49. M: g.DB("default").Model("meeting_reservation").Safe(),
  50. DB: g.DB("default"),
  51. Table: "meeting_reservation",
  52. Columns: meetingReservationColumns{
  53. Id: "Id",
  54. CreatedBy: "CreatedBy",
  55. CreatedAt: "CreatedAt",
  56. UpdatedAt: "UpdatedAt",
  57. UpdatedBy: "UpdatedBy",
  58. DeletedAt: "DeletedAt",
  59. UpdatedById: "UpdatedById",
  60. CreatedById: "CreatedById",
  61. Title: "Title",
  62. StartTime: "StartTime",
  63. EndTime: "EndTime",
  64. UserId: "UserId",
  65. DepartmentId: "DepartmentId",
  66. Remark: "Remark",
  67. EntityId: "EntityId",
  68. SignInTime: "SignInTime",
  69. SignOutTime: "SignOutTime",
  70. RealityUseDuration: "RealityUseDuration",
  71. UserName: "UserName",
  72. Status: "Status",
  73. RealEndTimeNode: "RealEndTimeNode",
  74. },
  75. }
  76. )
  77. func NewMeetingReservationDao(tenant string) MeetingReservationDao {
  78. var dao MeetingReservationDao
  79. dao = MeetingReservationDao{
  80. M: g.DB(tenant).Model("meeting_reservation").Safe(),
  81. DB: g.DB(tenant),
  82. Table: "meeting_reservation",
  83. Columns: meetingReservationColumns{
  84. Id: "Id",
  85. CreatedBy: "CreatedBy",
  86. CreatedAt: "CreatedAt",
  87. UpdatedAt: "UpdatedAt",
  88. UpdatedBy: "UpdatedBy",
  89. DeletedAt: "DeletedAt",
  90. UpdatedById: "UpdatedById",
  91. CreatedById: "CreatedById",
  92. Title: "Title",
  93. StartTime: "StartTime",
  94. EndTime: "EndTime",
  95. UserId: "UserId",
  96. DepartmentId: "DepartmentId",
  97. Remark: "Remark",
  98. EntityId: "EntityId",
  99. SignInTime: "SignInTime",
  100. SignOutTime: "SignOutTime",
  101. RealityUseDuration: "RealityUseDuration",
  102. UserName: "UserName",
  103. Status: "Status",
  104. RealEndTimeNode: "RealEndTimeNode",
  105. },
  106. }
  107. return dao
  108. }
  109. // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
  110. // of current DB object and with given context in it.
  111. // Note that this returned DB object can be used only once, so do not assign it to
  112. // a global or package variable for long using.
  113. func (d *MeetingReservationDao) Ctx(ctx context.Context) *MeetingReservationDao {
  114. return &MeetingReservationDao{M: d.M.Ctx(ctx)}
  115. }
  116. // As sets an alias name for current table.
  117. func (d *MeetingReservationDao) As(as string) *MeetingReservationDao {
  118. return &MeetingReservationDao{M: d.M.As(as)}
  119. }
  120. // TX sets the transaction for current operation.
  121. func (d *MeetingReservationDao) TX(tx *gdb.TX) *MeetingReservationDao {
  122. return &MeetingReservationDao{M: d.M.TX(tx)}
  123. }
  124. // Master marks the following operation on master node.
  125. func (d *MeetingReservationDao) Master() *MeetingReservationDao {
  126. return &MeetingReservationDao{M: d.M.Master()}
  127. }
  128. // Slave marks the following operation on slave node.
  129. // Note that it makes sense only if there's any slave node configured.
  130. func (d *MeetingReservationDao) Slave() *MeetingReservationDao {
  131. return &MeetingReservationDao{M: d.M.Slave()}
  132. }
  133. // Args sets custom arguments for model operation.
  134. func (d *MeetingReservationDao) Args(args ...interface{}) *MeetingReservationDao {
  135. return &MeetingReservationDao{M: d.M.Args(args...)}
  136. }
  137. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  138. // The parameter <table> can be joined table and its joined condition,
  139. // and also with its alias name, like:
  140. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  141. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  142. func (d *MeetingReservationDao) LeftJoin(table ...string) *MeetingReservationDao {
  143. return &MeetingReservationDao{M: d.M.LeftJoin(table...)}
  144. }
  145. // RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
  146. // The parameter <table> can be joined table and its joined condition,
  147. // and also with its alias name, like:
  148. // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
  149. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  150. func (d *MeetingReservationDao) RightJoin(table ...string) *MeetingReservationDao {
  151. return &MeetingReservationDao{M: d.M.RightJoin(table...)}
  152. }
  153. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  154. // The parameter <table> can be joined table and its joined condition,
  155. // and also with its alias name, like:
  156. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  157. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  158. func (d *MeetingReservationDao) InnerJoin(table ...string) *MeetingReservationDao {
  159. return &MeetingReservationDao{M: d.M.InnerJoin(table...)}
  160. }
  161. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  162. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  163. func (d *MeetingReservationDao) Fields(fieldNamesOrMapStruct ...interface{}) *MeetingReservationDao {
  164. return &MeetingReservationDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
  165. }
  166. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  167. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  168. func (d *MeetingReservationDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *MeetingReservationDao {
  169. return &MeetingReservationDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
  170. }
  171. // Option sets the extra operation option for the model.
  172. func (d *MeetingReservationDao) Option(option int) *MeetingReservationDao {
  173. return &MeetingReservationDao{M: d.M.Option(option)}
  174. }
  175. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  176. // the data and where attributes for empty values.
  177. func (d *MeetingReservationDao) OmitEmpty() *MeetingReservationDao {
  178. return &MeetingReservationDao{M: d.M.OmitEmpty()}
  179. }
  180. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  181. func (d *MeetingReservationDao) Filter() *MeetingReservationDao {
  182. return &MeetingReservationDao{M: d.M.Filter()}
  183. }
  184. // Where sets the condition statement for the model. The parameter <where> can be type of
  185. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  186. // multiple conditions will be joined into where statement using "AND".
  187. // Eg:
  188. // Where("uid=10000")
  189. // Where("uid", 10000)
  190. // Where("money>? AND name like ?", 99999, "vip_%")
  191. // Where("uid", 1).Where("name", "john")
  192. // Where("status IN (?)", g.Slice{1,2,3})
  193. // Where("age IN(?,?)", 18, 50)
  194. // Where(User{ Id : 1, UserName : "john"})
  195. func (d *MeetingReservationDao) Where(where interface{}, args ...interface{}) *MeetingReservationDao {
  196. return &MeetingReservationDao{M: d.M.Where(where, args...)}
  197. }
  198. // WherePri does the same logic as M.Where except that if the parameter <where>
  199. // is a single condition like int/string/float/slice, it treats the condition as the primary
  200. // key value. That is, if primary key is "id" and given <where> parameter as "123", the
  201. // WherePri function treats the condition as "id=123", but M.Where treats the condition
  202. // as string "123".
  203. func (d *MeetingReservationDao) WherePri(where interface{}, args ...interface{}) *MeetingReservationDao {
  204. return &MeetingReservationDao{M: d.M.WherePri(where, args...)}
  205. }
  206. // And adds "AND" condition to the where statement.
  207. func (d *MeetingReservationDao) And(where interface{}, args ...interface{}) *MeetingReservationDao {
  208. return &MeetingReservationDao{M: d.M.And(where, args...)}
  209. }
  210. // Or adds "OR" condition to the where statement.
  211. func (d *MeetingReservationDao) Or(where interface{}, args ...interface{}) *MeetingReservationDao {
  212. return &MeetingReservationDao{M: d.M.Or(where, args...)}
  213. }
  214. // Group sets the "GROUP BY" statement for the model.
  215. func (d *MeetingReservationDao) Group(groupBy string) *MeetingReservationDao {
  216. return &MeetingReservationDao{M: d.M.Group(groupBy)}
  217. }
  218. // Order sets the "ORDER BY" statement for the model.
  219. func (d *MeetingReservationDao) Order(orderBy ...string) *MeetingReservationDao {
  220. return &MeetingReservationDao{M: d.M.Order(orderBy...)}
  221. }
  222. // Limit sets the "LIMIT" statement for the model.
  223. // The parameter <limit> can be either one or two number, if passed two number is passed,
  224. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  225. // statement.
  226. func (d *MeetingReservationDao) Limit(limit ...int) *MeetingReservationDao {
  227. return &MeetingReservationDao{M: d.M.Limit(limit...)}
  228. }
  229. // Offset sets the "OFFSET" statement for the model.
  230. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  231. func (d *MeetingReservationDao) Offset(offset int) *MeetingReservationDao {
  232. return &MeetingReservationDao{M: d.M.Offset(offset)}
  233. }
  234. // Page sets the paging number for the model.
  235. // The parameter <page> is started from 1 for paging.
  236. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  237. func (d *MeetingReservationDao) Page(page, limit int) *MeetingReservationDao {
  238. return &MeetingReservationDao{M: d.M.Page(page, limit)}
  239. }
  240. // Batch sets the batch operation number for the model.
  241. func (d *MeetingReservationDao) Batch(batch int) *MeetingReservationDao {
  242. return &MeetingReservationDao{M: d.M.Batch(batch)}
  243. }
  244. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  245. // if there's another same sql request, it just reads and returns the result from cache, it
  246. // but not committed and executed into the database.
  247. //
  248. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  249. // If the parameter <duration> = 0, which means it never expires.
  250. // If the parameter <duration> > 0, which means it expires after <duration>.
  251. //
  252. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  253. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  254. //
  255. // Note that, the cache feature is disabled if the model is operating on a transaction.
  256. func (d *MeetingReservationDao) Cache(duration time.Duration, name ...string) *MeetingReservationDao {
  257. return &MeetingReservationDao{M: d.M.Cache(duration, name...)}
  258. }
  259. // Data sets the operation data for the model.
  260. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  261. // Eg:
  262. // Data("uid=10000")
  263. // Data("uid", 10000)
  264. // Data(g.Map{"uid": 10000, "name":"john"})
  265. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  266. func (d *MeetingReservationDao) Data(data ...interface{}) *MeetingReservationDao {
  267. return &MeetingReservationDao{M: d.M.Data(data...)}
  268. }
  269. // All does "SELECT FROM ..." statement for the model.
  270. // It retrieves the records from table and returns the result as []*model.MeetingReservation.
  271. // It returns nil if there's no record retrieved with the given conditions from table.
  272. //
  273. // The optional parameter <where> is the same as the parameter of M.Where function,
  274. // see M.Where.
  275. func (d *MeetingReservationDao) All(where ...interface{}) ([]*model.MeetingReservation, error) {
  276. all, err := d.M.All(where...)
  277. if err != nil {
  278. return nil, err
  279. }
  280. var entities []*model.MeetingReservation
  281. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  282. return nil, err
  283. }
  284. return entities, nil
  285. }
  286. // One retrieves one record from table and returns the result as *model.MeetingReservation.
  287. // It returns nil if there's no record retrieved with the given conditions from table.
  288. //
  289. // The optional parameter <where> is the same as the parameter of M.Where function,
  290. // see M.Where.
  291. func (d *MeetingReservationDao) One(where ...interface{}) (*model.MeetingReservation, error) {
  292. one, err := d.M.One(where...)
  293. if err != nil {
  294. return nil, err
  295. }
  296. var entity *model.MeetingReservation
  297. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  298. return nil, err
  299. }
  300. return entity, nil
  301. }
  302. // FindOne retrieves and returns a single Record by M.WherePri and M.One.
  303. // Also see M.WherePri and M.One.
  304. func (d *MeetingReservationDao) FindOne(where ...interface{}) (*model.MeetingReservation, error) {
  305. one, err := d.M.FindOne(where...)
  306. if err != nil {
  307. return nil, err
  308. }
  309. var entity *model.MeetingReservation
  310. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  311. return nil, err
  312. }
  313. return entity, nil
  314. }
  315. // FindAll retrieves and returns Result by by M.WherePri and M.All.
  316. // Also see M.WherePri and M.All.
  317. func (d *MeetingReservationDao) FindAll(where ...interface{}) ([]*model.MeetingReservation, error) {
  318. all, err := d.M.FindAll(where...)
  319. if err != nil {
  320. return nil, err
  321. }
  322. var entities []*model.MeetingReservation
  323. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  324. return nil, err
  325. }
  326. return entities, nil
  327. }
  328. // Struct retrieves one record from table and converts it into given struct.
  329. // The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
  330. // it can create the struct internally during converting.
  331. //
  332. // The optional parameter <where> is the same as the parameter of Model.Where function,
  333. // see Model.Where.
  334. //
  335. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  336. // from table and <pointer> is not nil.
  337. //
  338. // Eg:
  339. // user := new(User)
  340. // err := dao.User.Where("id", 1).Struct(user)
  341. //
  342. // user := (*User)(nil)
  343. // err := dao.User.Where("id", 1).Struct(&user)
  344. func (d *MeetingReservationDao) Struct(pointer interface{}, where ...interface{}) error {
  345. return d.M.Struct(pointer, where...)
  346. }
  347. // Structs retrieves records from table and converts them into given struct slice.
  348. // The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
  349. // slice internally during converting.
  350. //
  351. // The optional parameter <where> is the same as the parameter of Model.Where function,
  352. // see Model.Where.
  353. //
  354. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  355. // from table and <pointer> is not empty.
  356. //
  357. // Eg:
  358. // users := ([]User)(nil)
  359. // err := dao.User.Structs(&users)
  360. //
  361. // users := ([]*User)(nil)
  362. // err := dao.User.Structs(&users)
  363. func (d *MeetingReservationDao) Structs(pointer interface{}, where ...interface{}) error {
  364. return d.M.Structs(pointer, where...)
  365. }
  366. // Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
  367. // It calls function Struct if <pointer> is type of *struct/**struct.
  368. // It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
  369. //
  370. // The optional parameter <where> is the same as the parameter of Model.Where function,
  371. // see Model.Where.
  372. //
  373. // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
  374. //
  375. // Eg:
  376. // user := new(User)
  377. // err := dao.User.Where("id", 1).Scan(user)
  378. //
  379. // user := (*User)(nil)
  380. // err := dao.User.Where("id", 1).Scan(&user)
  381. //
  382. // users := ([]User)(nil)
  383. // err := dao.User.Scan(&users)
  384. //
  385. // users := ([]*User)(nil)
  386. // err := dao.User.Scan(&users)
  387. func (d *MeetingReservationDao) Scan(pointer interface{}, where ...interface{}) error {
  388. return d.M.Scan(pointer, where...)
  389. }
  390. // Chunk iterates the table with given size and callback function.
  391. func (d *MeetingReservationDao) Chunk(limit int, callback func(entities []*model.MeetingReservation, err error) bool) {
  392. d.M.Chunk(limit, func(result gdb.Result, err error) bool {
  393. var entities []*model.MeetingReservation
  394. err = result.Structs(&entities)
  395. if err == sql.ErrNoRows {
  396. return false
  397. }
  398. return callback(entities, err)
  399. })
  400. }
  401. // LockUpdate sets the lock for update for current operation.
  402. func (d *MeetingReservationDao) LockUpdate() *MeetingReservationDao {
  403. return &MeetingReservationDao{M: d.M.LockUpdate()}
  404. }
  405. // LockShared sets the lock in share mode for current operation.
  406. func (d *MeetingReservationDao) LockShared() *MeetingReservationDao {
  407. return &MeetingReservationDao{M: d.M.LockShared()}
  408. }
  409. // Unscoped enables/disables the soft deleting feature.
  410. func (d *MeetingReservationDao) Unscoped() *MeetingReservationDao {
  411. return &MeetingReservationDao{M: d.M.Unscoped()}
  412. }