settle_account_bill.go 19 KB

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