settle_account_bill.go 17 KB

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