flow_process_model.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package wf_flow_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_flow_process operations.
  13. type arModel struct {
  14. gmvc.M
  15. }
  16. var (
  17. // Table is the table name of wf_flow_process.
  18. Table = "wf_flow_process"
  19. // Model is the model object of wf_flow_process.
  20. Model = &arModel{g.DB("default").Table(Table).Safe()}
  21. // Columns defines and stores column names for table wf_flow_process.
  22. Columns = struct {
  23. Id string //
  24. FlowId string // 流程ID
  25. ProcessName string // 步骤名称
  26. ProcessType string // 步骤类型
  27. ProcessTo string // 转交下一步骤号
  28. AutoPerson string // 3自由选择|4指定人员|5指定角色|6事务接受
  29. AutoSponsorIds string // 4指定步骤主办人ids
  30. AutoSponsorText string // 4指定步骤主办人text
  31. WorkIds string // 6事务接受
  32. WorkText string // 6事务接受
  33. AutoRoleIds string // 5角色ids
  34. AutoRoleText string // 5角色 text
  35. RangeUserIds string // 3自由选择IDS
  36. RangeUserText string // 3自由选择用户ID
  37. IsSing string // 1允许|2不允许
  38. IsBack string // 1允许|2不允许
  39. OutCondition string // 转出条件
  40. Setleft string // 左 坐标
  41. Settop string // 上 坐标
  42. Style string // 样式 序列化
  43. IsDel string //
  44. Updatetime string // 更新时间
  45. Dateline string //
  46. WfMode string // 0 单一线性,1,转出条件 2,同步模式
  47. WfAction string // 对应方法
  48. WorkSql string //
  49. WorkMsg string //
  50. }{
  51. Id: "id",
  52. FlowId: "flow_id",
  53. ProcessName: "process_name",
  54. ProcessType: "process_type",
  55. ProcessTo: "process_to",
  56. AutoPerson: "auto_person",
  57. AutoSponsorIds: "auto_sponsor_ids",
  58. AutoSponsorText: "auto_sponsor_text",
  59. WorkIds: "work_ids",
  60. WorkText: "work_text",
  61. AutoRoleIds: "auto_role_ids",
  62. AutoRoleText: "auto_role_text",
  63. RangeUserIds: "range_user_ids",
  64. RangeUserText: "range_user_text",
  65. IsSing: "is_sing",
  66. IsBack: "is_back",
  67. OutCondition: "out_condition",
  68. Setleft: "setleft",
  69. Settop: "settop",
  70. Style: "style",
  71. IsDel: "is_del",
  72. Updatetime: "updatetime",
  73. Dateline: "dateline",
  74. WfMode: "wf_mode",
  75. WfAction: "wf_action",
  76. WorkSql: "work_sql",
  77. WorkMsg: "work_msg",
  78. }
  79. )
  80. // FindOne is a convenience method for Model.FindOne.
  81. // See Model.FindOne.
  82. func FindOne(where ...interface{}) (*Entity, error) {
  83. return Model.FindOne(where...)
  84. }
  85. // FindAll is a convenience method for Model.FindAll.
  86. // See Model.FindAll.
  87. func FindAll(where ...interface{}) ([]*Entity, error) {
  88. return Model.FindAll(where...)
  89. }
  90. // FindValue is a convenience method for Model.FindValue.
  91. // See Model.FindValue.
  92. func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) {
  93. return Model.FindValue(fieldsAndWhere...)
  94. }
  95. // FindArray is a convenience method for Model.FindArray.
  96. // See Model.FindArray.
  97. func FindArray(fieldsAndWhere ...interface{}) ([]gdb.Value, error) {
  98. return Model.FindArray(fieldsAndWhere...)
  99. }
  100. // FindCount is a convenience method for Model.FindCount.
  101. // See Model.FindCount.
  102. func FindCount(where ...interface{}) (int, error) {
  103. return Model.FindCount(where...)
  104. }
  105. // Insert is a convenience method for Model.Insert.
  106. func Insert(data ...interface{}) (result sql.Result, err error) {
  107. return Model.Insert(data...)
  108. }
  109. // InsertIgnore is a convenience method for Model.InsertIgnore.
  110. func InsertIgnore(data ...interface{}) (result sql.Result, err error) {
  111. return Model.InsertIgnore(data...)
  112. }
  113. // Replace is a convenience method for Model.Replace.
  114. func Replace(data ...interface{}) (result sql.Result, err error) {
  115. return Model.Replace(data...)
  116. }
  117. // Save is a convenience method for Model.Save.
  118. func Save(data ...interface{}) (result sql.Result, err error) {
  119. return Model.Save(data...)
  120. }
  121. // Update is a convenience method for Model.Update.
  122. func Update(dataAndWhere ...interface{}) (result sql.Result, err error) {
  123. return Model.Update(dataAndWhere...)
  124. }
  125. // Delete is a convenience method for Model.Delete.
  126. func Delete(where ...interface{}) (result sql.Result, err error) {
  127. return Model.Delete(where...)
  128. }
  129. // As sets an alias name for current table.
  130. func (m *arModel) As(as string) *arModel {
  131. return &arModel{m.M.As(as)}
  132. }
  133. // TX sets the transaction for current operation.
  134. func (m *arModel) TX(tx *gdb.TX) *arModel {
  135. return &arModel{m.M.TX(tx)}
  136. }
  137. // Master marks the following operation on master node.
  138. func (m *arModel) Master() *arModel {
  139. return &arModel{m.M.Master()}
  140. }
  141. // Slave marks the following operation on slave node.
  142. // Note that it makes sense only if there's any slave node configured.
  143. func (m *arModel) Slave() *arModel {
  144. return &arModel{m.M.Slave()}
  145. }
  146. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  147. // The parameter <table> can be joined table and its joined condition,
  148. // and also with its alias name, like:
  149. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  150. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  151. func (m *arModel) LeftJoin(table ...string) *arModel {
  152. return &arModel{m.M.LeftJoin(table...)}
  153. }
  154. // RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
  155. // The parameter <table> can be joined table and its joined condition,
  156. // and also with its alias name, like:
  157. // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
  158. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  159. func (m *arModel) RightJoin(table ...string) *arModel {
  160. return &arModel{m.M.RightJoin(table...)}
  161. }
  162. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  163. // The parameter <table> can be joined table and its joined condition,
  164. // and also with its alias name, like:
  165. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  166. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  167. func (m *arModel) InnerJoin(table ...string) *arModel {
  168. return &arModel{m.M.InnerJoin(table...)}
  169. }
  170. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  171. func (m *arModel) Fields(fields string) *arModel {
  172. return &arModel{m.M.Fields(fields)}
  173. }
  174. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  175. func (m *arModel) FieldsEx(fields string) *arModel {
  176. return &arModel{m.M.FieldsEx(fields)}
  177. }
  178. // Option sets the extra operation option for the model.
  179. func (m *arModel) Option(option int) *arModel {
  180. return &arModel{m.M.Option(option)}
  181. }
  182. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  183. // the data and where attributes for empty values.
  184. func (m *arModel) OmitEmpty() *arModel {
  185. return &arModel{m.M.OmitEmpty()}
  186. }
  187. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  188. func (m *arModel) Filter() *arModel {
  189. return &arModel{m.M.Filter()}
  190. }
  191. // Where sets the condition statement for the model. The parameter <where> can be type of
  192. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  193. // multiple conditions will be joined into where statement using "AND".
  194. // Eg:
  195. // Where("uid=10000")
  196. // Where("uid", 10000)
  197. // Where("money>? AND name like ?", 99999, "vip_%")
  198. // Where("uid", 1).Where("name", "john")
  199. // Where("status IN (?)", g.Slice{1,2,3})
  200. // Where("age IN(?,?)", 18, 50)
  201. // Where(User{ Id : 1, UserName : "john"})
  202. func (m *arModel) Where(where interface{}, args ...interface{}) *arModel {
  203. return &arModel{m.M.Where(where, args...)}
  204. }
  205. // And adds "AND" condition to the where statement.
  206. func (m *arModel) And(where interface{}, args ...interface{}) *arModel {
  207. return &arModel{m.M.And(where, args...)}
  208. }
  209. // Or adds "OR" condition to the where statement.
  210. func (m *arModel) Or(where interface{}, args ...interface{}) *arModel {
  211. return &arModel{m.M.Or(where, args...)}
  212. }
  213. // Group sets the "GROUP BY" statement for the model.
  214. func (m *arModel) Group(groupBy string) *arModel {
  215. return &arModel{m.M.Group(groupBy)}
  216. }
  217. // Order sets the "ORDER BY" statement for the model.
  218. func (m *arModel) Order(orderBy ...string) *arModel {
  219. return &arModel{m.M.Order(orderBy...)}
  220. }
  221. // Limit sets the "LIMIT" statement for the model.
  222. // The parameter <limit> can be either one or two number, if passed two number is passed,
  223. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  224. // statement.
  225. func (m *arModel) Limit(limit ...int) *arModel {
  226. return &arModel{m.M.Limit(limit...)}
  227. }
  228. // Offset sets the "OFFSET" statement for the model.
  229. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  230. func (m *arModel) Offset(offset int) *arModel {
  231. return &arModel{m.M.Offset(offset)}
  232. }
  233. // Page sets the paging number for the model.
  234. // The parameter <page> is started from 1 for paging.
  235. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  236. func (m *arModel) Page(page, limit int) *arModel {
  237. return &arModel{m.M.Page(page, limit)}
  238. }
  239. // Batch sets the batch operation number for the model.
  240. func (m *arModel) Batch(batch int) *arModel {
  241. return &arModel{m.M.Batch(batch)}
  242. }
  243. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  244. // if there's another same sql request, it just reads and returns the result from cache, it
  245. // but not committed and executed into the database.
  246. //
  247. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  248. // If the parameter <duration> = 0, which means it never expires.
  249. // If the parameter <duration> > 0, which means it expires after <duration>.
  250. //
  251. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  252. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  253. //
  254. // Note that, the cache feature is disabled if the model is operating on a transaction.
  255. func (m *arModel) Cache(duration time.Duration, name ...string) *arModel {
  256. return &arModel{m.M.Cache(duration, name...)}
  257. }
  258. // Data sets the operation data for the model.
  259. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  260. // Eg:
  261. // Data("uid=10000")
  262. // Data("uid", 10000)
  263. // Data(g.Map{"uid": 10000, "name":"john"})
  264. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  265. func (m *arModel) Data(data ...interface{}) *arModel {
  266. return &arModel{m.M.Data(data...)}
  267. }
  268. // All does "SELECT FROM ..." statement for the model.
  269. // It retrieves the records from table and returns the result as []*Entity.
  270. // It returns nil if there's no record retrieved with the given conditions from table.
  271. //
  272. // The optional parameter <where> is the same as the parameter of Model.Where function,
  273. // see Model.Where.
  274. func (m *arModel) All(where ...interface{}) ([]*Entity, error) {
  275. all, err := m.M.All(where...)
  276. if err != nil {
  277. return nil, err
  278. }
  279. var entities []*Entity
  280. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  281. return nil, err
  282. }
  283. return entities, nil
  284. }
  285. // One retrieves one record from table and returns the result as *Entity.
  286. // It returns nil if there's no record retrieved with the given conditions from table.
  287. //
  288. // The optional parameter <where> is the same as the parameter of Model.Where function,
  289. // see Model.Where.
  290. func (m *arModel) One(where ...interface{}) (*Entity, error) {
  291. one, err := m.M.One(where...)
  292. if err != nil {
  293. return nil, err
  294. }
  295. var entity *Entity
  296. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  297. return nil, err
  298. }
  299. return entity, nil
  300. }
  301. // FindOne retrieves and returns a single Record by Model.WherePri and Model.One.
  302. // Also see Model.WherePri and Model.One.
  303. func (m *arModel) FindOne(where ...interface{}) (*Entity, error) {
  304. one, err := m.M.FindOne(where...)
  305. if err != nil {
  306. return nil, err
  307. }
  308. var entity *Entity
  309. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  310. return nil, err
  311. }
  312. return entity, nil
  313. }
  314. // FindAll retrieves and returns Result by by Model.WherePri and Model.All.
  315. // Also see Model.WherePri and Model.All.
  316. func (m *arModel) FindAll(where ...interface{}) ([]*Entity, error) {
  317. all, err := m.M.FindAll(where...)
  318. if err != nil {
  319. return nil, err
  320. }
  321. var entities []*Entity
  322. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  323. return nil, err
  324. }
  325. return entities, nil
  326. }
  327. // Chunk iterates the table with given size and callback function.
  328. func (m *arModel) Chunk(limit int, callback func(entities []*Entity, err error) bool) {
  329. m.M.Chunk(limit, func(result gdb.Result, err error) bool {
  330. var entities []*Entity
  331. err = result.Structs(&entities)
  332. if err == sql.ErrNoRows {
  333. return false
  334. }
  335. return callback(entities, err)
  336. })
  337. }
  338. // LockUpdate sets the lock for update for current operation.
  339. func (m *arModel) LockUpdate() *arModel {
  340. return &arModel{m.M.LockUpdate()}
  341. }
  342. // LockShared sets the lock in share mode for current operation.
  343. func (m *arModel) LockShared() *arModel {
  344. return &arModel{m.M.LockShared()}
  345. }
  346. // Unscoped enables/disables the soft deleting feature.
  347. func (m *arModel) Unscoped() *arModel {
  348. return &arModel{m.M.Unscoped()}
  349. }