This commit is contained in:
苏尹岚
2021-03-03 17:59:36 +08:00
parent 8547d2d3b0
commit d43b57660a

View File

@@ -1136,3 +1136,31 @@ func GetStoreAcctExpendTotal(db *DaoDB, storeID int, expendTypes []int, vendorOr
err = GetRow(db, &expend, sql, sqlParams)
return expend.ExpendPrice, err
}
type GetStoreAcctExpendLastCreateWayBillFeeResult struct {
}
func GetStoreAcctExpendLastCreateWayBillFee(db *DaoDB, vendorOrderID string) (lastFee int, err error) {
var expend *model.StoreAcctExpend
sql := `
SELECT a.id, b.id exp_id, c.id inc_id
FROM store_acct_expend a
LEFT JOIN store_acct_expend b ON a.id = b.exp_id
LEFT JOIN store_acct_income c ON a.id = c.exp_id
WHERE 1 = 1
AND a.type = ?
`
sqlParams := []interface{}{
20,
}
if vendorOrderID != "" {
sql += " AND vendor_order_id = ?"
sqlParams = append(sqlParams, vendorOrderID)
}
sql += `
ORDER BY a.created_at DESC
LIMIT 1
`
err = GetRow(db, &expend, sql, sqlParams)
return expend.ExpendPrice, err
}