新增 修改提现审核状态
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
)
|
||||
|
||||
type DoctorAccountDao struct {
|
||||
}
|
||||
|
||||
// GetDoctorAccountById 获取医生账户数据-账户id
|
||||
func (r *DoctorAccountDao) GetDoctorAccountById(accountId int64) (m *model.DoctorAccount, err error) {
|
||||
err = global.Db.First(&m, accountId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// GetDoctorAccountByDoctorId 获取医生账户数据-医生id
|
||||
func (r *DoctorAccountDao) GetDoctorAccountByDoctorId(doctorId int64) (m *model.DoctorAccount, err error) {
|
||||
err = global.Db.Where("doctor_id = ?", doctorId).First(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// DeleteDoctorAccount 删除医生账户
|
||||
func (r *DoctorAccountDao) DeleteDoctorAccount(tx *gorm.DB, maps interface{}) error {
|
||||
err := tx.Where(maps).Delete(&model.DoctorAccount{}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditDoctorAccount 修改医生账户
|
||||
func (r *DoctorAccountDao) EditDoctorAccount(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||
err := tx.Model(&model.DoctorAccount{}).Where(maps).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditDoctorAccountById 修改医生账户-医生账户id
|
||||
func (r *DoctorAccountDao) EditDoctorAccountById(tx *gorm.DB, accountId int64, data interface{}) error {
|
||||
err := tx.Model(&model.DoctorAccount{}).Where("account_id = ?", accountId).Updates(data).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDoctorAccountList 获取医生账户列表
|
||||
func (r *DoctorAccountDao) GetDoctorAccountList(maps interface{}) (m []*model.DoctorAccount, err error) {
|
||||
err = global.Db.Where(maps).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// AddDoctorAccount 新增医生账户
|
||||
func (r *DoctorAccountDao) AddDoctorAccount(tx *gorm.DB, model *model.DoctorAccount) (*model.DoctorAccount, error) {
|
||||
if err := tx.Create(model).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return model, nil
|
||||
}
|
||||
|
||||
// Dec 自减
|
||||
func (r *DoctorAccountDao) Dec(tx *gorm.DB, maps interface{}, numeral float64, field string) error {
|
||||
err := tx.Model(&model.DoctorAccount{}).Where(maps).Update(field, gorm.Expr(field+" - ?", numeral)).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Inc 自增
|
||||
func (r *DoctorAccountDao) Inc(tx *gorm.DB, maps interface{}, numeral float64, field string) error {
|
||||
err := tx.Model(&model.DoctorAccount{}).Where(maps).Update(field, gorm.Expr(field+" + ?", numeral)).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -11,7 +11,7 @@ type DoctorWithdrawalOrderDao struct {
|
||||
}
|
||||
|
||||
// GetDoctorWithdrawalOrderById 获取医生提现关联订单数据-id
|
||||
func (r *DoctorWithdrawalOrderDao) GetDoctorWithdrawalOrderById(withdrawalBankId int64) (m *model.DoctorWithdrawalBank, err error) {
|
||||
func (r *DoctorWithdrawalOrderDao) GetDoctorWithdrawalOrderById(withdrawalBankId int64) (m *model.DoctorWithdrawalOrder, err error) {
|
||||
err = global.Db.First(&m, withdrawalBankId).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -20,8 +20,8 @@ func (r *DoctorWithdrawalOrderDao) GetDoctorWithdrawalOrderById(withdrawalBankId
|
||||
}
|
||||
|
||||
// GetDoctorWithdrawalOrderByWithdrawalId 获取医生提现关联订单数据-提现id
|
||||
func (r *DoctorWithdrawalOrderDao) GetDoctorWithdrawalOrderByWithdrawalId(withdrawalId int64) (m *model.DoctorWithdrawalBank, err error) {
|
||||
err = global.Db.Where("withdrawal_id = ?", withdrawalId).First(&m).Error
|
||||
func (r *DoctorWithdrawalOrderDao) GetDoctorWithdrawalOrderByWithdrawalId(withdrawalId int64) (m []*model.DoctorWithdrawalOrder, err error) {
|
||||
err = global.Db.Where("withdrawal_id = ?", withdrawalId).Find(&m).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user