proj_business_dynamics.go 30 KB

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