meeting_reservation.go 17 KB

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