proj_business.go 41 KB

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