package company import ( "github.com/beego/beego/v2/client/orm" "time" ) type CompanyNoRenewedNote struct { NoRenewedNoteId int `orm:"column(no_renewed_note_id);pk" description:"主键ID"` Content string `description:"内容说明"` AdminId int `description:"管理员ID"` CompanyId int `description:"公司ID"` ProductId int `description:"产品id"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"更新时间"` } type CompanyNoRenewedNoteResp struct { NoRenewedNoteId int `orm:"column(no_renewed_note_id);pk" description:"主键ID"` CompanyId int `description:"公司ID"` Content string `description:"内容说明"` AdminId int `description:"管理员ID"` ProductId int `description:"产品id"` CreateTime string `description:"创建时间"` } type CompanyNoRenewedNoteListResp struct { List []*CompanyNoRenewedNoteResp } type CompanyNoRenewedNoteReq struct { Content string `description:"内容说明"` CompanyId int `description:"公司ID"` ProductId int `description:"产品id"` } // 添加 func AddCompanyNoRenewedNote(item *CompanyNoRenewedNote) (newId int64, err error) { o := orm.NewOrm() newId, err = o.Insert(item) return } // 获取数量 func GetCompanyNoRenewedNoteCount(condition string, pars []interface{}) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM company_no_renewed_note as a WHERE 1= 1 ` if condition != "" { sqlCount += condition } o := orm.NewOrm() err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 列表 func GetCompanyNoRenewedNoteList(condition string, pars []interface{}, startSize, pageSize int) (items []*CompanyNoRenewedNoteResp, err error) { o := orm.NewOrm() sql := `SELECT * FROM company_no_renewed_note as a WHERE 1= 1 ` if condition != "" { sql += condition } if startSize+pageSize > 0 { sql += ` LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) } _, err = o.Raw(sql, pars).QueryRows(&items) return }