run_process_model.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package wf_run_process
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. "github.com/gogf/gf/frame/gmvc"
  10. "time"
  11. )
  12. // arModel is a active record design model for table wf_run_process operations.
  13. type arModel struct {
  14. gmvc.M
  15. }
  16. var (
  17. // Table is the table name of wf_run_process.
  18. Table = "wf_run_process"
  19. // Model is the model object of wf_run_process.
  20. Model = &arModel{g.DB("default").Table(Table).Safe()}
  21. // Columns defines and stores column names for table wf_run_process.
  22. Columns = struct {
  23. Id string //
  24. Uid string //
  25. RunId string // 当前流转id
  26. RunFlow string // 属于那个流程的id
  27. RunFlowProcess string // 当前步骤编号
  28. ParentFlow string // 上一步流程
  29. ParentFlowProcess string // 上一步骤号
  30. RunChild string // 开始转入子流程run_id 如果转入子流程,则在这里也记录
  31. Remark string // 备注
  32. IsReceiveType string // 是否先接收人为主办人
  33. AutoPerson string //
  34. SponsorText string //
  35. SponsorIds string //
  36. IsSponsor string // 是否步骤主办人 0否(默认) 1是
  37. IsSingpost string // 是否已会签过
  38. IsBack string // 被退回的 0否(默认) 1是
  39. Status string // 状态 0为未接收(默认),1为办理中 ,2为已转交,3为已结束4为已打回
  40. JsTime string // 接收时间
  41. BlTime string // 办理时间
  42. JjTime string // 转交时间,最后一步等同办结时间
  43. IsDel string //
  44. Updatetime string //
  45. Dateline string //
  46. WfMode string //
  47. WfAction string //
  48. }{
  49. Id: "id",
  50. Uid: "uid",
  51. RunId: "run_id",
  52. RunFlow: "run_flow",
  53. RunFlowProcess: "run_flow_process",
  54. ParentFlow: "parent_flow",
  55. ParentFlowProcess: "parent_flow_process",
  56. RunChild: "run_child",
  57. Remark: "remark",
  58. IsReceiveType: "is_receive_type",
  59. AutoPerson: "auto_person",
  60. SponsorText: "sponsor_text",
  61. SponsorIds: "sponsor_ids",
  62. IsSponsor: "is_sponsor",
  63. IsSingpost: "is_singpost",
  64. IsBack: "is_back",
  65. Status: "status",
  66. JsTime: "js_time",
  67. BlTime: "bl_time",
  68. JjTime: "jj_time",
  69. IsDel: "is_del",
  70. Updatetime: "updatetime",
  71. Dateline: "dateline",
  72. WfMode: "wf_mode",
  73. WfAction: "wf_action",
  74. }
  75. )
  76. // FindOne is a convenience method for Model.FindOne.
  77. // See Model.FindOne.
  78. func FindOne(where ...interface{}) (*Entity, error) {
  79. return Model.FindOne(where...)
  80. }
  81. // FindAll is a convenience method for Model.FindAll.
  82. // See Model.FindAll.
  83. func FindAll(where ...interface{}) ([]*Entity, error) {
  84. return Model.FindAll(where...)
  85. }
  86. // FindValue is a convenience method for Model.FindValue.
  87. // See Model.FindValue.
  88. func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) {
  89. return Model.FindValue(fieldsAndWhere...)
  90. }
  91. // FindArray is a convenience method for Model.FindArray.
  92. // See Model.FindArray.
  93. func FindArray(fieldsAndWhere ...interface{}) ([]gdb.Value, error) {
  94. return Model.FindArray(fieldsAndWhere...)
  95. }
  96. // FindCount is a convenience method for Model.FindCount.
  97. // See Model.FindCount.
  98. func FindCount(where ...interface{}) (int, error) {
  99. return Model.FindCount(where...)
  100. }
  101. // Insert is a convenience method for Model.Insert.
  102. func Insert(data ...interface{}) (result sql.Result, err error) {
  103. return Model.Insert(data...)
  104. }
  105. // InsertIgnore is a convenience method for Model.InsertIgnore.
  106. func InsertIgnore(data ...interface{}) (result sql.Result, err error) {
  107. return Model.InsertIgnore(data...)
  108. }
  109. // Replace is a convenience method for Model.Replace.
  110. func Replace(data ...interface{}) (result sql.Result, err error) {
  111. return Model.Replace(data...)
  112. }
  113. // Save is a convenience method for Model.Save.
  114. func Save(data ...interface{}) (result sql.Result, err error) {
  115. return Model.Save(data...)
  116. }
  117. // Update is a convenience method for Model.Update.
  118. func Update(dataAndWhere ...interface{}) (result sql.Result, err error) {
  119. return Model.Update(dataAndWhere...)
  120. }
  121. // Delete is a convenience method for Model.Delete.
  122. func Delete(where ...interface{}) (result sql.Result, err error) {
  123. return Model.Delete(where...)
  124. }
  125. // As sets an alias name for current table.
  126. func (m *arModel) As(as string) *arModel {
  127. return &arModel{m.M.As(as)}
  128. }
  129. // TX sets the transaction for current operation.
  130. func (m *arModel) TX(tx *gdb.TX) *arModel {
  131. return &arModel{m.M.TX(tx)}
  132. }
  133. // Master marks the following operation on master node.
  134. func (m *arModel) Master() *arModel {
  135. return &arModel{m.M.Master()}
  136. }
  137. // Slave marks the following operation on slave node.
  138. // Note that it makes sense only if there's any slave node configured.
  139. func (m *arModel) Slave() *arModel {
  140. return &arModel{m.M.Slave()}
  141. }
  142. // LeftJoin does "LEFT 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").LeftJoin("user_detail", "user_detail.uid=user.uid")
  146. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  147. func (m *arModel) LeftJoin(table ...string) *arModel {
  148. return &arModel{m.M.LeftJoin(table...)}
  149. }
  150. // RightJoin does "RIGHT 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").RightJoin("user_detail", "user_detail.uid=user.uid")
  154. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  155. func (m *arModel) RightJoin(table ...string) *arModel {
  156. return &arModel{m.M.RightJoin(table...)}
  157. }
  158. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  159. // The parameter <table> can be joined table and its joined condition,
  160. // and also with its alias name, like:
  161. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  162. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  163. func (m *arModel) InnerJoin(table ...string) *arModel {
  164. return &arModel{m.M.InnerJoin(table...)}
  165. }
  166. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  167. func (m *arModel) Fields(fields string) *arModel {
  168. return &arModel{m.M.Fields(fields)}
  169. }
  170. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  171. func (m *arModel) FieldsEx(fields string) *arModel {
  172. return &arModel{m.M.FieldsEx(fields)}
  173. }
  174. // Option sets the extra operation option for the model.
  175. func (m *arModel) Option(option int) *arModel {
  176. return &arModel{m.M.Option(option)}
  177. }
  178. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  179. // the data and where attributes for empty values.
  180. func (m *arModel) OmitEmpty() *arModel {
  181. return &arModel{m.M.OmitEmpty()}
  182. }
  183. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  184. func (m *arModel) Filter() *arModel {
  185. return &arModel{m.M.Filter()}
  186. }
  187. // Where sets the condition statement for the model. The parameter <where> can be type of
  188. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  189. // multiple conditions will be joined into where statement using "AND".
  190. // Eg:
  191. // Where("uid=10000")
  192. // Where("uid", 10000)
  193. // Where("money>? AND name like ?", 99999, "vip_%")
  194. // Where("uid", 1).Where("name", "john")
  195. // Where("status IN (?)", g.Slice{1,2,3})
  196. // Where("age IN(?,?)", 18, 50)
  197. // Where(User{ Id : 1, UserName : "john"})
  198. func (m *arModel) Where(where interface{}, args ...interface{}) *arModel {
  199. return &arModel{m.M.Where(where, args...)}
  200. }
  201. // And adds "AND" condition to the where statement.
  202. func (m *arModel) And(where interface{}, args ...interface{}) *arModel {
  203. return &arModel{m.M.And(where, args...)}
  204. }
  205. // Or adds "OR" condition to the where statement.
  206. func (m *arModel) Or(where interface{}, args ...interface{}) *arModel {
  207. return &arModel{m.M.Or(where, args...)}
  208. }
  209. // Group sets the "GROUP BY" statement for the model.
  210. func (m *arModel) Group(groupBy string) *arModel {
  211. return &arModel{m.M.Group(groupBy)}
  212. }
  213. // Order sets the "ORDER BY" statement for the model.
  214. func (m *arModel) Order(orderBy ...string) *arModel {
  215. return &arModel{m.M.Order(orderBy...)}
  216. }
  217. // Limit sets the "LIMIT" statement for the model.
  218. // The parameter <limit> can be either one or two number, if passed two number is passed,
  219. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  220. // statement.
  221. func (m *arModel) Limit(limit ...int) *arModel {
  222. return &arModel{m.M.Limit(limit...)}
  223. }
  224. // Offset sets the "OFFSET" statement for the model.
  225. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  226. func (m *arModel) Offset(offset int) *arModel {
  227. return &arModel{m.M.Offset(offset)}
  228. }
  229. // Page sets the paging number for the model.
  230. // The parameter <page> is started from 1 for paging.
  231. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  232. func (m *arModel) Page(page, limit int) *arModel {
  233. return &arModel{m.M.Page(page, limit)}
  234. }
  235. // Batch sets the batch operation number for the model.
  236. func (m *arModel) Batch(batch int) *arModel {
  237. return &arModel{m.M.Batch(batch)}
  238. }
  239. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  240. // if there's another same sql request, it just reads and returns the result from cache, it
  241. // but not committed and executed into the database.
  242. //
  243. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  244. // If the parameter <duration> = 0, which means it never expires.
  245. // If the parameter <duration> > 0, which means it expires after <duration>.
  246. //
  247. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  248. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  249. //
  250. // Note that, the cache feature is disabled if the model is operating on a transaction.
  251. func (m *arModel) Cache(duration time.Duration, name ...string) *arModel {
  252. return &arModel{m.M.Cache(duration, name...)}
  253. }
  254. // Data sets the operation data for the model.
  255. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  256. // Eg:
  257. // Data("uid=10000")
  258. // Data("uid", 10000)
  259. // Data(g.Map{"uid": 10000, "name":"john"})
  260. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  261. func (m *arModel) Data(data ...interface{}) *arModel {
  262. return &arModel{m.M.Data(data...)}
  263. }
  264. // All does "SELECT FROM ..." statement for the model.
  265. // It retrieves the records from table and returns the result as []*Entity.
  266. // It returns nil if there's no record retrieved with the given conditions from table.
  267. //
  268. // The optional parameter <where> is the same as the parameter of Model.Where function,
  269. // see Model.Where.
  270. func (m *arModel) All(where ...interface{}) ([]*Entity, error) {
  271. all, err := m.M.All(where...)
  272. if err != nil {
  273. return nil, err
  274. }
  275. var entities []*Entity
  276. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  277. return nil, err
  278. }
  279. return entities, nil
  280. }
  281. // One retrieves one record from table and returns the result as *Entity.
  282. // It returns nil if there's no record retrieved with the given conditions from table.
  283. //
  284. // The optional parameter <where> is the same as the parameter of Model.Where function,
  285. // see Model.Where.
  286. func (m *arModel) One(where ...interface{}) (*Entity, error) {
  287. one, err := m.M.One(where...)
  288. if err != nil {
  289. return nil, err
  290. }
  291. var entity *Entity
  292. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  293. return nil, err
  294. }
  295. return entity, nil
  296. }
  297. // FindOne retrieves and returns a single Record by Model.WherePri and Model.One.
  298. // Also see Model.WherePri and Model.One.
  299. func (m *arModel) FindOne(where ...interface{}) (*Entity, error) {
  300. one, err := m.M.FindOne(where...)
  301. if err != nil {
  302. return nil, err
  303. }
  304. var entity *Entity
  305. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  306. return nil, err
  307. }
  308. return entity, nil
  309. }
  310. // FindAll retrieves and returns Result by by Model.WherePri and Model.All.
  311. // Also see Model.WherePri and Model.All.
  312. func (m *arModel) FindAll(where ...interface{}) ([]*Entity, error) {
  313. all, err := m.M.FindAll(where...)
  314. if err != nil {
  315. return nil, err
  316. }
  317. var entities []*Entity
  318. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  319. return nil, err
  320. }
  321. return entities, nil
  322. }
  323. // Chunk iterates the table with given size and callback function.
  324. func (m *arModel) Chunk(limit int, callback func(entities []*Entity, err error) bool) {
  325. m.M.Chunk(limit, func(result gdb.Result, err error) bool {
  326. var entities []*Entity
  327. err = result.Structs(&entities)
  328. if err == sql.ErrNoRows {
  329. return false
  330. }
  331. return callback(entities, err)
  332. })
  333. }
  334. // LockUpdate sets the lock for update for current operation.
  335. func (m *arModel) LockUpdate() *arModel {
  336. return &arModel{m.M.LockUpdate()}
  337. }
  338. // LockShared sets the lock in share mode for current operation.
  339. func (m *arModel) LockShared() *arModel {
  340. return &arModel{m.M.LockShared()}
  341. }
  342. // Unscoped enables/disables the soft deleting feature.
  343. func (m *arModel) Unscoped() *arModel {
  344. return &arModel{m.M.Unscoped()}
  345. }