outer join for tenant-saldo-query
This commit is contained in:
parent
97dfcbe2fb
commit
b8083ec41e
@ -37,8 +37,7 @@ def get_tenant_with_saldo(user, token_info):
|
|||||||
return dbGetMany(user, token_info, {
|
return dbGetMany(user, token_info, {
|
||||||
"statement": """
|
"statement": """
|
||||||
SELECT t.id, t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
|
SELECT t.id, t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
|
||||||
FROM tenant_t t, account_entry_t a
|
FROM tenant_t t LEFT OUTER JOIN account_entry_t a ON a.account = t.account
|
||||||
WHERE a.account = t.account
|
|
||||||
GROUP BY t.id, t.firstname, t.lastname, t.address1
|
GROUP BY t.id, t.firstname, t.lastname, t.address1
|
||||||
""",
|
""",
|
||||||
"params": ()
|
"params": ()
|
||||||
|
@ -90,11 +90,18 @@ export class TenantDetailsComponent implements OnInit {
|
|||||||
async getTenant(): Promise<void> {
|
async getTenant(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const id = +this.route.snapshot.paramMap.get('id')
|
const id = +this.route.snapshot.paramMap.get('id')
|
||||||
|
this.messageService.add(`getTenant, id=${id}`)
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
|
this.messageService.add("getTenant, not-0-branch")
|
||||||
this.tenantId = id
|
this.tenantId = id
|
||||||
this.tenant = await this.tenantService.getTenant(id)
|
this.tenant = await this.tenantService.getTenant(id)
|
||||||
this.account = await this.accountService.getAccount(this.tenant.account)
|
this.account = await this.accountService.getAccount(this.tenant.account)
|
||||||
this.getTenancies()
|
this.getTenancies()
|
||||||
|
} else {
|
||||||
|
this.messageService.add("getTenant, 0-branch")
|
||||||
|
this.tenant = NULL_Tenant
|
||||||
|
this.account = NULL_Account
|
||||||
|
this.tenancies = []
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user