advice.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type CygxAdvice struct {
  7. AdviceId int `description:"优化建议id"`
  8. UserId int `description:"用户id"`
  9. UserRealName string `description:"姓名"`
  10. CompanyId int `description:"公司id"`
  11. CompanyName string `description:"公司名称"`
  12. SalesRealName string `description:"所属销售"`
  13. Advice string `description:"优化建议"`
  14. AdviceImgUrl string `description:"图片,多张用#分割"`
  15. CreateTime string `description:"访谈时间"`
  16. Mobile string `description:"手机号"`
  17. Email string `description:"邮箱"`
  18. }
  19. type AdviceListResp struct {
  20. Paging *paging.PagingItem
  21. List []*CygxAdvice
  22. }
  23. func GetAdviceListCount(condition string, pars []interface{}) (count int, err error) {
  24. o := orm.NewOrmUsingDB("hz_cygx")
  25. sql := `SELECT COUNT(1) AS count FROM cygx_advice AS a `
  26. if condition != "" {
  27. sql += condition
  28. }
  29. err = o.Raw(sql, pars).QueryRow(&count)
  30. return
  31. }
  32. func GetAdviceList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxAdvice, err error) {
  33. o := orm.NewOrmUsingDB("hz_cygx")
  34. sql := ` SELECT a.* FROM cygx_advice AS a `
  35. if condition != "" {
  36. sql += condition
  37. }
  38. sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
  39. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  40. return
  41. }