proj_business.go 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  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. "time"
  13. model "dashoo.cn/micro/app/model/proj"
  14. )
  15. // ProjBusinessDao is the manager for logic model data accessing
  16. // and custom defined data operations functions management.
  17. type ProjBusinessDao struct {
  18. gmvc.M
  19. DB gdb.DB
  20. Table string
  21. Columns projBusinessColumns
  22. }
  23. // ProjBusinessColumns defines and stores column names for table proj_business.
  24. type projBusinessColumns struct {
  25. Id string // 主键
  26. NboCode string // 项目编码
  27. NboName string // 项目名称
  28. NboStatus string // 项目状态
  29. CustId string // 关联客户
  30. CustName string // 客户名称
  31. CustProvinceId string // 所在省ID
  32. CustProvince string // 所在省
  33. CustCityId string // 所在市ID
  34. CustCity string // 所在市
  35. CustRegionId string // 所在区县ID
  36. CustRegion string // 所在区县
  37. ProductLine string // 产品线
  38. NboType string // 项目级别(A 、B 、C 、成交、储备)
  39. NboPhase string // 项目阶段(暂不起用)
  40. NboSource string // 项目来源
  41. NboBudget string // 项目预算
  42. ApproStatus string // 审批状态(10待提交20审批中30审批通过40审批退回60审批拒绝)
  43. ContactId string // 关联联系人
  44. ContactName string // 联系人姓名
  45. ContactPostion string // 联系人岗位
  46. ContactTelephone string // 联系人电话
  47. MakerId string // 关联决策人
  48. MakerName string // 决策人姓名
  49. MakerDept string // 决策人部门
  50. MakerPost string // 决策人岗位
  51. MakerTelephone string // 决策人电话
  52. SalesModel string // 销售模式(10直销20经销30代理)
  53. SaleId string // 归属销售
  54. SaleName string // 销售姓名
  55. DistributorId string // 经销商/代理商ID
  56. DistributorName string // 经销商/代理商名称
  57. FilingTime string // 项目备案时间
  58. FinalFollowId string // 最新跟进人
  59. FinalFollowName string // 最新跟进人名称
  60. FinalFollowTime string // 最后跟进时间
  61. NextFollowTime string // 下次跟进时间
  62. PlanPurchaseTime string // 计划采购时间
  63. EstTransTime string // 预计成交时间
  64. EstTransPrice string // 预计成交价格
  65. RiskProfile string // 风险情况
  66. Difficulty string // 困难点
  67. Competitor string // 竞争公司
  68. Intervention string // 介入情况
  69. DeptId string // 所属部门ID
  70. DeptName string // 所属部门
  71. IsBig string // 是否为大项目
  72. TechnicalSupportName string // 技术支持人员
  73. TechnicalSupportContent string // 技术支持内容
  74. TechnicalSupportTime string // 技术支持时间
  75. CustomerSatisfaction string // 客户满意度 (10很满意、20满意、30较满意、40一般、50不满意)
  76. ParentReceiver string // 总部对接人
  77. NboBudgetTime string // 项目预算期限
  78. CapitalSource string // 资金来源
  79. ProductSatisfaction string // 产品/方案满足情况
  80. PurchasingWay string // 采购方式
  81. PurchasingTime string // 采购时间
  82. IsAdoptDashoo string // 是否采纳大数技术参数(上传附件)
  83. HistoricalTransactionInfo string // 经销商与客户历史成交信息
  84. DealerSalesId string // 关联经销商销售
  85. DealerSalesName string // 经销商销售人员
  86. Accendant string // 维护部门及人员
  87. ProjConversionTime string // 项目转化时间
  88. ProjConversionReason string // 项目转化原因
  89. Remark string // 备注
  90. CreatedBy string // 创建者
  91. CreatedName string // 创建人
  92. CreatedTime string // 创建时间
  93. UpdatedBy string // 更新者
  94. UpdatedName string // 更新人
  95. UpdatedTime string // 更新时间
  96. DeletedTime string // 删除时间
  97. }
  98. var (
  99. // ProjBusiness is globally public accessible object for table proj_business operations.
  100. ProjBusiness = ProjBusinessDao{
  101. M: g.DB("default").Model("proj_business").Safe(),
  102. DB: g.DB("default"),
  103. Table: "proj_business",
  104. Columns: projBusinessColumns{
  105. Id: "id",
  106. NboCode: "nbo_code",
  107. NboName: "nbo_name",
  108. NboStatus: "nbo_status",
  109. CustId: "cust_id",
  110. CustName: "cust_name",
  111. CustProvinceId: "cust_province_id",
  112. CustProvince: "cust_province",
  113. CustCityId: "cust_city_id",
  114. CustCity: "cust_city",
  115. CustRegionId: "cust_region_id",
  116. CustRegion: "cust_region",
  117. ProductLine: "product_line",
  118. NboType: "nbo_type",
  119. NboPhase: "nbo_phase",
  120. NboSource: "nbo_source",
  121. NboBudget: "nbo_budget",
  122. ApproStatus: "appro_status",
  123. ContactId: "contact_id",
  124. ContactName: "contact_name",
  125. ContactPostion: "contact_postion",
  126. ContactTelephone: "contact_telephone",
  127. MakerId: "maker_id",
  128. MakerName: "maker_name",
  129. MakerDept: "maker_dept",
  130. MakerPost: "maker_post",
  131. MakerTelephone: "maker_telephone",
  132. SalesModel: "sales_model",
  133. SaleId: "sale_id",
  134. SaleName: "sale_name",
  135. DistributorId: "distributor_id",
  136. DistributorName: "distributor_name",
  137. FilingTime: "filing_time",
  138. FinalFollowId: "final_follow_id",
  139. FinalFollowName: "final_follow_name",
  140. FinalFollowTime: "final_follow_time",
  141. NextFollowTime: "next_follow_time",
  142. PlanPurchaseTime: "plan_purchase_time",
  143. EstTransTime: "est_trans_time",
  144. EstTransPrice: "est_trans_price",
  145. RiskProfile: "risk_profile",
  146. Difficulty: "difficulty",
  147. Competitor: "competitor",
  148. Intervention: "Intervention",
  149. DeptId: "dept_id",
  150. DeptName: "dept_name",
  151. IsBig: "is_big",
  152. TechnicalSupportName: "technical_support_name",
  153. TechnicalSupportContent: "technical_support_content",
  154. TechnicalSupportTime: "technical_support_time",
  155. CustomerSatisfaction: "customer_satisfaction",
  156. ParentReceiver: "parent_receiver",
  157. NboBudgetTime: "nbo_budget_time",
  158. CapitalSource: "capital_source",
  159. ProductSatisfaction: "product_satisfaction",
  160. PurchasingWay: "purchasing_way",
  161. PurchasingTime: "purchasing_time",
  162. IsAdoptDashoo: "is_adopt_dashoo",
  163. HistoricalTransactionInfo: "historical_transaction_info",
  164. DealerSalesId: "dealer_sales_id",
  165. DealerSalesName: "dealer_sales_name",
  166. Accendant: "accendant",
  167. ProjConversionTime: "proj_conversion_time",
  168. ProjConversionReason: "proj_conversion_reason",
  169. Remark: "remark",
  170. CreatedBy: "created_by",
  171. CreatedName: "created_name",
  172. CreatedTime: "created_time",
  173. UpdatedBy: "updated_by",
  174. UpdatedName: "updated_name",
  175. UpdatedTime: "updated_time",
  176. DeletedTime: "deleted_time",
  177. },
  178. }
  179. )
  180. func NewProjBusinessDao(tenant string) ProjBusinessDao {
  181. var dao ProjBusinessDao
  182. dao = ProjBusinessDao{
  183. M: g.DB(tenant).Model("proj_business").Safe(),
  184. DB: g.DB(tenant),
  185. Table: "proj_business",
  186. Columns: projBusinessColumns{
  187. Id: "id",
  188. NboCode: "nbo_code",
  189. NboName: "nbo_name",
  190. NboStatus: "nbo_status",
  191. CustId: "cust_id",
  192. CustName: "cust_name",
  193. CustProvinceId: "cust_province_id",
  194. CustProvince: "cust_province",
  195. CustCityId: "cust_city_id",
  196. CustCity: "cust_city",
  197. CustRegionId: "cust_region_id",
  198. CustRegion: "cust_region",
  199. ProductLine: "product_line",
  200. NboType: "nbo_type",
  201. NboPhase: "nbo_phase",
  202. NboSource: "nbo_source",
  203. NboBudget: "nbo_budget",
  204. ApproStatus: "appro_status",
  205. ContactId: "contact_id",
  206. ContactName: "contact_name",
  207. ContactPostion: "contact_postion",
  208. ContactTelephone: "contact_telephone",
  209. MakerId: "maker_id",
  210. MakerName: "maker_name",
  211. MakerDept: "maker_dept",
  212. MakerPost: "maker_post",
  213. MakerTelephone: "maker_telephone",
  214. SalesModel: "sales_model",
  215. SaleId: "sale_id",
  216. SaleName: "sale_name",
  217. DistributorId: "distributor_id",
  218. DistributorName: "distributor_name",
  219. FilingTime: "filing_time",
  220. FinalFollowId: "final_follow_id",
  221. FinalFollowName: "final_follow_name",
  222. FinalFollowTime: "final_follow_time",
  223. NextFollowTime: "next_follow_time",
  224. PlanPurchaseTime: "plan_purchase_time",
  225. EstTransTime: "est_trans_time",
  226. EstTransPrice: "est_trans_price",
  227. RiskProfile: "risk_profile",
  228. Difficulty: "difficulty",
  229. Competitor: "competitor",
  230. Intervention: "Intervention",
  231. DeptId: "dept_id",
  232. DeptName: "dept_name",
  233. IsBig: "is_big",
  234. TechnicalSupportName: "technical_support_name",
  235. TechnicalSupportContent: "technical_support_content",
  236. TechnicalSupportTime: "technical_support_time",
  237. CustomerSatisfaction: "customer_satisfaction",
  238. ParentReceiver: "parent_receiver",
  239. NboBudgetTime: "nbo_budget_time",
  240. CapitalSource: "capital_source",
  241. ProductSatisfaction: "product_satisfaction",
  242. PurchasingWay: "purchasing_way",
  243. PurchasingTime: "purchasing_time",
  244. IsAdoptDashoo: "is_adopt_dashoo",
  245. HistoricalTransactionInfo: "historical_transaction_info",
  246. DealerSalesId: "dealer_sales_id",
  247. DealerSalesName: "dealer_sales_name",
  248. Accendant: "accendant",
  249. ProjConversionTime: "proj_conversion_time",
  250. ProjConversionReason: "proj_conversion_reason",
  251. Remark: "remark",
  252. CreatedBy: "created_by",
  253. CreatedName: "created_name",
  254. CreatedTime: "created_time",
  255. UpdatedBy: "updated_by",
  256. UpdatedName: "updated_name",
  257. UpdatedTime: "updated_time",
  258. DeletedTime: "deleted_time",
  259. },
  260. }
  261. return dao
  262. }
  263. // Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
  264. // of current DB object and with given context in it.
  265. // Note that this returned DB object can be used only once, so do not assign it to
  266. // a global or package variable for long using.
  267. func (d *ProjBusinessDao) Ctx(ctx context.Context) *ProjBusinessDao {
  268. return &ProjBusinessDao{M: d.M.Ctx(ctx)}
  269. }
  270. // GetCtx returns the context for current Model.
  271. // It returns "context.Background() i"s there's no context previously set.
  272. func (d *ProjBusinessDao) GetCtx() context.Context {
  273. return d.M.GetCtx()
  274. }
  275. // As sets an alias name for current table.
  276. func (d *ProjBusinessDao) As(as string) *ProjBusinessDao {
  277. return &ProjBusinessDao{M: d.M.As(as)}
  278. }
  279. // TX sets the transaction for current operation.
  280. func (d *ProjBusinessDao) TX(tx *gdb.TX) *ProjBusinessDao {
  281. return &ProjBusinessDao{M: d.M.TX(tx)}
  282. }
  283. // Master marks the following operation on master node.
  284. func (d *ProjBusinessDao) Master() *ProjBusinessDao {
  285. return &ProjBusinessDao{M: d.M.Master()}
  286. }
  287. // Slave marks the following operation on slave node.
  288. // Note that it makes sense only if there's any slave node configured.
  289. func (d *ProjBusinessDao) Slave() *ProjBusinessDao {
  290. return &ProjBusinessDao{M: d.M.Slave()}
  291. }
  292. // Args sets custom arguments for model operation.
  293. func (d *ProjBusinessDao) Args(args ...interface{}) *ProjBusinessDao {
  294. return &ProjBusinessDao{M: d.M.Args(args...)}
  295. }
  296. // Handler calls each of "handlers" on current Model and returns a new Model.
  297. // ModelHandler is a function that handles given Model and returns a new Model that is custom modified.
  298. func (d *ProjBusinessDao) Handler(handlers ...gdb.ModelHandler) *ProjBusinessDao {
  299. return &ProjBusinessDao{M: d.M.Handler(handlers...)}
  300. }
  301. // LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
  302. // The parameter <table> can be joined table and its joined condition,
  303. // and also with its alias name, like:
  304. // Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
  305. // Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
  306. func (d *ProjBusinessDao) LeftJoin(table ...string) *ProjBusinessDao {
  307. return &ProjBusinessDao{M: d.M.LeftJoin(table...)}
  308. }
  309. // RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
  310. // The parameter <table> can be joined table and its joined condition,
  311. // and also with its alias name, like:
  312. // Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
  313. // Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
  314. func (d *ProjBusinessDao) RightJoin(table ...string) *ProjBusinessDao {
  315. return &ProjBusinessDao{M: d.M.RightJoin(table...)}
  316. }
  317. // InnerJoin does "INNER JOIN ... ON ..." statement on the model.
  318. // The parameter <table> can be joined table and its joined condition,
  319. // and also with its alias name, like:
  320. // Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
  321. // Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
  322. func (d *ProjBusinessDao) InnerJoin(table ...string) *ProjBusinessDao {
  323. return &ProjBusinessDao{M: d.M.InnerJoin(table...)}
  324. }
  325. // Fields sets the operation fields of the model, multiple fields joined using char ','.
  326. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  327. func (d *ProjBusinessDao) Fields(fieldNamesOrMapStruct ...interface{}) *ProjBusinessDao {
  328. return &ProjBusinessDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
  329. }
  330. // FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
  331. // The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
  332. func (d *ProjBusinessDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *ProjBusinessDao {
  333. return &ProjBusinessDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
  334. }
  335. // FieldCount formats and appends commonly used field "COUNT(column)" to the select fields of model.
  336. func (d *ProjBusinessDao) FieldCount(column string, as ...string) *ProjBusinessDao {
  337. return &ProjBusinessDao{M: d.M.FieldCount(column, as...)}
  338. }
  339. // FieldSum formats and appends commonly used field "SUM(column)" to the select fields of model.
  340. func (d *ProjBusinessDao) FieldSum(column string, as ...string) *ProjBusinessDao {
  341. return &ProjBusinessDao{M: d.M.FieldSum(column, as...)}
  342. }
  343. // FieldMin formats and appends commonly used field "MIN(column)" to the select fields of model.
  344. func (d *ProjBusinessDao) FieldMin(column string, as ...string) *ProjBusinessDao {
  345. return &ProjBusinessDao{M: d.M.FieldMin(column, as...)}
  346. }
  347. // FieldMax formats and appends commonly used field "MAX(column)" to the select fields of model.
  348. func (d *ProjBusinessDao) FieldMax(column string, as ...string) *ProjBusinessDao {
  349. return &ProjBusinessDao{M: d.M.FieldMax(column, as...)}
  350. }
  351. // FieldAvg formats and appends commonly used field "AVG(column)" to the select fields of model.
  352. func (d *ProjBusinessDao) FieldAvg(column string, as ...string) *ProjBusinessDao {
  353. return &ProjBusinessDao{M: d.M.FieldAvg(column, as...)}
  354. }
  355. // Option adds extra operation option for the model.
  356. // Deprecated, use separate operations instead.
  357. func (d *ProjBusinessDao) Option(option int) *ProjBusinessDao {
  358. return &ProjBusinessDao{M: d.M.Option(option)}
  359. }
  360. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  361. // the data and where attributes for empty values.
  362. func (d *ProjBusinessDao) OmitEmpty() *ProjBusinessDao {
  363. return &ProjBusinessDao{M: d.M.OmitEmpty()}
  364. }
  365. // OmitEmptyWhere sets optionOmitEmptyWhere option for the model, which automatically filers
  366. // the Where/Having parameters for "empty" values.
  367. func (d *ProjBusinessDao) OmitEmptyWhere() *ProjBusinessDao {
  368. return &ProjBusinessDao{M: d.M.OmitEmptyWhere()}
  369. }
  370. // OmitEmptyData sets optionOmitEmptyData option for the model, which automatically filers
  371. // the Data parameters for "empty" values.
  372. func (d *ProjBusinessDao) OmitEmptyData() *ProjBusinessDao {
  373. return &ProjBusinessDao{M: d.M.OmitEmptyData()}
  374. }
  375. // OmitNil sets optionOmitNil option for the model, which automatically filers
  376. // the data and where parameters for "nil" values.
  377. func (d *ProjBusinessDao) OmitNil() *ProjBusinessDao {
  378. return &ProjBusinessDao{M: d.M.OmitNil()}
  379. }
  380. // OmitNilWhere sets optionOmitNilWhere option for the model, which automatically filers
  381. // the Where/Having parameters for "nil" values.
  382. func (d *ProjBusinessDao) OmitNilWhere() *ProjBusinessDao {
  383. return &ProjBusinessDao{M: d.M.OmitNilWhere()}
  384. }
  385. // OmitNilData sets optionOmitNilData option for the model, which automatically filers
  386. // the Data parameters for "nil" values.
  387. func (d *ProjBusinessDao) OmitNilData() *ProjBusinessDao {
  388. return &ProjBusinessDao{M: d.M.OmitNilData()}
  389. }
  390. // Filter marks filtering the fields which does not exist in the fields of the operated table.
  391. // Note that this function supports only single table operations.
  392. // Deprecated, filter feature is automatically enabled from GoFrame v1.16.0, it is so no longer used.
  393. func (d *ProjBusinessDao) Filter() *ProjBusinessDao {
  394. return &ProjBusinessDao{M: d.M.Filter()}
  395. }
  396. // Where sets the condition statement for the model. The parameter <where> can be type of
  397. // string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
  398. // multiple conditions will be joined into where statement using "AND".
  399. // Eg:
  400. // Where("uid=10000")
  401. // Where("uid", 10000)
  402. // Where("money>? AND name like ?", 99999, "vip_%")
  403. // Where("uid", 1).Where("name", "john")
  404. // Where("status IN (?)", g.Slice{1,2,3})
  405. // Where("age IN(?,?)", 18, 50)
  406. // Where(User{ Id : 1, UserName : "john"})
  407. func (d *ProjBusinessDao) Where(where interface{}, args ...interface{}) *ProjBusinessDao {
  408. return &ProjBusinessDao{M: d.M.Where(where, args...)}
  409. }
  410. // WherePri does the same logic as M.Where except that if the parameter <where>
  411. // is a single condition like int/string/float/slice, it treats the condition as the primary
  412. // key value. That is, if primary key is "id" and given <where> parameter as "123", the
  413. // WherePri function treats the condition as "id=123", but M.Where treats the condition
  414. // as string "123".
  415. func (d *ProjBusinessDao) WherePri(where interface{}, args ...interface{}) *ProjBusinessDao {
  416. return &ProjBusinessDao{M: d.M.WherePri(where, args...)}
  417. }
  418. // Having sets the having statement for the model.
  419. // The parameters of this function usage are as the same as function Where.
  420. // See Where.
  421. func (d *ProjBusinessDao) Having(having interface{}, args ...interface{}) *ProjBusinessDao {
  422. return &ProjBusinessDao{M: d.M.Having(having, args...)}
  423. }
  424. // Wheref builds condition string using fmt.Sprintf and arguments.
  425. // Note that if the number of "args" is more than the place holder in "format",
  426. // the extra "args" will be used as the where condition arguments of the Model.
  427. func (d *ProjBusinessDao) Wheref(format string, args ...interface{}) *ProjBusinessDao {
  428. return &ProjBusinessDao{M: d.M.Wheref(format, args...)}
  429. }
  430. // WhereLT builds "column < value" statement.
  431. func (d *ProjBusinessDao) WhereLT(column string, value interface{}) *ProjBusinessDao {
  432. return &ProjBusinessDao{M: d.M.WhereLT(column, value)}
  433. }
  434. // WhereLTE builds "column <= value" statement.
  435. func (d *ProjBusinessDao) WhereLTE(column string, value interface{}) *ProjBusinessDao {
  436. return &ProjBusinessDao{M: d.M.WhereLTE(column, value)}
  437. }
  438. // WhereGT builds "column > value" statement.
  439. func (d *ProjBusinessDao) WhereGT(column string, value interface{}) *ProjBusinessDao {
  440. return &ProjBusinessDao{M: d.M.WhereGT(column, value)}
  441. }
  442. // WhereGTE builds "column >= value" statement.
  443. func (d *ProjBusinessDao) WhereGTE(column string, value interface{}) *ProjBusinessDao {
  444. return &ProjBusinessDao{M: d.M.WhereGTE(column, value)}
  445. }
  446. // WhereBetween builds "column BETWEEN min AND max" statement.
  447. func (d *ProjBusinessDao) WhereBetween(column string, min, max interface{}) *ProjBusinessDao {
  448. return &ProjBusinessDao{M: d.M.WhereBetween(column, min, max)}
  449. }
  450. // WhereLike builds "column LIKE like" statement.
  451. func (d *ProjBusinessDao) WhereLike(column string, like interface{}) *ProjBusinessDao {
  452. return &ProjBusinessDao{M: d.M.WhereLike(column, like)}
  453. }
  454. // WhereIn builds "column IN (in)" statement.
  455. func (d *ProjBusinessDao) WhereIn(column string, in interface{}) *ProjBusinessDao {
  456. return &ProjBusinessDao{M: d.M.WhereIn(column, in)}
  457. }
  458. // WhereNull builds "columns[0] IS NULL AND columns[1] IS NULL ..." statement.
  459. func (d *ProjBusinessDao) WhereNull(columns ...string) *ProjBusinessDao {
  460. return &ProjBusinessDao{M: d.M.WhereNull(columns...)}
  461. }
  462. // WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
  463. func (d *ProjBusinessDao) WhereNotBetween(column string, min, max interface{}) *ProjBusinessDao {
  464. return &ProjBusinessDao{M: d.M.WhereNotBetween(column, min, max)}
  465. }
  466. // WhereNotLike builds "column NOT LIKE like" statement.
  467. func (d *ProjBusinessDao) WhereNotLike(column string, like interface{}) *ProjBusinessDao {
  468. return &ProjBusinessDao{M: d.M.WhereNotLike(column, like)}
  469. }
  470. // WhereNot builds "column != value" statement.
  471. func (d *ProjBusinessDao) WhereNot(column string, value interface{}) *ProjBusinessDao {
  472. return &ProjBusinessDao{M: d.M.WhereNot(column, value)}
  473. }
  474. // WhereNotIn builds "column NOT IN (in)" statement.
  475. func (d *ProjBusinessDao) WhereNotIn(column string, in interface{}) *ProjBusinessDao {
  476. return &ProjBusinessDao{M: d.M.WhereNotIn(column, in)}
  477. }
  478. // WhereNotNull builds "columns[0] IS NOT NULL AND columns[1] IS NOT NULL ..." statement.
  479. func (d *ProjBusinessDao) WhereNotNull(columns ...string) *ProjBusinessDao {
  480. return &ProjBusinessDao{M: d.M.WhereNotNull(columns...)}
  481. }
  482. // WhereOr adds "OR" condition to the where statement.
  483. func (d *ProjBusinessDao) WhereOr(where interface{}, args ...interface{}) *ProjBusinessDao {
  484. return &ProjBusinessDao{M: d.M.WhereOr(where, args...)}
  485. }
  486. // WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
  487. func (d *ProjBusinessDao) WhereOrf(format string, args ...interface{}) *ProjBusinessDao {
  488. return &ProjBusinessDao{M: d.M.WhereOrf(format, args...)}
  489. }
  490. // WhereOrLT builds "column < value" statement in "OR" conditions..
  491. func (d *ProjBusinessDao) WhereOrLT(column string, value interface{}) *ProjBusinessDao {
  492. return &ProjBusinessDao{M: d.M.WhereOrLT(column, value)}
  493. }
  494. // WhereOrLTE builds "column <= value" statement in "OR" conditions..
  495. func (d *ProjBusinessDao) WhereOrLTE(column string, value interface{}) *ProjBusinessDao {
  496. return &ProjBusinessDao{M: d.M.WhereOrLTE(column, value)}
  497. }
  498. // WhereOrGT builds "column > value" statement in "OR" conditions..
  499. func (d *ProjBusinessDao) WhereOrGT(column string, value interface{}) *ProjBusinessDao {
  500. return &ProjBusinessDao{M: d.M.WhereOrGT(column, value)}
  501. }
  502. // WhereOrGTE builds "column >= value" statement in "OR" conditions..
  503. func (d *ProjBusinessDao) WhereOrGTE(column string, value interface{}) *ProjBusinessDao {
  504. return &ProjBusinessDao{M: d.M.WhereOrGTE(column, value)}
  505. }
  506. // WhereOrBetween builds "column BETWEEN min AND max" statement in "OR" conditions.
  507. func (d *ProjBusinessDao) WhereOrBetween(column string, min, max interface{}) *ProjBusinessDao {
  508. return &ProjBusinessDao{M: d.M.WhereOrBetween(column, min, max)}
  509. }
  510. // WhereOrLike builds "column LIKE like" statement in "OR" conditions.
  511. func (d *ProjBusinessDao) WhereOrLike(column string, like interface{}) *ProjBusinessDao {
  512. return &ProjBusinessDao{M: d.M.WhereOrLike(column, like)}
  513. }
  514. // WhereOrIn builds "column IN (in)" statement in "OR" conditions.
  515. func (d *ProjBusinessDao) WhereOrIn(column string, in interface{}) *ProjBusinessDao {
  516. return &ProjBusinessDao{M: d.M.WhereOrIn(column, in)}
  517. }
  518. // WhereOrNull builds "columns[0] IS NULL OR columns[1] IS NULL ..." statement in "OR" conditions.
  519. func (d *ProjBusinessDao) WhereOrNull(columns ...string) *ProjBusinessDao {
  520. return &ProjBusinessDao{M: d.M.WhereOrNull(columns...)}
  521. }
  522. // WhereOrNotBetween builds "column NOT BETWEEN min AND max" statement in "OR" conditions.
  523. func (d *ProjBusinessDao) WhereOrNotBetween(column string, min, max interface{}) *ProjBusinessDao {
  524. return &ProjBusinessDao{M: d.M.WhereOrNotBetween(column, min, max)}
  525. }
  526. // WhereOrNotLike builds "column NOT LIKE like" statement in "OR" conditions.
  527. func (d *ProjBusinessDao) WhereOrNotLike(column string, like interface{}) *ProjBusinessDao {
  528. return &ProjBusinessDao{M: d.M.WhereOrNotLike(column, like)}
  529. }
  530. // WhereOrNotIn builds "column NOT IN (in)" statement.
  531. func (d *ProjBusinessDao) WhereOrNotIn(column string, in interface{}) *ProjBusinessDao {
  532. return &ProjBusinessDao{M: d.M.WhereOrNotIn(column, in)}
  533. }
  534. // WhereOrNotNull builds "columns[0] IS NOT NULL OR columns[1] IS NOT NULL ..." statement in "OR" conditions.
  535. func (d *ProjBusinessDao) WhereOrNotNull(columns ...string) *ProjBusinessDao {
  536. return &ProjBusinessDao{M: d.M.WhereOrNotNull(columns...)}
  537. }
  538. // Group sets the "GROUP BY" statement for the model.
  539. func (d *ProjBusinessDao) Group(groupBy ...string) *ProjBusinessDao {
  540. return &ProjBusinessDao{M: d.M.Group(groupBy...)}
  541. }
  542. // And adds "AND" condition to the where statement.
  543. // Deprecated, use Where instead.
  544. func (d *ProjBusinessDao) And(where interface{}, args ...interface{}) *ProjBusinessDao {
  545. return &ProjBusinessDao{M: d.M.And(where, args...)}
  546. }
  547. // Or adds "OR" condition to the where statement.
  548. // Deprecated, use WhereOr instead.
  549. func (d *ProjBusinessDao) Or(where interface{}, args ...interface{}) *ProjBusinessDao {
  550. return &ProjBusinessDao{M: d.M.Or(where, args...)}
  551. }
  552. // GroupBy sets the "GROUP BY" statement for the model.
  553. func (d *ProjBusinessDao) GroupBy(groupBy string) *ProjBusinessDao {
  554. return &ProjBusinessDao{M: d.M.Group(groupBy)}
  555. }
  556. // Order sets the "ORDER BY" statement for the model.
  557. func (d *ProjBusinessDao) Order(orderBy ...string) *ProjBusinessDao {
  558. return &ProjBusinessDao{M: d.M.Order(orderBy...)}
  559. }
  560. // OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
  561. func (d *ProjBusinessDao) OrderAsc(column string) *ProjBusinessDao {
  562. return &ProjBusinessDao{M: d.M.OrderAsc(column)}
  563. }
  564. // OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
  565. func (d *ProjBusinessDao) OrderDesc(column string) *ProjBusinessDao {
  566. return &ProjBusinessDao{M: d.M.OrderDesc(column)}
  567. }
  568. // OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
  569. func (d *ProjBusinessDao) OrderRandom() *ProjBusinessDao {
  570. return &ProjBusinessDao{M: d.M.OrderRandom()}
  571. }
  572. // OrderBy is alias of Model.Order.
  573. // See Model.Order.
  574. // Deprecated, use Order instead.
  575. func (d *ProjBusinessDao) OrderBy(orderBy string) *ProjBusinessDao {
  576. return &ProjBusinessDao{M: d.M.Order(orderBy)}
  577. }
  578. // Limit sets the "LIMIT" statement for the model.
  579. // The parameter <limit> can be either one or two number, if passed two number is passed,
  580. // it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
  581. // statement.
  582. func (d *ProjBusinessDao) Limit(limit ...int) *ProjBusinessDao {
  583. return &ProjBusinessDao{M: d.M.Limit(limit...)}
  584. }
  585. // Offset sets the "OFFSET" statement for the model.
  586. // It only makes sense for some databases like SQLServer, PostgreSQL, etc.
  587. func (d *ProjBusinessDao) Offset(offset int) *ProjBusinessDao {
  588. return &ProjBusinessDao{M: d.M.Offset(offset)}
  589. }
  590. // Distinct forces the query to only return distinct results.
  591. func (d *ProjBusinessDao) Distinct() *ProjBusinessDao {
  592. return &ProjBusinessDao{M: d.M.Distinct()}
  593. }
  594. // Page sets the paging number for the model.
  595. // The parameter <page> is started from 1 for paging.
  596. // Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
  597. func (d *ProjBusinessDao) Page(page, limit int) *ProjBusinessDao {
  598. return &ProjBusinessDao{M: d.M.Page(page, limit)}
  599. }
  600. // Batch sets the batch operation number for the model.
  601. func (d *ProjBusinessDao) Batch(batch int) *ProjBusinessDao {
  602. return &ProjBusinessDao{M: d.M.Batch(batch)}
  603. }
  604. // Cache sets the cache feature for the model. It caches the result of the sql, which means
  605. // if there's another same sql request, it just reads and returns the result from cache, it
  606. // but not committed and executed into the database.
  607. //
  608. // If the parameter <duration> < 0, which means it clear the cache with given <name>.
  609. // If the parameter <duration> = 0, which means it never expires.
  610. // If the parameter <duration> > 0, which means it expires after <duration>.
  611. //
  612. // The optional parameter <name> is used to bind a name to the cache, which means you can later
  613. // control the cache like changing the <duration> or clearing the cache with specified <name>.
  614. //
  615. // Note that, the cache feature is disabled if the model is operating on a transaction.
  616. func (d *ProjBusinessDao) Cache(duration time.Duration, name ...string) *ProjBusinessDao {
  617. return &ProjBusinessDao{M: d.M.Cache(duration, name...)}
  618. }
  619. // Data sets the operation data for the model.
  620. // The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
  621. // Eg:
  622. // Data("uid=10000")
  623. // Data("uid", 10000)
  624. // Data(g.Map{"uid": 10000, "name":"john"})
  625. // Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
  626. func (d *ProjBusinessDao) Data(data ...interface{}) *ProjBusinessDao {
  627. return &ProjBusinessDao{M: d.M.Data(data...)}
  628. }
  629. // All does "SELECT FROM ..." statement for the model.
  630. // It retrieves the records from table and returns the result as []*model.ProjBusiness.
  631. // It returns nil if there's no record retrieved with the given conditions from table.
  632. //
  633. // The optional parameter <where> is the same as the parameter of M.Where function,
  634. // see M.Where.
  635. func (d *ProjBusinessDao) All(where ...interface{}) ([]*model.ProjBusiness, error) {
  636. all, err := d.M.All(where...)
  637. if err != nil {
  638. return nil, err
  639. }
  640. var entities []*model.ProjBusiness
  641. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  642. return nil, err
  643. }
  644. return entities, nil
  645. }
  646. // One retrieves one record from table and returns the result as *model.ProjBusiness.
  647. // It returns nil if there's no record retrieved with the given conditions from table.
  648. //
  649. // The optional parameter <where> is the same as the parameter of M.Where function,
  650. // see M.Where.
  651. func (d *ProjBusinessDao) One(where ...interface{}) (*model.ProjBusiness, error) {
  652. one, err := d.M.One(where...)
  653. if err != nil {
  654. return nil, err
  655. }
  656. var entity *model.ProjBusiness
  657. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  658. return nil, err
  659. }
  660. return entity, nil
  661. }
  662. // FindOne retrieves and returns a single Record by M.WherePri and M.One.
  663. // Also see M.WherePri and M.One.
  664. func (d *ProjBusinessDao) FindOne(where ...interface{}) (*model.ProjBusiness, error) {
  665. one, err := d.M.FindOne(where...)
  666. if err != nil {
  667. return nil, err
  668. }
  669. var entity *model.ProjBusiness
  670. if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
  671. return nil, err
  672. }
  673. return entity, nil
  674. }
  675. // FindAll retrieves and returns Result by by M.WherePri and M.All.
  676. // Also see M.WherePri and M.All.
  677. func (d *ProjBusinessDao) FindAll(where ...interface{}) ([]*model.ProjBusiness, error) {
  678. all, err := d.M.FindAll(where...)
  679. if err != nil {
  680. return nil, err
  681. }
  682. var entities []*model.ProjBusiness
  683. if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
  684. return nil, err
  685. }
  686. return entities, nil
  687. }
  688. // Struct retrieves one record from table and converts it into given struct.
  689. // The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
  690. // it can create the struct internally during converting.
  691. //
  692. // The optional parameter <where> is the same as the parameter of Model.Where function,
  693. // see Model.Where.
  694. //
  695. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  696. // from table and <pointer> is not nil.
  697. //
  698. // Eg:
  699. // user := new(User)
  700. // err := dao.User.Where("id", 1).Struct(user)
  701. //
  702. // user := (*User)(nil)
  703. // err := dao.User.Where("id", 1).Struct(&user)
  704. func (d *ProjBusinessDao) Struct(pointer interface{}, where ...interface{}) error {
  705. return d.M.Struct(pointer, where...)
  706. }
  707. // Structs retrieves records from table and converts them into given struct slice.
  708. // The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
  709. // slice internally during converting.
  710. //
  711. // The optional parameter <where> is the same as the parameter of Model.Where function,
  712. // see Model.Where.
  713. //
  714. // Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
  715. // from table and <pointer> is not empty.
  716. //
  717. // Eg:
  718. // users := ([]User)(nil)
  719. // err := dao.User.Structs(&users)
  720. //
  721. // users := ([]*User)(nil)
  722. // err := dao.User.Structs(&users)
  723. func (d *ProjBusinessDao) Structs(pointer interface{}, where ...interface{}) error {
  724. return d.M.Structs(pointer, where...)
  725. }
  726. // Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
  727. // It calls function Struct if <pointer> is type of *struct/**struct.
  728. // It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
  729. //
  730. // The optional parameter <where> is the same as the parameter of Model.Where function,
  731. // see Model.Where.
  732. //
  733. // Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
  734. //
  735. // Eg:
  736. // user := new(User)
  737. // err := dao.User.Where("id", 1).Scan(user)
  738. //
  739. // user := (*User)(nil)
  740. // err := dao.User.Where("id", 1).Scan(&user)
  741. //
  742. // users := ([]User)(nil)
  743. // err := dao.User.Scan(&users)
  744. //
  745. // users := ([]*User)(nil)
  746. // err := dao.User.Scan(&users)
  747. func (d *ProjBusinessDao) Scan(pointer interface{}, where ...interface{}) error {
  748. return d.M.Scan(pointer, where...)
  749. }
  750. // Chunk iterates the table with given size and callback function.
  751. func (d *ProjBusinessDao) Chunk(limit int, callback func(entities []*model.ProjBusiness, err error) bool) {
  752. d.M.Chunk(limit, func(result gdb.Result, err error) bool {
  753. var entities []*model.ProjBusiness
  754. err = result.Structs(&entities)
  755. if err == sql.ErrNoRows {
  756. return false
  757. }
  758. return callback(entities, err)
  759. })
  760. }
  761. // LockUpdate sets the lock for update for current operation.
  762. func (d *ProjBusinessDao) LockUpdate() *ProjBusinessDao {
  763. return &ProjBusinessDao{M: d.M.LockUpdate()}
  764. }
  765. // LockShared sets the lock in share mode for current operation.
  766. func (d *ProjBusinessDao) LockShared() *ProjBusinessDao {
  767. return &ProjBusinessDao{M: d.M.LockShared()}
  768. }
  769. // Unscoped enables/disables the soft deleting feature.
  770. func (d *ProjBusinessDao) Unscoped() *ProjBusinessDao {
  771. return &ProjBusinessDao{M: d.M.Unscoped()}
  772. }
  773. // DataScope enables the DataScope feature.
  774. func (d *ProjBusinessDao) DataScope(userCol ...string) *ProjBusinessDao {
  775. ctx := d.GetCtx().Value("contextService")
  776. dataScope := gconv.Map(ctx)["dataScope"].(g.Map)
  777. if dataScope != nil {
  778. if userIds, ok := dataScope["userIds"]; ok {
  779. column := "created_by"
  780. if len(userCol) == 1 {
  781. column = userCol[0]
  782. }
  783. delete(dataScope, "userIds")
  784. dataScope[column] = userIds
  785. }
  786. return &ProjBusinessDao{M: d.M.Where(dataScope)}
  787. }
  788. return d
  789. }