|
|
@@ -1,8 +1,9 @@ |
|
|
|
package implement |
|
|
|
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" |
|
|
|
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
@@ -39,6 +40,17 @@ func (i InstallmentPaymentListDb) UpdateInstallmentPaymentListBySess(sess *xorm. |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
func (i InstallmentPaymentListDb) GetInstallmentPaymentListByOid(id string) (m *models.InstallmentPaymentList, err error) { |
|
|
|
m = new(models.InstallmentPaymentList) |
|
|
|
has, err := i.Db.Where("ord_id =?", id).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (i InstallmentPaymentListDb) GetInstallmentPaymentListById(id int) (m *models.InstallmentPaymentList, err error) { |
|
|
|
m = new(models.InstallmentPaymentList) |
|
|
@@ -51,3 +63,39 @@ func (i InstallmentPaymentListDb) GetInstallmentPaymentListById(id int) (m *mode |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (i InstallmentPaymentListDb) GetInstallmentPaymentListByIdSess(sess *xorm.Session, id string) (m *models.InstallmentPaymentList, err error) { |
|
|
|
m = new(models.InstallmentPaymentList) |
|
|
|
has, err := sess.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 |
|
|
|
} |
|
|
|
func (i InstallmentPaymentListDb) GetInstallmentPaymentListByOidSess(sess *xorm.Session, id string) (m *models.InstallmentPaymentList, err error) { |
|
|
|
m = new(models.InstallmentPaymentList) |
|
|
|
has, err := sess.Where("ord_id =?", id).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (i InstallmentPaymentListDb) FinInstallmentPaymentList(arg map[string]string) (m *[]models.InstallmentPaymentList, err error) { |
|
|
|
mm := make([]models.InstallmentPaymentList, 0) |
|
|
|
sess := i.Db.Where("uid=?", arg["uid"]) |
|
|
|
if arg["state"] != "" { |
|
|
|
sess.And("is_repaid_off=?", zhios_order_relate_utils.StrToInt(arg["state"])-1) |
|
|
|
} |
|
|
|
size := zhios_order_relate_utils.StrToInt(arg["size"]) |
|
|
|
start := (zhios_order_relate_utils.StrToInt(arg["p"]) - 1) * size |
|
|
|
err = sess.Limit(size, start).Desc("id").Find(&mm) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &mm, nil |
|
|
|
} |