[天神模式]删除符合条件表计公摊关系完成

This commit is contained in:
2023-07-31 09:50:41 +08:00
parent c36bfff05a
commit 9b899be33d
2 changed files with 36 additions and 0 deletions

View File

@@ -175,3 +175,25 @@ func (gm _GMService) DeleteEnterprises(uid string) error {
}
return nil
}
func (gm _GMService) DeleteMeterPooling(pId string, mId []string) error {
ctx, cancel := global.TimeoutContext()
defer cancel()
tx, err := global.DB.Begin(ctx)
if err != nil {
gm.l.Error("开启数据库事务失败。", zap.Error(err))
return err
}
if err := repository.GMRepository.DeleteMeterPoolings(ctx, tx, pId, mId); err != nil {
gm.l.Error("无法删除指定表记公摊关系。", zap.Error(err))
tx.Rollback(ctx)
return err
}
err = tx.Commit(ctx)
if err != nil {
gm.l.Error("未能成功提交数据库事务。", zap.Error(err))
tx.Rollback(ctx)
return err
}
return nil
}