空update时不生成modi
This commit is contained in:
parent
5408c68892
commit
957611b9ab
|
|
@ -1229,7 +1229,12 @@ class CascadeStore extends RowStore_1.RowStore {
|
||||||
// 变成对modi的插入
|
// 变成对modi的插入
|
||||||
// 优化,这里如果是对同一个targetEntity反复update,则变成对最后一条create/update的modi进行update,以避免发布文章这样的需求时产生过多的modi
|
// 优化,这里如果是对同一个targetEntity反复update,则变成对最后一条create/update的modi进行update,以避免发布文章这样的需求时产生过多的modi
|
||||||
let modiUpsert;
|
let modiUpsert;
|
||||||
if (action !== 'remove') {
|
if (action === 'update') {
|
||||||
|
// 如果action本身是update,且没有实际update属性,这里可以忽略
|
||||||
|
const updateAttrCount = Object.keys(data).length;
|
||||||
|
if (updateAttrCount === 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
const upsertModis = await this.selectAbjointRowAsync('modi', {
|
const upsertModis = await this.selectAbjointRowAsync('modi', {
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
|
||||||
|
|
@ -403,14 +403,14 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
||||||
selection: ED[T]['Selection'],
|
selection: ED[T]['Selection'],
|
||||||
context: Cxt,
|
context: Cxt,
|
||||||
option: OP): Partial<ED[T]['Schema']>[];
|
option: OP): Partial<ED[T]['Schema']>[];
|
||||||
|
|
||||||
protected abstract countAbjointRow<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED>>(
|
protected abstract countAbjointRow<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED>>(
|
||||||
entity: T,
|
entity: T,
|
||||||
selection: Pick<ED[T]['Selection'], 'filter' | 'count'>,
|
selection: Pick<ED[T]['Selection'], 'filter' | 'count'>,
|
||||||
context: Cxt,
|
context: Cxt,
|
||||||
option: OP): number;
|
option: OP): number;
|
||||||
|
|
||||||
|
|
||||||
protected abstract countAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(
|
protected abstract countAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(
|
||||||
entity: T,
|
entity: T,
|
||||||
selection: Pick<ED[T]['Selection'], 'filter' | 'count'>,
|
selection: Pick<ED[T]['Selection'], 'filter' | 'count'>,
|
||||||
|
|
@ -914,7 +914,7 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
||||||
option2.modiParentId = data.id;
|
option2.modiParentId = data.id;
|
||||||
option2.modiParentEntity = entity as string;
|
option2.modiParentEntity = entity as string;
|
||||||
}
|
}
|
||||||
else if (filter?.id && typeof filter.id === 'string'){
|
else if (filter?.id && typeof filter.id === 'string') {
|
||||||
// 如果是对toModi对象进行cascadeUpdate操作,必然带有id,如果没有则认为不是modi相关的操作
|
// 如果是对toModi对象进行cascadeUpdate操作,必然带有id,如果没有则认为不是modi相关的操作
|
||||||
// 批量通过或者拒绝applyment应该就会出现
|
// 批量通过或者拒绝applyment应该就会出现
|
||||||
option2.modiParentId = filter.id;
|
option2.modiParentId = filter.id;
|
||||||
|
|
@ -1048,7 +1048,7 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
||||||
() => cascadeUpdate.call(this, relation, operationMto, context, option2)
|
() => cascadeUpdate.call(this, relation, operationMto, context, option2)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (relation instanceof Array){
|
else if (relation instanceof Array) {
|
||||||
const [entityOtm, foreignKey] = relation;
|
const [entityOtm, foreignKey] = relation;
|
||||||
const otmOperations = data[attr];
|
const otmOperations = data[attr];
|
||||||
const dealWithOneToMany = (otm: ED[keyof ED]['Update'] | ED[keyof ED]['Create']) => {
|
const dealWithOneToMany = (otm: ED[keyof ED]['Update'] | ED[keyof ED]['Create']) => {
|
||||||
|
|
@ -1503,7 +1503,12 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
||||||
// 变成对modi的插入
|
// 变成对modi的插入
|
||||||
// 优化,这里如果是对同一个targetEntity反复update,则变成对最后一条create/update的modi进行update,以避免发布文章这样的需求时产生过多的modi
|
// 优化,这里如果是对同一个targetEntity反复update,则变成对最后一条create/update的modi进行update,以避免发布文章这样的需求时产生过多的modi
|
||||||
let modiUpsert: CreateModiOperation | UpdateModiOperation | undefined;
|
let modiUpsert: CreateModiOperation | UpdateModiOperation | undefined;
|
||||||
if (action !== 'remove') {
|
if (action === 'update') {
|
||||||
|
// 如果action本身是update,且没有实际update属性,这里可以忽略
|
||||||
|
const updateAttrCount = Object.keys(data).length;
|
||||||
|
if (updateAttrCount === 0) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
const upsertModis = await this.selectAbjointRowAsync('modi', {
|
const upsertModis = await this.selectAbjointRowAsync('modi', {
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue