Skip to content

Commit 58952fc

Browse files
committed
新增if判断
1 parent 7259845 commit 58952fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/services/MysqlCache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ export class MysqlCache<Scheme> extends MysqlNative<Scheme> {
2828
async updateById(id: string, data: CoaMysql.SafePartial<Scheme>, trx?: CoaMysql.Transaction) {
2929
const dataList = await this.getCacheChangedDataList([id], data, trx)
3030
const result = await super.updateById(id, data, trx)
31-
await this.deleteCache([id], dataList, trx)
31+
if (result) await this.deleteCache([id], dataList, trx)
3232
return result
3333
}
3434

3535
async updateByIds(ids: string[], data: CoaMysql.SafePartial<Scheme>, trx?: CoaMysql.Transaction) {
3636
const dataList = await this.getCacheChangedDataList(ids, data, trx)
3737
const result = await super.updateByIds(ids, data, trx);
38-
await this.deleteCache(ids, dataList, trx)
38+
if (result) await this.deleteCache(ids, dataList, trx)
3939
return result
4040
}
4141

4242
async updateForQueryById(id: string, query: CoaMysql.Query, data: CoaMysql.SafePartial<Scheme>, trx?: CoaMysql.Transaction) {
4343
const dataList = await this.getCacheChangedDataList([id], data, trx)
4444
const result = await super.updateForQueryById(id, query, data, trx);
45-
await this.deleteCache([id], dataList, trx)
45+
if (result) await this.deleteCache([id], dataList, trx)
4646
return result
4747
}
4848

0 commit comments

Comments
 (0)