|
|
@@ -0,0 +1,44 @@ |
|
|
|
package db |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
// ZhiosAlipayMasterAuthInsert 插入单条数据 |
|
|
|
func ZhiosAlipayMasterAuthInsert(officialDb *xorm.Engine, ZhiosAlipayMasterAuth *model.ZhiosAlipayMasterAuth) (int, error) { |
|
|
|
_, err := officialDb.InsertOne(ZhiosAlipayMasterAuth) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return ZhiosAlipayMasterAuth.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetZhiosAlipayMasterAuth(officialDb *xorm.Engine, masterId int, date string) (m *model.ZhiosAlipayMasterAuth, err error) { |
|
|
|
m = new(model.ZhiosAlipayMasterAuth) |
|
|
|
has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func ZhiosAlipayMasterAuthUpdate(officialDb *xorm.Engine, id interface{}, m *model.ZhiosAlipayMasterAuth, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m) |
|
|
|
} else { |
|
|
|
affected, err = officialDb.Where("id=?", id).Update(m) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |