company_no_renewed_note.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CompanyNoRenewedNote struct {
  7. NoRenewedNoteId int `orm:"column(no_renewed_note_id);pk" description:"主键ID"`
  8. Content string `description:"内容说明"`
  9. AdminId int `description:"管理员ID"`
  10. CompanyId int `description:"公司ID"`
  11. ProductId int `description:"产品id"`
  12. CreateTime time.Time `description:"创建时间"`
  13. ModifyTime time.Time `description:"更新时间"`
  14. }
  15. type CompanyNoRenewedNoteResp struct {
  16. NoRenewedNoteId int `orm:"column(no_renewed_note_id);pk" description:"主键ID"`
  17. CompanyId int `description:"公司ID"`
  18. Content string `description:"内容说明"`
  19. AdminId int `description:"管理员ID"`
  20. ProductId int `description:"产品id"`
  21. CreateTime string `description:"创建时间"`
  22. }
  23. type CompanyNoRenewedNoteListResp struct {
  24. List []*CompanyNoRenewedNoteResp
  25. }
  26. type CompanyNoRenewedNoteReq struct {
  27. Content string `description:"内容说明"`
  28. CompanyId int `description:"公司ID"`
  29. ProductId int `description:"产品id"`
  30. }
  31. // 添加
  32. func AddCompanyNoRenewedNote(item *CompanyNoRenewedNote) (newId int64, err error) {
  33. o := orm.NewOrm()
  34. newId, err = o.Insert(item)
  35. return
  36. }
  37. // 获取数量
  38. func GetCompanyNoRenewedNoteCount(condition string, pars []interface{}) (count int, err error) {
  39. sqlCount := ` SELECT COUNT(1) AS count FROM company_no_renewed_note as a WHERE 1= 1 `
  40. if condition != "" {
  41. sqlCount += condition
  42. }
  43. o := orm.NewOrm()
  44. err = o.Raw(sqlCount, pars).QueryRow(&count)
  45. return
  46. }
  47. // 列表
  48. func GetCompanyNoRenewedNoteList(condition string, pars []interface{}, startSize, pageSize int) (items []*CompanyNoRenewedNoteResp, err error) {
  49. o := orm.NewOrm()
  50. sql := `SELECT * FROM company_no_renewed_note as a WHERE 1= 1 `
  51. if condition != "" {
  52. sql += condition
  53. }
  54. if startSize+pageSize > 0 {
  55. sql += ` LIMIT ?,? `
  56. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  57. }
  58. _, err = o.Raw(sql, pars).QueryRows(&items)
  59. return
  60. }