train_sale_apply.go 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  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. "dashoo.cn/micro/app/model/train"
  13. )
  14. // TrainSaleApplyDao is the manager for logic model data accessing and custom defined data operations functions management.
  15. type TrainSaleApplyDao struct {
  16. gmvc.M // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
  17. C trainSaleApplyColumns // C is the short type for Columns, which contains all the column names of Table for convenient usage.
  18. DB gdb.DB // DB is the raw underlying database management object.
  19. Table string // Table is the underlying table name of the DAO.
  20. TableAs string // TableAs is the underlying table alias name of the DAO.
  21. }
  22. // TrainSaleApplyColumns defines and stores column names for table train_sale_apply.
  23. type trainSaleApplyColumns struct {
  24. Id string // 主键
  25. DistributorId string // 渠道ID
  26. DistributorName string // 渠道名称
  27. MainProduct string // 主营产品
  28. MainCustomer string // 主要客户
  29. Trainees string // 参训人员
  30. ExpectTrainDate string // 期望培训日期
  31. ExpectStartTime string // 期望开始时间
  32. ExpectEndTime string // 期望结束时间
  33. TrainTitle string // 培训主题
  34. InstructorRequire string // 讲师要求
  35. FocusPoint string // 关注要点
  36. TrainInstructor string // 培训讲师
  37. TrainDate string // 培训日期
  38. SpecificStartTime string // 开始时间
  39. SpecificEndTime string // 结束时间
  40. ApplyType string // 申请状态(10 已提交 20 已确认 30 总结完成)
  41. CreatedBy string // 创建人
  42. CreatedName string // 创建人
  43. CreatedTime string // 创建时间
  44. UpdatedBy string // 更新人
  45. UpdatedName string // 更新人
  46. UpdatedTime string // 更新时间
  47. DeletedTime string // 删除时间
  48. }
  49. var (
  50. // TrainSaleApply is globally public accessible object for table train_sale_apply operations.
  51. TrainSaleApply = TrainSaleApplyDao{
  52. M: g.DB("default").Model("train_sale_apply").Safe(),
  53. DB: g.DB("default"),
  54. Table: "train_sale_apply",
  55. C: trainSaleApplyColumns{
  56. Id: "id",
  57. DistributorId: "distributor_id",
  58. DistributorName: "distributor_name",
  59. MainProduct: "main_product",
  60. MainCustomer: "main_customer",
  61. Trainees: "trainees",
  62. ExpectTrainDate: "expect_train_date",
  63. ExpectStartTime: "expect_start_time",
  64. ExpectEndTime: "expect_end_time",
  65. TrainTitle: "train_title",
  66. InstructorRequire: "instructor_require",
  67. FocusPoint: "focus_point",
  68. TrainInstructor: "train_instructor",
  69. TrainDate: "train_date",
  70. SpecificStartTime: "specific_start_time",
  71. SpecificEndTime: "specific_end_time",
  72. ApplyType: "apply_type",
  73. CreatedBy: "created_by",
  74. CreatedName: "created_name",
  75. CreatedTime: "created_time",
  76. UpdatedBy: "updated_by",
  77. UpdatedName: "updated_name",
  78. UpdatedTime: "updated_time",
  79. DeletedTime: "deleted_time",
  80. },
  81. }
  82. )
  83. func NewTrainSaleApplyDao(tenant string) TrainSaleApplyDao {
  84. var dao TrainSaleApplyDao
  85. dao = TrainSaleApplyDao{
  86. M: g.DB(tenant).Model("train_sale_apply").Safe(),
  87. DB: g.DB(tenant),
  88. Table: "train_sale_apply",
  89. C: trainSaleApplyColumns{
  90. Id: "id",
  91. DistributorId: "distributor_id",
  92. DistributorName: "distributor_name",
  93. MainProduct: "main_product",
  94. MainCustomer: "main_customer",
  95. Trainees: "trainees",
  96. ExpectTrainDate: "expect_train_date",
  97. ExpectStartTime: "expect_start_time",
  98. ExpectEndTime: "expect_end_time",
  99. TrainTitle: "train_title",
  100. InstructorRequire: "instructor_require",
  101. FocusPoint: "focus_point",
  102. TrainInstructor: "train_instructor",
  103. TrainDate: "train_date",
  104. SpecificStartTime: "specific_start_time",
  105. SpecificEndTime: "specific_end_time",
  106. ApplyType: "apply_type",
  107. CreatedBy: "created_by",
  108. CreatedName: "created_name",
  109. CreatedTime: "created_time",
  110. UpdatedBy: "updated_by",
  111. UpdatedName: "updated_name",
  112. UpdatedTime: "updated_time",
  113. DeletedTime: "deleted_time",
  114. },
  115. }
  116. return dao
  117. }
  118. // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
  119. // of current DB object and with given context in it.
  120. // Note that this returned DB object can be used only once, so do not assign it to
  121. // a global or package variable for long using.
  122. func (d *TrainSaleApplyDao) Ctx(ctx context.Context) *TrainSaleApplyDao {
  123. return &TrainSaleApplyDao{M: d.M.Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
  124. }
  125. // GetCtx returns the context for current Model.
  126. // It returns "context.Background() i"s there's no context previously set.
  127. func (d *TrainSaleApplyDao) GetCtx() context.Context {
  128. return d.M.GetCtx()
  129. }
  130. // As sets an alias name for current table.
  131. func (d *TrainSaleApplyDao) As(as string) *TrainSaleApplyDao {
  132. return &TrainSaleApplyDao{M: d.M.As(as), Table: d.Table, TableAs: as}
  133. }
  134. // TX sets the transaction for current operation.
  135. func (d *TrainSaleApplyDao) TX(tx *gdb.TX) *TrainSaleApplyDao {
  136. return &TrainSaleApplyDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
  137. }
  138. // Master marks the following operation on master node.
  139. func (d *TrainSaleApplyDao) Master() *TrainSaleApplyDao {
  140. return &TrainSaleApplyDao{M: d.M.Master(), Table: d.Table, TableAs: d.TableAs}
  141. }
  142. // Slave marks the following operation on slave node.
  143. // Note that it makes sense only if there's any slave node configured.
  144. func (d *TrainSaleApplyDao) Slave() *TrainSaleApplyDao {
  145. return &TrainSaleApplyDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
  146. }
  147. // Args sets custom arguments for model operation.
  148. func (d *TrainSaleApplyDao) Args(args ...interface{}) *TrainSaleApplyDao {
  149. return &TrainSaleApplyDao{M: d.M.Args(args...), Table: d.Table, TableAs: d.TableAs}
  150. }
  151. // Handler calls each of "handlers" on current Model and returns a new Model.
  152. // ModelHandler is a function that handles given Model and returns a new Model that is custom modified.
  153. func (d *TrainSaleApplyDao) Handler(handlers ...gdb.ModelHandler) *TrainSaleApplyDao {
  154. return &TrainSaleApplyDao{M: d.M.Handler(handlers...), Table: d.Table, TableAs: d.TableAs}
  155. }
  156. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  157. // The parameter <table> can be joined table and its joined condition,
  158. // and also with its alias name, like:
  159. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  160. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  161. func (d *TrainSaleApplyDao) LeftJoin(table ...string) *TrainSaleApplyDao {
  162. return &TrainSaleApplyDao{M: d.M.LeftJoin(table...), Table: d.Table, TableAs: d.TableAs}
  163. }
  164. // RightJoin does "RIGHT 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").RightJoin("user_detail", "user_detail.uid=user.uid")
  168. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  169. func (d *TrainSaleApplyDao) RightJoin(table ...string) *TrainSaleApplyDao {
  170. return &TrainSaleApplyDao{M: d.M.RightJoin(table...), Table: d.Table, TableAs: d.TableAs}
  171. }
  172. // InnerJoin does "INNER 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").InnerJoin("user_detail", "user_detail.uid=user.uid")
  176. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  177. func (d *TrainSaleApplyDao) InnerJoin(table ...string) *TrainSaleApplyDao {
  178. return &TrainSaleApplyDao{M: d.M.InnerJoin(table...), Table: d.Table, TableAs: d.TableAs}
  179. }
  180. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  181. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  182. func (d *TrainSaleApplyDao) Fields(fieldNamesOrMapStruct ...interface{}) *TrainSaleApplyDao {
  183. return &TrainSaleApplyDao{M: d.M.Fields(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
  184. }
  185. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  186. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  187. func (d *TrainSaleApplyDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *TrainSaleApplyDao {
  188. return &TrainSaleApplyDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
  189. }
  190. // FieldCount formats and appends commonly used field "COUNT(column)" to the select fields of model.
  191. func (d *TrainSaleApplyDao) FieldCount(column string, as ...string) *TrainSaleApplyDao {
  192. return &TrainSaleApplyDao{M: d.M.FieldCount(column, as...), Table: d.Table, TableAs: d.TableAs}
  193. }
  194. // FieldSum formats and appends commonly used field "SUM(column)" to the select fields of model.
  195. func (d *TrainSaleApplyDao) FieldSum(column string, as ...string) *TrainSaleApplyDao {
  196. return &TrainSaleApplyDao{M: d.M.FieldSum(column, as...), Table: d.Table, TableAs: d.TableAs}
  197. }
  198. // FieldMin formats and appends commonly used field "MIN(column)" to the select fields of model.
  199. func (d *TrainSaleApplyDao) FieldMin(column string, as ...string) *TrainSaleApplyDao {
  200. return &TrainSaleApplyDao{M: d.M.FieldMin(column, as...), Table: d.Table, TableAs: d.TableAs}
  201. }
  202. // FieldMax formats and appends commonly used field "MAX(column)" to the select fields of model.
  203. func (d *TrainSaleApplyDao) FieldMax(column string, as ...string) *TrainSaleApplyDao {
  204. return &TrainSaleApplyDao{M: d.M.FieldMax(column, as...), Table: d.Table, TableAs: d.TableAs}
  205. }
  206. // FieldAvg formats and appends commonly used field "AVG(column)" to the select fields of model.
  207. func (d *TrainSaleApplyDao) FieldAvg(column string, as ...string) *TrainSaleApplyDao {
  208. return &TrainSaleApplyDao{M: d.M.FieldAvg(column, as...), Table: d.Table, TableAs: d.TableAs}
  209. }
  210. // Option adds extra operation option for the model.
  211. // Deprecated, use separate operations instead.
  212. func (d *TrainSaleApplyDao) Option(option int) *TrainSaleApplyDao {
  213. return &TrainSaleApplyDao{M: d.M.Option(option), Table: d.Table, TableAs: d.TableAs}
  214. }
  215. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  216. // the data and where attributes for empty values.
  217. func (d *TrainSaleApplyDao) OmitEmpty() *TrainSaleApplyDao {
  218. return &TrainSaleApplyDao{M: d.M.OmitEmpty(), Table: d.Table, TableAs: d.TableAs}
  219. }
  220. // OmitEmptyWhere sets optionOmitEmptyWhere option for the model, which automatically filers
  221. // the Where/Having parameters for "empty" values.
  222. func (d *TrainSaleApplyDao) OmitEmptyWhere() *TrainSaleApplyDao {
  223. return &TrainSaleApplyDao{M: d.M.OmitEmptyWhere(), Table: d.Table, TableAs: d.TableAs}
  224. }
  225. // OmitEmptyData sets optionOmitEmptyData option for the model, which automatically filers
  226. // the Data parameters for "empty" values.
  227. func (d *TrainSaleApplyDao) OmitEmptyData() *TrainSaleApplyDao {
  228. return &TrainSaleApplyDao{M: d.M.OmitEmptyData(), Table: d.Table, TableAs: d.TableAs}
  229. }
  230. // OmitNil sets optionOmitNil option for the model, which automatically filers
  231. // the data and where parameters for "nil" values.
  232. func (d *TrainSaleApplyDao) OmitNil() *TrainSaleApplyDao {
  233. return &TrainSaleApplyDao{M: d.M.OmitNil(), Table: d.Table, TableAs: d.TableAs}
  234. }
  235. // OmitNilWhere sets optionOmitNilWhere option for the model, which automatically filers
  236. // the Where/Having parameters for "nil" values.
  237. func (d *TrainSaleApplyDao) OmitNilWhere() *TrainSaleApplyDao {
  238. return &TrainSaleApplyDao{M: d.M.OmitNilWhere(), Table: d.Table, TableAs: d.TableAs}
  239. }
  240. // OmitNilData sets optionOmitNilData option for the model, which automatically filers
  241. // the Data parameters for "nil" values.
  242. func (d *TrainSaleApplyDao) OmitNilData() *TrainSaleApplyDao {
  243. return &TrainSaleApplyDao{M: d.M.OmitNilData(), Table: d.Table, TableAs: d.TableAs}
  244. }
  245. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  246. // Note that this function supports only single table operations.
  247. // Deprecated, filter feature is automatically enabled from GoFrame v1.16.0, it is so no longer used.
  248. func (d *TrainSaleApplyDao) Filter() *TrainSaleApplyDao {
  249. return &TrainSaleApplyDao{M: d.M.Filter(), Table: d.Table, TableAs: d.TableAs}
  250. }
  251. // Where sets the condition statement for the model. The parameter <where> can be type of
  252. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  253. // multiple conditions will be joined into where statement using "AND".
  254. // Eg:
  255. // Where("uid=10000")
  256. // Where("uid", 10000)
  257. // Where("money>? AND name like ?", 99999, "vip_%")
  258. // Where("uid", 1).Where("name", "john")
  259. // Where("status IN (?)", g.Slice{1,2,3})
  260. // Where("age IN(?,?)", 18, 50)
  261. // Where(User{ Id : 1, UserName : "john"})
  262. func (d *TrainSaleApplyDao) Where(where interface{}, args ...interface{}) *TrainSaleApplyDao {
  263. return &TrainSaleApplyDao{M: d.M.Where(where, args...), Table: d.Table, TableAs: d.TableAs}
  264. }
  265. // WherePri does the same logic as M.Where except that if the parameter <where>
  266. // is a single condition like int/string/float/slice, it treats the condition as the primary
  267. // key value. That is, if primary key is "id" and given <where> parameter as "123", the
  268. // WherePri function treats the condition as "id=123", but M.Where treats the condition
  269. // as string "123".
  270. func (d *TrainSaleApplyDao) WherePri(where interface{}, args ...interface{}) *TrainSaleApplyDao {
  271. return &TrainSaleApplyDao{M: d.M.WherePri(where, args...), Table: d.Table, TableAs: d.TableAs}
  272. }
  273. // Having sets the having statement for the model.
  274. // The parameters of this function usage are as the same as function Where.
  275. // See Where.
  276. func (d *TrainSaleApplyDao) Having(having interface{}, args ...interface{}) *TrainSaleApplyDao {
  277. return &TrainSaleApplyDao{M: d.M.Having(having, args...), Table: d.Table, TableAs: d.TableAs}
  278. }
  279. // Wheref builds condition string using fmt.Sprintf and arguments.
  280. // Note that if the number of "args" is more than the place holder in "format",
  281. // the extra "args" will be used as the where condition arguments of the Model.
  282. func (d *TrainSaleApplyDao) Wheref(format string, args ...interface{}) *TrainSaleApplyDao {
  283. return &TrainSaleApplyDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
  284. }
  285. // WhereLT builds "column < value" statement.
  286. func (d *TrainSaleApplyDao) WhereLT(column string, value interface{}) *TrainSaleApplyDao {
  287. return &TrainSaleApplyDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
  288. }
  289. // WhereLTE builds "column <= value" statement.
  290. func (d *TrainSaleApplyDao) WhereLTE(column string, value interface{}) *TrainSaleApplyDao {
  291. return &TrainSaleApplyDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
  292. }
  293. // WhereGT builds "column > value" statement.
  294. func (d *TrainSaleApplyDao) WhereGT(column string, value interface{}) *TrainSaleApplyDao {
  295. return &TrainSaleApplyDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
  296. }
  297. // WhereGTE builds "column >= value" statement.
  298. func (d *TrainSaleApplyDao) WhereGTE(column string, value interface{}) *TrainSaleApplyDao {
  299. return &TrainSaleApplyDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
  300. }
  301. // WhereBetween builds "column BETWEEN min AND max" statement.
  302. func (d *TrainSaleApplyDao) WhereBetween(column string, min, max interface{}) *TrainSaleApplyDao {
  303. return &TrainSaleApplyDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  304. }
  305. // WhereLike builds "column LIKE like" statement.
  306. func (d *TrainSaleApplyDao) WhereLike(column string, like interface{}) *TrainSaleApplyDao {
  307. return &TrainSaleApplyDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
  308. }
  309. // WhereIn builds "column IN (in)" statement.
  310. func (d *TrainSaleApplyDao) WhereIn(column string, in interface{}) *TrainSaleApplyDao {
  311. return &TrainSaleApplyDao{M: d.M.WhereIn(column, in), Table: d.Table, TableAs: d.TableAs}
  312. }
  313. // WhereNull builds "columns[0] IS NULL AND columns[1] IS NULL ..." statement.
  314. func (d *TrainSaleApplyDao) WhereNull(columns ...string) *TrainSaleApplyDao {
  315. return &TrainSaleApplyDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
  316. }
  317. // WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
  318. func (d *TrainSaleApplyDao) WhereNotBetween(column string, min, max interface{}) *TrainSaleApplyDao {
  319. return &TrainSaleApplyDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  320. }
  321. // WhereNotLike builds "column NOT LIKE like" statement.
  322. func (d *TrainSaleApplyDao) WhereNotLike(column string, like interface{}) *TrainSaleApplyDao {
  323. return &TrainSaleApplyDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
  324. }
  325. // WhereNot builds "column != value" statement.
  326. func (d *TrainSaleApplyDao) WhereNot(column string, value interface{}) *TrainSaleApplyDao {
  327. return &TrainSaleApplyDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
  328. }
  329. // WhereNotIn builds "column NOT IN (in)" statement.
  330. func (d *TrainSaleApplyDao) WhereNotIn(column string, in interface{}) *TrainSaleApplyDao {
  331. return &TrainSaleApplyDao{M: d.M.WhereNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
  332. }
  333. // WhereNotNull builds "columns[0] IS NOT NULL AND columns[1] IS NOT NULL ..." statement.
  334. func (d *TrainSaleApplyDao) WhereNotNull(columns ...string) *TrainSaleApplyDao {
  335. return &TrainSaleApplyDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
  336. }
  337. // WhereOr adds "OR" condition to the where statement.
  338. func (d *TrainSaleApplyDao) WhereOr(where interface{}, args ...interface{}) *TrainSaleApplyDao {
  339. return &TrainSaleApplyDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
  340. }
  341. // WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
  342. func (d *TrainSaleApplyDao) WhereOrf(format string, args ...interface{}) *TrainSaleApplyDao {
  343. return &TrainSaleApplyDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
  344. }
  345. // WhereOrLT builds "column < value" statement in "OR" conditions..
  346. func (d *TrainSaleApplyDao) WhereOrLT(column string, value interface{}) *TrainSaleApplyDao {
  347. return &TrainSaleApplyDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
  348. }
  349. // WhereOrLTE builds "column <= value" statement in "OR" conditions..
  350. func (d *TrainSaleApplyDao) WhereOrLTE(column string, value interface{}) *TrainSaleApplyDao {
  351. return &TrainSaleApplyDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
  352. }
  353. // WhereOrGT builds "column > value" statement in "OR" conditions..
  354. func (d *TrainSaleApplyDao) WhereOrGT(column string, value interface{}) *TrainSaleApplyDao {
  355. return &TrainSaleApplyDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
  356. }
  357. // WhereOrGTE builds "column >= value" statement in "OR" conditions..
  358. func (d *TrainSaleApplyDao) WhereOrGTE(column string, value interface{}) *TrainSaleApplyDao {
  359. return &TrainSaleApplyDao{M: d.M.WhereOrGTE(column, value), Table: d.Table, TableAs: d.TableAs}
  360. }
  361. // WhereOrBetween builds "column BETWEEN min AND max" statement in "OR" conditions.
  362. func (d *TrainSaleApplyDao) WhereOrBetween(column string, min, max interface{}) *TrainSaleApplyDao {
  363. return &TrainSaleApplyDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  364. }
  365. // WhereOrLike builds "column LIKE like" statement in "OR" conditions.
  366. func (d *TrainSaleApplyDao) WhereOrLike(column string, like interface{}) *TrainSaleApplyDao {
  367. return &TrainSaleApplyDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
  368. }
  369. // WhereOrIn builds "column IN (in)" statement in "OR" conditions.
  370. func (d *TrainSaleApplyDao) WhereOrIn(column string, in interface{}) *TrainSaleApplyDao {
  371. return &TrainSaleApplyDao{M: d.M.WhereOrIn(column, in), Table: d.Table, TableAs: d.TableAs}
  372. }
  373. // WhereOrNull builds "columns[0] IS NULL OR columns[1] IS NULL ..." statement in "OR" conditions.
  374. func (d *TrainSaleApplyDao) WhereOrNull(columns ...string) *TrainSaleApplyDao {
  375. return &TrainSaleApplyDao{M: d.M.WhereOrNull(columns...), Table: d.Table, TableAs: d.TableAs}
  376. }
  377. // WhereOrNotBetween builds "column NOT BETWEEN min AND max" statement in "OR" conditions.
  378. func (d *TrainSaleApplyDao) WhereOrNotBetween(column string, min, max interface{}) *TrainSaleApplyDao {
  379. return &TrainSaleApplyDao{M: d.M.WhereOrNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
  380. }
  381. // WhereOrNotLike builds "column NOT LIKE like" statement in "OR" conditions.
  382. func (d *TrainSaleApplyDao) WhereOrNotLike(column string, like interface{}) *TrainSaleApplyDao {
  383. return &TrainSaleApplyDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
  384. }
  385. // WhereOrNotIn builds "column NOT IN (in)" statement.
  386. func (d *TrainSaleApplyDao) WhereOrNotIn(column string, in interface{}) *TrainSaleApplyDao {
  387. return &TrainSaleApplyDao{M: d.M.WhereOrNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
  388. }
  389. // WhereOrNotNull builds "columns[0] IS NOT NULL OR columns[1] IS NOT NULL ..." statement in "OR" conditions.
  390. func (d *TrainSaleApplyDao) WhereOrNotNull(columns ...string) *TrainSaleApplyDao {
  391. return &TrainSaleApplyDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
  392. }
  393. // Group sets the "GROUP BY" statement for the model.
  394. func (d *TrainSaleApplyDao) Group(groupBy ...string) *TrainSaleApplyDao {
  395. return &TrainSaleApplyDao{M: d.M.Group(groupBy...), Table: d.Table, TableAs: d.TableAs}
  396. }
  397. // And adds "AND" condition to the where statement.
  398. // Deprecated, use Where instead.
  399. func (d *TrainSaleApplyDao) And(where interface{}, args ...interface{}) *TrainSaleApplyDao {
  400. return &TrainSaleApplyDao{M: d.M.And(where, args...), Table: d.Table, TableAs: d.TableAs}
  401. }
  402. // Or adds "OR" condition to the where statement.
  403. // Deprecated, use WhereOr instead.
  404. func (d *TrainSaleApplyDao) Or(where interface{}, args ...interface{}) *TrainSaleApplyDao {
  405. return &TrainSaleApplyDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
  406. }
  407. // GroupBy sets the "GROUP BY" statement for the model.
  408. func (d *TrainSaleApplyDao) GroupBy(groupBy string) *TrainSaleApplyDao {
  409. return &TrainSaleApplyDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
  410. }
  411. // Order sets the "ORDER BY" statement for the model.
  412. func (d *TrainSaleApplyDao) Order(orderBy ...string) *TrainSaleApplyDao {
  413. return &TrainSaleApplyDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
  414. }
  415. // OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
  416. func (d *TrainSaleApplyDao) OrderAsc(column string) *TrainSaleApplyDao {
  417. return &TrainSaleApplyDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
  418. }
  419. // OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
  420. func (d *TrainSaleApplyDao) OrderDesc(column string) *TrainSaleApplyDao {
  421. return &TrainSaleApplyDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
  422. }
  423. // OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
  424. func (d *TrainSaleApplyDao) OrderRandom() *TrainSaleApplyDao {
  425. return &TrainSaleApplyDao{M: d.M.OrderRandom(), Table: d.Table, TableAs: d.TableAs}
  426. }
  427. // OrderBy is alias of Model.Order.
  428. // See Model.Order.
  429. // Deprecated, use Order instead.
  430. func (d *TrainSaleApplyDao) OrderBy(orderBy string) *TrainSaleApplyDao {
  431. return &TrainSaleApplyDao{M: d.M.Order(orderBy), Table: d.Table, TableAs: d.TableAs}
  432. }
  433. // Limit sets the "LIMIT" statement for the model.
  434. // The parameter <limit> can be either one or two number, if passed two number is passed,
  435. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  436. // statement.
  437. func (d *TrainSaleApplyDao) Limit(limit ...int) *TrainSaleApplyDao {
  438. return &TrainSaleApplyDao{M: d.M.Limit(limit...), Table: d.Table, TableAs: d.TableAs}
  439. }
  440. // Offset sets the "OFFSET" statement for the model.
  441. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  442. func (d *TrainSaleApplyDao) Offset(offset int) *TrainSaleApplyDao {
  443. return &TrainSaleApplyDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
  444. }
  445. // Distinct forces the query to only return distinct results.
  446. func (d *TrainSaleApplyDao) Distinct() *TrainSaleApplyDao {
  447. return &TrainSaleApplyDao{M: d.M.Distinct(), Table: d.Table, TableAs: d.TableAs}
  448. }
  449. // Page sets the paging number for the model.
  450. // The parameter <page> is started from 1 for paging.
  451. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  452. func (d *TrainSaleApplyDao) Page(page, limit int) *TrainSaleApplyDao {
  453. return &TrainSaleApplyDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
  454. }
  455. // Batch sets the batch operation number for the model.
  456. func (d *TrainSaleApplyDao) Batch(batch int) *TrainSaleApplyDao {
  457. return &TrainSaleApplyDao{M: d.M.Batch(batch), Table: d.Table, TableAs: d.TableAs}
  458. }
  459. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  460. // if there's another same sql request, it just reads and returns the result from cache, it
  461. // but not committed and executed into the database.
  462. //
  463. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  464. // If the parameter <duration> = 0, which means it never expires.
  465. // If the parameter <duration> > 0, which means it expires after <duration>.
  466. //
  467. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  468. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  469. //
  470. // Note that, the cache feature is disabled if the model is operating on a transaction.
  471. func (d *TrainSaleApplyDao) Cache(duration time.Duration, name ...string) *TrainSaleApplyDao {
  472. return &TrainSaleApplyDao{M: d.M.Cache(duration, name...), Table: d.Table, TableAs: d.TableAs}
  473. }
  474. // Data sets the operation data for the model.
  475. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  476. // Eg:
  477. // Data("uid=10000")
  478. // Data("uid", 10000)
  479. // Data(g.Map{"uid": 10000, "name":"john"})
  480. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  481. func (d *TrainSaleApplyDao) Data(data ...interface{}) *TrainSaleApplyDao {
  482. return &TrainSaleApplyDao{M: d.M.Data(data...), Table: d.Table, TableAs: d.TableAs}
  483. }
  484. // All does "SELECT FROM ..." statement for the model.
  485. // It retrieves the records from table and returns the result as []*model.TrainSaleApply.
  486. // It returns nil if there's no record retrieved with the given conditions from table.
  487. //
  488. // The optional parameter <where> is the same as the parameter of M.Where function,
  489. // see M.Where.
  490. func (d *TrainSaleApplyDao) All(where ...interface{}) ([]*model.TrainSaleApply, error) {
  491. all, err := d.M.All(where...)
  492. if err != nil {
  493. return nil, err
  494. }
  495. var entities []*model.TrainSaleApply
  496. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  497. return nil, err
  498. }
  499. return entities, nil
  500. }
  501. // One retrieves one record from table and returns the result as *model.TrainSaleApply.
  502. // It returns nil if there's no record retrieved with the given conditions from table.
  503. //
  504. // The optional parameter <where> is the same as the parameter of M.Where function,
  505. // see M.Where.
  506. func (d *TrainSaleApplyDao) One(where ...interface{}) (*model.TrainSaleApply, error) {
  507. one, err := d.M.One(where...)
  508. if err != nil {
  509. return nil, err
  510. }
  511. var entity *model.TrainSaleApply
  512. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  513. return nil, err
  514. }
  515. return entity, nil
  516. }
  517. // FindOne retrieves and returns a single Record by M.WherePri and M.One.
  518. // Also see M.WherePri and M.One.
  519. func (d *TrainSaleApplyDao) FindOne(where ...interface{}) (*model.TrainSaleApply, error) {
  520. one, err := d.M.FindOne(where...)
  521. if err != nil {
  522. return nil, err
  523. }
  524. var entity *model.TrainSaleApply
  525. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  526. return nil, err
  527. }
  528. return entity, nil
  529. }
  530. // FindAll retrieves and returns Result by by M.WherePri and M.All.
  531. // Also see M.WherePri and M.All.
  532. func (d *TrainSaleApplyDao) FindAll(where ...interface{}) ([]*model.TrainSaleApply, error) {
  533. all, err := d.M.FindAll(where...)
  534. if err != nil {
  535. return nil, err
  536. }
  537. var entities []*model.TrainSaleApply
  538. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  539. return nil, err
  540. }
  541. return entities, nil
  542. }
  543. // Struct retrieves one record from table and converts it into given struct.
  544. // The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
  545. // it can create the struct internally during converting.
  546. //
  547. // The optional parameter <where> is the same as the parameter of Model.Where function,
  548. // see Model.Where.
  549. //
  550. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  551. // from table and <pointer> is not nil.
  552. //
  553. // Eg:
  554. // user := new(User)
  555. // err := dao.User.Where("id", 1).Struct(user)
  556. //
  557. // user := (*User)(nil)
  558. // err := dao.User.Where("id", 1).Struct(&user)
  559. func (d *TrainSaleApplyDao) Struct(pointer interface{}, where ...interface{}) error {
  560. return d.M.Struct(pointer, where...)
  561. }
  562. // Structs retrieves records from table and converts them into given struct slice.
  563. // The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
  564. // slice internally during converting.
  565. //
  566. // The optional parameter <where> is the same as the parameter of Model.Where function,
  567. // see Model.Where.
  568. //
  569. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  570. // from table and <pointer> is not empty.
  571. //
  572. // Eg:
  573. // users := ([]User)(nil)
  574. // err := dao.User.Structs(&users)
  575. //
  576. // users := ([]*User)(nil)
  577. // err := dao.User.Structs(&users)
  578. func (d *TrainSaleApplyDao) Structs(pointer interface{}, where ...interface{}) error {
  579. return d.M.Structs(pointer, where...)
  580. }
  581. // Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
  582. // It calls function Struct if <pointer> is type of *struct/**struct.
  583. // It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
  584. //
  585. // The optional parameter <where> is the same as the parameter of Model.Where function,
  586. // see Model.Where.
  587. //
  588. // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
  589. //
  590. // Eg:
  591. // user := new(User)
  592. // err := dao.User.Where("id", 1).Scan(user)
  593. //
  594. // user := (*User)(nil)
  595. // err := dao.User.Where("id", 1).Scan(&user)
  596. //
  597. // users := ([]User)(nil)
  598. // err := dao.User.Scan(&users)
  599. //
  600. // users := ([]*User)(nil)
  601. // err := dao.User.Scan(&users)
  602. func (d *TrainSaleApplyDao) Scan(pointer interface{}, where ...interface{}) error {
  603. return d.M.Scan(pointer, where...)
  604. }
  605. // Chunk iterates the table with given size and callback function.
  606. func (d *TrainSaleApplyDao) Chunk(limit int, callback func(entities []*model.TrainSaleApply, err error) bool) {
  607. d.M.Chunk(limit, func(result gdb.Result, err error) bool {
  608. var entities []*model.TrainSaleApply
  609. err = result.Structs(&entities)
  610. if err == sql.ErrNoRows {
  611. return false
  612. }
  613. return callback(entities, err)
  614. })
  615. }
  616. // LockUpdate sets the lock for update for current operation.
  617. func (d *TrainSaleApplyDao) LockUpdate() *TrainSaleApplyDao {
  618. return &TrainSaleApplyDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
  619. }
  620. // LockShared sets the lock in share mode for current operation.
  621. func (d *TrainSaleApplyDao) LockShared() *TrainSaleApplyDao {
  622. return &TrainSaleApplyDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
  623. }
  624. // Unscoped enables/disables the soft deleting feature.
  625. func (d *TrainSaleApplyDao) Unscoped() *TrainSaleApplyDao {
  626. return &TrainSaleApplyDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
  627. }