|
@@ -0,0 +1,59 @@
|
|
|
+package company
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type CompanyAscribe struct {
|
|
|
+ CompanyAscribeId int `orm:"column(company_ascribe_id);pk" description:"归因ID"`
|
|
|
+ AscribeContent string `description:"归因说明"`
|
|
|
+ AdminId int `description:"管理员ID"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+}
|
|
|
+
|
|
|
+type CompanyAscribeResp struct {
|
|
|
+ CompanyAscribeId int `orm:"column(company_ascribe_id);pk" description:"归因ID"`
|
|
|
+ AscribeContent string `description:"归因说明"`
|
|
|
+ AdminId int `description:"管理员ID"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+}
|
|
|
+
|
|
|
+type CompanyAscribeListResp struct {
|
|
|
+ List []*CompanyAscribeResp
|
|
|
+}
|
|
|
+
|
|
|
+type CompanyAscribeAddReq struct {
|
|
|
+ AscribeContent string `description:"归因说明"`
|
|
|
+}
|
|
|
+
|
|
|
+// 添加
|
|
|
+func AddCompanyAscribe(item *CompanyAscribe) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ _, err = o.Insert(item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 获取数量
|
|
|
+func GetCompanyAscribeCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
+ sqlCount := ` SELECT COUNT(1) AS count FROM company_ascribe as a WHERE 1= 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sqlCount += condition
|
|
|
+ }
|
|
|
+ o := orm.NewOrm()
|
|
|
+ err = o.Raw(sqlCount, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 列表
|
|
|
+func GetCygxProductInteriorList(condition string, pars []interface{}, startSize, pageSize int) (items []*CompanyAscribeResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM company_ascribe as a WHERE 1= 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|