@@ -1,7 +1,11 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
"xorm.io/xorm" | |||||
) | |||||
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) | |||||
} | } |
@@ -0,0 +1,10 @@ | |||||
package dao | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
"xorm.io/xorm" | |||||
) | |||||
type InstallmentPaymentRepaidFlowDao interface { | |||||
InsertInstallmentPaymentRepaidFlowBySession(session *xorm.Session, m *models.InstallmentPaymentRepaidFlow) (id int, err error) | |||||
} |
@@ -15,6 +15,22 @@ type InstallmentPaymentListDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (i InstallmentPaymentListDb) UpdateInstallmentPaymentListBySess(sess *xorm.Session, m *models.InstallmentPaymentList, forceColums ...string) (int64, error) { | |||||
var ( | |||||
affected int64 | |||||
err error | |||||
) | |||||
if forceColums != nil { | |||||
affected, err = sess.Where("id=?", m.Id).Cols(forceColums...).Update(m) | |||||
} else { | |||||
affected, err = sess.Where("id=?", m.Id).Update(m) | |||||
} | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (i InstallmentPaymentListDb) GetInstallmentPaymentListById(id int) (m *models.InstallmentPaymentList, err error) { | func (i InstallmentPaymentListDb) GetInstallmentPaymentListById(id int) (m *models.InstallmentPaymentList, err error) { | ||||
m = new(models.InstallmentPaymentList) | m = new(models.InstallmentPaymentList) | ||||
has, err := i.Db.Where("id =?", id).Get(m) | has, err := i.Db.Where("id =?", id).Get(m) | ||||
@@ -0,0 +1,23 @@ | |||||
package implement | |||||
import ( | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewInstallmentPaymentRepaidFlowDb(engine *xorm.Engine) dao.InstallmentPaymentRepaidFlowDao { | |||||
return &InstallmentPaymentRepaidFlowDb{Db: engine} | |||||
} | |||||
type InstallmentPaymentRepaidFlowDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (i InstallmentPaymentRepaidFlowDb) InsertInstallmentPaymentRepaidFlowBySession(session *xorm.Session, m *models.InstallmentPaymentRepaidFlow) (id int, err error) { | |||||
_, err = session.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} |
@@ -0,0 +1,11 @@ | |||||
package models | |||||
type InstallmentPaymentRepaidFlow struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
RecordId int `json:"record_id" xorm:"not null default 0 comment('记录ID') INT(11)"` | |||||
Uid int `json:"uid" xorm:"not null default 0 comment('用户ID') INT(11)"` | |||||
Amount string `json:"amount" xorm:"not null default 0.0 comment('金额') DECIMAL(12,1)"` | |||||
WhichRepaymentPeriod int `json:"which_repayment_period" xorm:"not null default 1 comment('第x还款') TINYINT(3)"` | |||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` | |||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` | |||||
} |