feedback_flow.go 15 KB

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