123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- package service
-
- import "XT_Admin_Api/models"
-
- func FindCustomInfo(org_id int64) (admin models.KyyChargeCustom, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeCustom{}).Where("xt_org_id = ? AND status = 1", org_id).First(&admin).Error
- return
- }
-
- func CreateCustom(admin *models.KyyChargeCustom) (err error) {
- err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
- return
- }
-
- func SaveCustom(admin *models.KyyChargeCustom) (err error) {
- err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
- return
- }
- func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllPaymentCollections() (cus []*models.KyyChargePaymentCollection, err error) {
- err = ChargeReadDB().Model(&models.KyyChargePaymentCollection{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllChargeContacts() (cus []*models.KyyChargeContact, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeContact{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllChargeContracts() (cus []*models.KyyChargeContract, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeContract{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllChargeDemand() (cus []*models.KyyChargeDemand, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeDemand{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllChargeFollow() (cus []*models.KyyChargeFollow, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func GetAllChargeRenewal() (cus []*models.KyyChargeRenewal, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeRenewal{}).Where("status = 1").Find(&cus).Error
- return
- }
-
- func FindCustomInfoByID(id int64) (admin models.KyyChargeCustom, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeCustom{}).
- Preload("KyyChargePaymentCollection", "status = 1").
- Preload("KyyChargeContact", "status = 1").
- Preload("KyyChargeContract", "status = 1").
- Preload("KyyChargeDemand", "status = 1").
- Preload("KyyChargeFollow", "status = 1").
- Preload("KyyChargeRenewal", "status = 1").
- Where("id = ? AND status = 1", id).First(&admin).Error
- return
- }
-
- func FindCustomInfoByIDTwo(id int64) (admin models.KyyChargeCustomThree, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeCustomThree{}).
- Where("id = ? AND status = 1", id).First(&admin).Error
- return
- }
- func UpdateCustom(custom models.KyyChargeCustom) (err error) {
- err = ChargeWriteDB().Save(&custom).Error
- return
- }
- func UpdateCustomTwo(custom models.KyyChargeCustomThree) (err error) {
- err = ChargeWriteDB().Save(&custom).Error
- return
- }
-
- func CreateChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
- err = ChargeWriteDB().Save(&cpc).Error
- return
- }
-
- func SaveChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
- err = ChargeWriteDB().Save(&cpc).Error
- return
- }
-
- func FindPaymentCollectionInfo(id int64) (cpc models.KyyChargePaymentCollection, err error) {
- err = ChargeReadDB().Model(&models.KyyChargePaymentCollection{}).Where("id = ? AND status = 1", id).First(&cpc).Error
- return
- }
-
- func SaveChargeContact(chargeContact *models.KyyChargeContact) (err error) {
- err = ChargeWriteDB().Save(&chargeContact).Error
- return
- }
-
- func FindChargeContactInfo(id int64) (cpc models.KyyChargeContact, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeContact{}).Where("id = ? AND status = 1", id).First(&cpc).Error
- return
- }
-
- func SaveChargeContract(chargeContract *models.KyyChargeContract) (err error) {
- err = ChargeWriteDB().Save(&chargeContract).Error
- return
- }
-
- func FindChargeContractInfo(id int64) (cpc models.KyyChargeContract, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeContract{}).Where("id = ? AND status = 1", id).First(&cpc).Error
- return
- }
-
- func SaveChargeFollow(chargeFollow *models.KyyChargeFollow) (err error) {
- err = ChargeWriteDB().Save(&chargeFollow).Error
- return
- }
-
- func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("id = ? AND status = 1", id).First(&cf).Error
- return
- }
-
- func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
- err = ChargeWriteDB().Save(&cd).Error
- return
- }
-
- func FindChargeDemandInfo(id int64) (cd models.KyyChargeDemand, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeDemand{}).Where("id = ? AND status = 1", id).First(&cd).Error
- return
- }
-
- func SaveChargeRenewal(chargeRenewal *models.KyyChargeRenewal) (err error) {
- err = ChargeWriteDB().Save(&chargeRenewal).Error
- return
- }
-
- func FindChargeRenewalInfo(id int64) (chargeRenewal models.KyyChargeRenewal, err error) {
- err = ChargeReadDB().Model(&models.KyyChargeRenewal{}).Where("id = ? AND status = 1", id).First(&chargeRenewal).Error
- return
- }
|