@@ -8,4 +8,5 @@ import ( | |||||
type InstallmentPaymentListDao interface { | type InstallmentPaymentListDao interface { | ||||
GetInstallmentPaymentListById(id int) (m *models.InstallmentPaymentList, err error) | GetInstallmentPaymentListById(id int) (m *models.InstallmentPaymentList, err error) | ||||
UpdateInstallmentPaymentListBySess(sess *xorm.Session, m *models.InstallmentPaymentList, forceColums ...string) (int64, error) | UpdateInstallmentPaymentListBySess(sess *xorm.Session, m *models.InstallmentPaymentList, forceColums ...string) (int64, error) | ||||
InsertInstallmentPaymentList(m *models.InstallmentPaymentList) (id int, err error) | |||||
} | } |
@@ -1,5 +1,8 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
type InstallmentPaymentSchemeDao interface { | type InstallmentPaymentSchemeDao interface { | ||||
//TODO:: You can add specific method definitions here | |||||
InsertInstallmentPaymentScheme(m *models.InstallmentPaymentScheme) (id int, err error) | |||||
GetInstallmentPaymentSchemeById(id int) (m *models.InstallmentPaymentScheme, err error) | |||||
} | } |
@@ -15,6 +15,15 @@ type InstallmentPaymentListDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (i InstallmentPaymentListDb) InsertInstallmentPaymentList(m *models.InstallmentPaymentList) (id int, err error) { | |||||
_, err = i.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
id = m.Id | |||||
return id, nil | |||||
} | |||||
func (i InstallmentPaymentListDb) UpdateInstallmentPaymentListBySess(sess *xorm.Session, m *models.InstallmentPaymentList, forceColums ...string) (int64, error) { | func (i InstallmentPaymentListDb) UpdateInstallmentPaymentListBySess(sess *xorm.Session, m *models.InstallmentPaymentList, forceColums ...string) (int64, error) { | ||||
var ( | var ( | ||||
affected int64 | affected int64 | ||||
@@ -2,13 +2,36 @@ | |||||
import ( | import ( | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
func NewInstallmentPaymentSchemeDb(engine *xorm.Engine) dao.InstallmentPaymentSchemeDao { | |||||
return &InstallmentPaymentSchemeDb{Db: engine} | |||||
} | |||||
type InstallmentPaymentSchemeDb struct { | type InstallmentPaymentSchemeDb struct { | ||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func NewInstallmentPaymentSchemeDb(engine *xorm.Engine) dao.InstallmentPaymentSchemeDao { | |||||
return &InstallmentPaymentSchemeDb{Db: engine} | |||||
func (i InstallmentPaymentSchemeDb) InsertInstallmentPaymentScheme(m *models.InstallmentPaymentScheme) (id int, err error) { | |||||
_, err = i.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
id = m.Id | |||||
return id, nil | |||||
} | |||||
func (i InstallmentPaymentSchemeDb) GetInstallmentPaymentSchemeById(id int) (m *models.InstallmentPaymentScheme, err error) { | |||||
m = new(models.InstallmentPaymentScheme) | |||||
has, err := i.Db.Where("id =?", id).Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | } |