diff --git a/bd-business/bd-business-bonus/src/main/resources/mapper/member/achieve/CuMemberTreeMapper.xml b/bd-business/bd-business-bonus/src/main/resources/mapper/member/achieve/CuMemberTreeMapper.xml index 56cf4b7d..60f1f8ec 100644 --- a/bd-business/bd-business-bonus/src/main/resources/mapper/member/achieve/CuMemberTreeMapper.xml +++ b/bd-business/bd-business-bonus/src/main/resources/mapper/member/achieve/CuMemberTreeMapper.xml @@ -106,7 +106,8 @@ - period NUMBER(6) default 0 not null, + period + NUMBER(6) default 0 not null, pk_member NUMBER(20) not null, pk_parent NUMBER(20) not null, pk_place_parent NUMBER(20), @@ -146,7 +147,8 @@ - pk_rate NUMBER(6) , + pk_rate + NUMBER(6) , a_balance NUMBER(17,6) default 0 not null, b_balance NUMBER(17,6) default 0 not null, a_sum_amount NUMBER(17,6) default 0 not null, @@ -222,7 +224,8 @@ - net_first_achieve NUMBER(17,6) default 0 not null, + net_first_achieve + NUMBER(17,6) default 0 not null, net_repurchase_achieve NUMBER(17,6) default 0 not null, r_a_balance NUMBER(17,6) default 0 not null, r_b_balance NUMBER(17,6) default 0 not null, @@ -245,9 +248,13 @@ CREATE OR REPLACE TRIGGER - ${tableName}_TRIG + ${tableName} + _ + TRIG BEFORE - INSERT OR UPDATE ON ${tableName} FOR EACH ROW + INSERT + OR + UPDATE ON ${tableName} FOR EACH ROW DECLARE v_newVal NUMBER(12) := 0; v_incval @@ -272,7 +279,8 @@ FROM dual; END LOOP; END IF; - :new.pk_id := v_newVal; + :new + .pk_id := v_newVal; END IF; END; @@ -378,23 +386,57 @@ - create index ${tableName}_parent - on ${tableName} ( pk_parent ) + create + index + ${tableName} + _ + parent + on + ${tableName} + ( + pk_parent + ) - create index ${tableName}_place - on ${tableName} ( pk_place_parent, place_dept ) + create + index + ${tableName} + _ + place + on + ${tableName} + ( + pk_place_parent, + place_dept + ) - create unique index ${tableName}_PK_M - on ${tableName} ( PK_MEMBER, period ) + create + unique index + ${tableName} + _ + PK_M + on + ${tableName} + ( + PK_MEMBER, + period + ) - create unique index - ${tableName}_PK_M on ${tableName} ( PK_MEMBER ) + create + unique index + ${tableName} + _ + PK_M + on + ${tableName} + ( + PK_MEMBER + ) @@ -762,8 +804,13 @@ inner join bd_awards bdw on a.ori_awards_value = bdw.awards_value and a.pk_settle_country = bdw.pk_country where bw.del_flag = 0 - and bw.community_check <= a.a_sum_real_pv - and bw.community_check <= a.b_sum_real_pv + and ( + (bw.community_check <= a.a_sum_real_pv + and bw.community_check * 2 <= a.b_sum_real_pv) + or + (bw.community_check * 2 <= a.a_sum_real_pv + and bw.community_check <= a.b_sum_real_pv) + ) order by pk_member desc