|
@@ -0,0 +1,67 @@
|
|
|
+package eta_business_remind_record
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+// EtaBusinessRemindRecord 客户提醒记录
|
|
|
+type EtaBusinessRemindRecord struct {
|
|
|
+ CompanyRemindRecordId int `orm:"column(eta_business_remind_record_id);pk"`
|
|
|
+ Type int `description:"过期类型:1-1天;2-7天;3-15天;4-30天;5-60天"`
|
|
|
+ SellerId int `description:"销售id"`
|
|
|
+ SellerName string `description:"销售名称"`
|
|
|
+ EtaBusinessId int `description:"ETA商家ID"`
|
|
|
+ BusinessName string `description:"商家名称"`
|
|
|
+ EndDate string `description:"到期日期"`
|
|
|
+ UniqueCode string `description:"唯一code"`
|
|
|
+ CreateTime time.Time
|
|
|
+}
|
|
|
+
|
|
|
+func (m *EtaBusinessRemindRecord) TableName() string {
|
|
|
+ return "eta_business_remind_record"
|
|
|
+}
|
|
|
+
|
|
|
+func (m *EtaBusinessRemindRecord) Create() (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ id, err := o.Insert(m)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ m.CompanyRemindRecordId = int(id)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (m *EtaBusinessRemindRecord) CreateMulti(items []*EtaBusinessRemindRecord) (err error) {
|
|
|
+ if len(items) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ o := orm.NewOrm()
|
|
|
+ _, err = o.InsertMulti(len(items), items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (m *EtaBusinessRemindRecord) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EtaBusinessRemindRecord, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ fields := strings.Join(fieldArr, ",")
|
|
|
+ if len(fieldArr) == 0 {
|
|
|
+ fields = `*`
|
|
|
+ }
|
|
|
+ order := `ORDER BY create_time DESC`
|
|
|
+ if orderRule != "" {
|
|
|
+ order = ` ORDER BY ` + orderRule
|
|
|
+ }
|
|
|
+ sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
|
|
|
+ _, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// EtaBusinessRemindRecordResp ETA商家即将过期列表响应体
|
|
|
+type EtaBusinessRemindRecordResp struct {
|
|
|
+ RemindType int `description:"过期类型,1:1天,2:7天,3:15天;4:30天"`
|
|
|
+ Total int `description:"总数量"`
|
|
|
+ EndDate string `description:"到期日期"`
|
|
|
+ List []*EtaBusinessRemindRecord `description:"数据列表"`
|
|
|
+}
|