Browse Source

update

master
dengbiao 6 months ago
parent
commit
4b01cd4eac
5 changed files with 65 additions and 1 deletions
  1. +5
    -1
      src/dao/installment_payment_list_dao.go
  2. +10
    -0
      src/dao/installment_payment_repaid_flow_dao.go
  3. +16
    -0
      src/implement/installment_payment_list_db.go
  4. +23
    -0
      src/implement/installment_payment_repaid_flow_db.go
  5. +11
    -0
      src/models/installment_payment_repaid_flow.go

+ 5
- 1
src/dao/installment_payment_list_dao.go View File

@@ -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)
} }

+ 10
- 0
src/dao/installment_payment_repaid_flow_dao.go View File

@@ -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)
}

+ 16
- 0
src/implement/installment_payment_list_db.go View File

@@ -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)


+ 23
- 0
src/implement/installment_payment_repaid_flow_db.go View File

@@ -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
}

+ 11
- 0
src/models/installment_payment_repaid_flow.go View File

@@ -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"`
}

Loading…
Cancel
Save