|
|
@@ -2,13 +2,36 @@ |
|
|
|
|
|
|
|
import ( |
|
|
|
"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" |
|
|
|
) |
|
|
|
|
|
|
|
func NewInstallmentPaymentSchemeDb(engine *xorm.Engine) dao.InstallmentPaymentSchemeDao { |
|
|
|
return &InstallmentPaymentSchemeDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type InstallmentPaymentSchemeDb struct { |
|
|
|
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 |
|
|
|
} |