ops_operation_event.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. "dashoo.cn/opms_parent/app/model/opsdev"
  8. "database/sql"
  9. "github.com/gogf/gf/database/gdb"
  10. "github.com/gogf/gf/frame/g"
  11. "github.com/gogf/gf/frame/gmvc"
  12. "time"
  13. )
  14. // OpsOperationEventDao is the manager for logic model data accessing
  15. // and custom defined data operations functions management.
  16. type OpsOperationEventDao struct {
  17. gmvc.M
  18. DB gdb.DB
  19. Table string
  20. Columns opsOperationEventColumns
  21. }
  22. // OpsOperationEventColumns defines and stores column names for table ops_operation_event.
  23. type opsOperationEventColumns struct {
  24. Id string // 主键
  25. EventNo string // 事件编号
  26. EventTitle string // 事件标题
  27. EventDesc string // 事件描述
  28. EventType string // 事件类型:10-操作咨询 20-数据处理 30-系统BUG 40-功能调整 50-二开需求 90-其他问题
  29. EventStatus string // 事件状态:10-待处理 20-处理中 30-转研发 70-挂起 80-已关闭
  30. EventResult string // 事件结果:10-已解决 20-部分解决 30-未解决
  31. ContractId string // 关联合同ID
  32. ContractName string // 合同名称
  33. CustId string // 关联客户ID
  34. CustName string // 客户名称
  35. ProductLine string // 产品线:10-Biobank 20-LIMS 30-CellLbank
  36. IsBig string // 是否重点项目:10-是 20-否
  37. IsOps string // 是否在运维期:10-是 20-否
  38. PriorityLevel string // 优先级:P1-紧急 P2-一般 P3-低优
  39. FeedbackSource string // 反馈来源:10-客户 20-销售 30-交付
  40. FeedbackReporter string // 反馈人
  41. FeedbackDate string // 反馈时间
  42. OpsUserId string // 运维人员ID
  43. OpsUserName string // 运维人员姓名
  44. AssignTime string // 接单时间
  45. CompleteTime string // 处理完成时间
  46. CompleteDesc string // 处理结果说明
  47. Attribute1 string // 增强字段1
  48. Attribute2 string // 增强字段2
  49. Attribute3 string // 增强字段3
  50. Attribute4 string // 增强字段4
  51. Attribute5 string // 增强字段5
  52. Attribute6 string // 增强字段6
  53. Attribute7 string // 增强字段7
  54. Attribute8 string // 增强字段8
  55. Attribute9 string // 增强字段9
  56. Remark string // 备注
  57. CreatedBy string // 创建者ID
  58. CreatedName string // 创建人姓名
  59. CreatedTime string // 创建时间
  60. UpdatedBy string // 更新者ID
  61. UpdatedName string // 更新人姓名
  62. UpdatedTime string // 更新时间
  63. DeletedTime string // 删除时间(NULL=未删除)
  64. }
  65. var (
  66. // OpsOperationEvent is globally public accessible object for table ops_operation_event operations.
  67. OpsOperationEvent = OpsOperationEventDao{
  68. M: g.DB("default").Model("ops_operation_event").Safe(),
  69. DB: g.DB("default"),
  70. Table: "ops_operation_event",
  71. Columns: opsOperationEventColumns{
  72. Id: "id",
  73. EventNo: "event_no",
  74. EventTitle: "event_title",
  75. EventDesc: "event_desc",
  76. EventType: "event_type",
  77. EventStatus: "event_status",
  78. EventResult: "event_result",
  79. ContractId: "contract_id",
  80. ContractName: "contract_name",
  81. CustId: "cust_id",
  82. CustName: "cust_name",
  83. ProductLine: "product_line",
  84. IsBig: "is_big",
  85. IsOps: "is_ops",
  86. PriorityLevel: "priority_level",
  87. FeedbackSource: "feedback_source",
  88. FeedbackReporter: "feedback_reporter",
  89. FeedbackDate: "feedback_date",
  90. OpsUserId: "ops_user_id",
  91. OpsUserName: "ops_user_name",
  92. AssignTime: "assign_time",
  93. CompleteTime: "complete_time",
  94. CompleteDesc: "complete_desc",
  95. Attribute1: "attribute1",
  96. Attribute2: "attribute2",
  97. Attribute3: "attribute3",
  98. Attribute4: "attribute4",
  99. Attribute5: "attribute5",
  100. Attribute6: "attribute6",
  101. Attribute7: "attribute7",
  102. Attribute8: "attribute8",
  103. Attribute9: "attribute9",
  104. Remark: "remark",
  105. CreatedBy: "created_by",
  106. CreatedName: "created_name",
  107. CreatedTime: "created_time",
  108. UpdatedBy: "updated_by",
  109. UpdatedName: "updated_name",
  110. UpdatedTime: "updated_time",
  111. DeletedTime: "deleted_time",
  112. },
  113. }
  114. )
  115. func NewOpsOperationEventDao(tenant string) OpsOperationEventDao {
  116. var dao OpsOperationEventDao
  117. dao = OpsOperationEventDao{
  118. M: g.DB(tenant).Model("ops_operation_event").Safe(),
  119. DB: g.DB(tenant),
  120. Table: "ops_operation_event",
  121. Columns: opsOperationEventColumns{
  122. Id: "id",
  123. EventNo: "event_no",
  124. EventTitle: "event_title",
  125. EventDesc: "event_desc",
  126. EventType: "event_type",
  127. EventStatus: "event_status",
  128. EventResult: "event_result",
  129. ContractId: "contract_id",
  130. ContractName: "contract_name",
  131. CustId: "cust_id",
  132. CustName: "cust_name",
  133. ProductLine: "product_line",
  134. IsBig: "is_big",
  135. IsOps: "is_ops",
  136. PriorityLevel: "priority_level",
  137. FeedbackSource: "feedback_source",
  138. FeedbackReporter: "feedback_reporter",
  139. FeedbackDate: "feedback_date",
  140. OpsUserId: "ops_user_id",
  141. OpsUserName: "ops_user_name",
  142. AssignTime: "assign_time",
  143. CompleteTime: "complete_time",
  144. CompleteDesc: "complete_desc",
  145. Attribute1: "attribute1",
  146. Attribute2: "attribute2",
  147. Attribute3: "attribute3",
  148. Attribute4: "attribute4",
  149. Attribute5: "attribute5",
  150. Attribute6: "attribute6",
  151. Attribute7: "attribute7",
  152. Attribute8: "attribute8",
  153. Attribute9: "attribute9",
  154. Remark: "remark",
  155. CreatedBy: "created_by",
  156. CreatedName: "created_name",
  157. CreatedTime: "created_time",
  158. UpdatedBy: "updated_by",
  159. UpdatedName: "updated_name",
  160. UpdatedTime: "updated_time",
  161. DeletedTime: "deleted_time",
  162. },
  163. }
  164. return dao
  165. }
  166. // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
  167. // of current DB object and with given context in it.
  168. // Note that this returned DB object can be used only once, so do not assign it to
  169. // a global or package variable for long using.
  170. func (d *OpsOperationEventDao) Ctx(ctx context.Context) *OpsOperationEventDao {
  171. return &OpsOperationEventDao{M: d.M.Ctx(ctx)}
  172. }
  173. // As sets an alias name for current table.
  174. func (d *OpsOperationEventDao) As(as string) *OpsOperationEventDao {
  175. return &OpsOperationEventDao{M: d.M.As(as)}
  176. }
  177. // TX sets the transaction for current operation.
  178. func (d *OpsOperationEventDao) TX(tx *gdb.TX) *OpsOperationEventDao {
  179. return &OpsOperationEventDao{M: d.M.TX(tx)}
  180. }
  181. // Master marks the following operation on master node.
  182. func (d *OpsOperationEventDao) Master() *OpsOperationEventDao {
  183. return &OpsOperationEventDao{M: d.M.Master()}
  184. }
  185. // Slave marks the following operation on slave node.
  186. // Note that it makes sense only if there's any slave node configured.
  187. func (d *OpsOperationEventDao) Slave() *OpsOperationEventDao {
  188. return &OpsOperationEventDao{M: d.M.Slave()}
  189. }
  190. // Args sets custom arguments for model operation.
  191. func (d *OpsOperationEventDao) Args(args ...interface{}) *OpsOperationEventDao {
  192. return &OpsOperationEventDao{M: d.M.Args(args...)}
  193. }
  194. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  195. // The parameter <table> can be joined table and its joined condition,
  196. // and also with its alias name, like:
  197. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  198. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  199. func (d *OpsOperationEventDao) LeftJoin(table ...string) *OpsOperationEventDao {
  200. return &OpsOperationEventDao{M: d.M.LeftJoin(table...)}
  201. }
  202. // RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
  203. // The parameter <table> can be joined table and its joined condition,
  204. // and also with its alias name, like:
  205. // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
  206. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  207. func (d *OpsOperationEventDao) RightJoin(table ...string) *OpsOperationEventDao {
  208. return &OpsOperationEventDao{M: d.M.RightJoin(table...)}
  209. }
  210. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  211. // The parameter <table> can be joined table and its joined condition,
  212. // and also with its alias name, like:
  213. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  214. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  215. func (d *OpsOperationEventDao) InnerJoin(table ...string) *OpsOperationEventDao {
  216. return &OpsOperationEventDao{M: d.M.InnerJoin(table...)}
  217. }
  218. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  219. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  220. func (d *OpsOperationEventDao) Fields(fieldNamesOrMapStruct ...interface{}) *OpsOperationEventDao {
  221. return &OpsOperationEventDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
  222. }
  223. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  224. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  225. func (d *OpsOperationEventDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *OpsOperationEventDao {
  226. return &OpsOperationEventDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
  227. }
  228. // Option sets the extra operation option for the model.
  229. func (d *OpsOperationEventDao) Option(option int) *OpsOperationEventDao {
  230. return &OpsOperationEventDao{M: d.M.Option(option)}
  231. }
  232. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  233. // the data and where attributes for empty values.
  234. func (d *OpsOperationEventDao) OmitEmpty() *OpsOperationEventDao {
  235. return &OpsOperationEventDao{M: d.M.OmitEmpty()}
  236. }
  237. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  238. func (d *OpsOperationEventDao) Filter() *OpsOperationEventDao {
  239. return &OpsOperationEventDao{M: d.M.Filter()}
  240. }
  241. // Where sets the condition statement for the model. The parameter <where> can be type of
  242. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  243. // multiple conditions will be joined into where statement using "AND".
  244. // Eg:
  245. // Where("uid=10000")
  246. // Where("uid", 10000)
  247. // Where("money>? AND name like ?", 99999, "vip_%")
  248. // Where("uid", 1).Where("name", "john")
  249. // Where("status IN (?)", g.Slice{1,2,3})
  250. // Where("age IN(?,?)", 18, 50)
  251. // Where(User{ Id : 1, UserName : "john"})
  252. func (d *OpsOperationEventDao) Where(where interface{}, args ...interface{}) *OpsOperationEventDao {
  253. return &OpsOperationEventDao{M: d.M.Where(where, args...)}
  254. }
  255. // WherePri does the same logic as M.Where except that if the parameter <where>
  256. // is a single condition like int/string/float/slice, it treats the condition as the primary
  257. // key value. That is, if primary key is "id" and given <where> parameter as "123", the
  258. // WherePri function treats the condition as "id=123", but M.Where treats the condition
  259. // as string "123".
  260. func (d *OpsOperationEventDao) WherePri(where interface{}, args ...interface{}) *OpsOperationEventDao {
  261. return &OpsOperationEventDao{M: d.M.WherePri(where, args...)}
  262. }
  263. // And adds "AND" condition to the where statement.
  264. func (d *OpsOperationEventDao) And(where interface{}, args ...interface{}) *OpsOperationEventDao {
  265. return &OpsOperationEventDao{M: d.M.And(where, args...)}
  266. }
  267. // Or adds "OR" condition to the where statement.
  268. func (d *OpsOperationEventDao) Or(where interface{}, args ...interface{}) *OpsOperationEventDao {
  269. return &OpsOperationEventDao{M: d.M.Or(where, args...)}
  270. }
  271. // Group sets the "GROUP BY" statement for the model.
  272. func (d *OpsOperationEventDao) Group(groupBy string) *OpsOperationEventDao {
  273. return &OpsOperationEventDao{M: d.M.Group(groupBy)}
  274. }
  275. // Order sets the "ORDER BY" statement for the model.
  276. func (d *OpsOperationEventDao) Order(orderBy ...string) *OpsOperationEventDao {
  277. return &OpsOperationEventDao{M: d.M.Order(orderBy...)}
  278. }
  279. // Limit sets the "LIMIT" statement for the model.
  280. // The parameter <limit> can be either one or two number, if passed two number is passed,
  281. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  282. // statement.
  283. func (d *OpsOperationEventDao) Limit(limit ...int) *OpsOperationEventDao {
  284. return &OpsOperationEventDao{M: d.M.Limit(limit...)}
  285. }
  286. // Offset sets the "OFFSET" statement for the model.
  287. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  288. func (d *OpsOperationEventDao) Offset(offset int) *OpsOperationEventDao {
  289. return &OpsOperationEventDao{M: d.M.Offset(offset)}
  290. }
  291. // Page sets the paging number for the model.
  292. // The parameter <page> is started from 1 for paging.
  293. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  294. func (d *OpsOperationEventDao) Page(page, limit int) *OpsOperationEventDao {
  295. return &OpsOperationEventDao{M: d.M.Page(page, limit)}
  296. }
  297. // Batch sets the batch operation number for the model.
  298. func (d *OpsOperationEventDao) Batch(batch int) *OpsOperationEventDao {
  299. return &OpsOperationEventDao{M: d.M.Batch(batch)}
  300. }
  301. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  302. // if there's another same sql request, it just reads and returns the result from cache, it
  303. // but not committed and executed into the database.
  304. //
  305. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  306. // If the parameter <duration> = 0, which means it never expires.
  307. // If the parameter <duration> > 0, which means it expires after <duration>.
  308. //
  309. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  310. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  311. //
  312. // Note that, the cache feature is disabled if the model is operating on a transaction.
  313. func (d *OpsOperationEventDao) Cache(duration time.Duration, name ...string) *OpsOperationEventDao {
  314. return &OpsOperationEventDao{M: d.M.Cache(duration, name...)}
  315. }
  316. // Data sets the operation data for the model.
  317. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  318. // Eg:
  319. // Data("uid=10000")
  320. // Data("uid", 10000)
  321. // Data(g.Map{"uid": 10000, "name":"john"})
  322. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  323. func (d *OpsOperationEventDao) Data(data ...interface{}) *OpsOperationEventDao {
  324. return &OpsOperationEventDao{M: d.M.Data(data...)}
  325. }
  326. // All does "SELECT FROM ..." statement for the model.
  327. // It retrieves the records from table and returns the result as []*model.OpsOperationEvent.
  328. // It returns nil if there's no record retrieved with the given conditions from table.
  329. //
  330. // The optional parameter <where> is the same as the parameter of M.Where function,
  331. // see M.Where.
  332. func (d *OpsOperationEventDao) All(where ...interface{}) ([]*opsdev.OpsOperationEvent, error) {
  333. all, err := d.M.All(where...)
  334. if err != nil {
  335. return nil, err
  336. }
  337. var entities []*opsdev.OpsOperationEvent
  338. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  339. return nil, err
  340. }
  341. return entities, nil
  342. }
  343. // One retrieves one record from table and returns the result as *model.OpsOperationEvent.
  344. // It returns nil if there's no record retrieved with the given conditions from table.
  345. //
  346. // The optional parameter <where> is the same as the parameter of M.Where function,
  347. // see M.Where.
  348. func (d *OpsOperationEventDao) One(where ...interface{}) (*opsdev.OpsOperationEvent, error) {
  349. one, err := d.M.One(where...)
  350. if err != nil {
  351. return nil, err
  352. }
  353. var entity *opsdev.OpsOperationEvent
  354. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  355. return nil, err
  356. }
  357. return entity, nil
  358. }
  359. // FindOne retrieves and returns a single Record by M.WherePri and M.One.
  360. // Also see M.WherePri and M.One.
  361. func (d *OpsOperationEventDao) FindOne(where ...interface{}) (*opsdev.OpsOperationEvent, error) {
  362. one, err := d.M.FindOne(where...)
  363. if err != nil {
  364. return nil, err
  365. }
  366. var entity *opsdev.OpsOperationEvent
  367. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  368. return nil, err
  369. }
  370. return entity, nil
  371. }
  372. // FindAll retrieves and returns Result by by M.WherePri and M.All.
  373. // Also see M.WherePri and M.All.
  374. func (d *OpsOperationEventDao) FindAll(where ...interface{}) ([]*opsdev.OpsOperationEvent, error) {
  375. all, err := d.M.FindAll(where...)
  376. if err != nil {
  377. return nil, err
  378. }
  379. var entities []*opsdev.OpsOperationEvent
  380. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  381. return nil, err
  382. }
  383. return entities, nil
  384. }
  385. // Struct retrieves one record from table and converts it into given struct.
  386. // The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
  387. // it can create the struct internally during converting.
  388. //
  389. // The optional parameter <where> is the same as the parameter of Model.Where function,
  390. // see Model.Where.
  391. //
  392. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  393. // from table and <pointer> is not nil.
  394. //
  395. // Eg:
  396. // user := new(User)
  397. // err := dao.User.Where("id", 1).Struct(user)
  398. //
  399. // user := (*User)(nil)
  400. // err := dao.User.Where("id", 1).Struct(&user)
  401. func (d *OpsOperationEventDao) Struct(pointer interface{}, where ...interface{}) error {
  402. return d.M.Struct(pointer, where...)
  403. }
  404. // Structs retrieves records from table and converts them into given struct slice.
  405. // The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
  406. // slice internally during converting.
  407. //
  408. // The optional parameter <where> is the same as the parameter of Model.Where function,
  409. // see Model.Where.
  410. //
  411. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  412. // from table and <pointer> is not empty.
  413. //
  414. // Eg:
  415. // users := ([]User)(nil)
  416. // err := dao.User.Structs(&users)
  417. //
  418. // users := ([]*User)(nil)
  419. // err := dao.User.Structs(&users)
  420. func (d *OpsOperationEventDao) Structs(pointer interface{}, where ...interface{}) error {
  421. return d.M.Structs(pointer, where...)
  422. }
  423. // Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
  424. // It calls function Struct if <pointer> is type of *struct/**struct.
  425. // It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
  426. //
  427. // The optional parameter <where> is the same as the parameter of Model.Where function,
  428. // see Model.Where.
  429. //
  430. // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
  431. //
  432. // Eg:
  433. // user := new(User)
  434. // err := dao.User.Where("id", 1).Scan(user)
  435. //
  436. // user := (*User)(nil)
  437. // err := dao.User.Where("id", 1).Scan(&user)
  438. //
  439. // users := ([]User)(nil)
  440. // err := dao.User.Scan(&users)
  441. //
  442. // users := ([]*User)(nil)
  443. // err := dao.User.Scan(&users)
  444. func (d *OpsOperationEventDao) Scan(pointer interface{}, where ...interface{}) error {
  445. return d.M.Scan(pointer, where...)
  446. }
  447. // Chunk iterates the table with given size and callback function.
  448. func (d *OpsOperationEventDao) Chunk(limit int, callback func(entities []*opsdev.OpsOperationEvent, err error) bool) {
  449. d.M.Chunk(limit, func(result gdb.Result, err error) bool {
  450. var entities []*opsdev.OpsOperationEvent
  451. err = result.Structs(&entities)
  452. if err == sql.ErrNoRows {
  453. return false
  454. }
  455. return callback(entities, err)
  456. })
  457. }
  458. // LockUpdate sets the lock for update for current operation.
  459. func (d *OpsOperationEventDao) LockUpdate() *OpsOperationEventDao {
  460. return &OpsOperationEventDao{M: d.M.LockUpdate()}
  461. }
  462. // LockShared sets the lock in share mode for current operation.
  463. func (d *OpsOperationEventDao) LockShared() *OpsOperationEventDao {
  464. return &OpsOperationEventDao{M: d.M.LockShared()}
  465. }
  466. // Unscoped enables/disables the soft deleting feature.
  467. func (d *OpsOperationEventDao) Unscoped() *OpsOperationEventDao {
  468. return &OpsOperationEventDao{M: d.M.Unscoped()}
  469. }