2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<?xml version="1.0" encoding="UTF-8"?>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-06 16:50:22 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<mapper namespace="com.hzs.bonus.achieve.mapper.CuMemberTreeMapper">
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <!-- 通用查询映射结果 -->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <resultMap id="CuMemberSettleExt" type="com.hzs.common.domain.member.ext.CuMemberSettleExt">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <id column="PK_ID" property="pkId"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PERIOD" property="period"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_MEMBER" property="pkMember"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_PARENT" property="pkParent"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_PLACE_PARENT" property="pkPlaceParent"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PLACE_DEPT" property="placeDept"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MEMBER_CODE" property="memberCode"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MEMBER_NAME" property="memberName"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="CUSTOMER_TYPE" property="customerType"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PHONE" property="phone"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_GRADE" property="pkGrade"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_ORI_AWARDS" property="pkOriAwards"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_AWARDS" property="pkAwards"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="ACCOUNT_STATUS" property="accountStatus"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="PAY_STATUS" property="payStatus"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REGISTER_AUTHORITY" property="registerAuthority"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="CATEGORY" property="category"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PURCHASE_TYPE" property="purchaseType"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="PURCHASE_STATUS" property="purchaseStatus"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="SHARE_STATUS" property="shareStatus"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="INCOME_STATUS" property="incomeStatus"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_TEAM_CODE" property="pkTeamCode"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_CENTER_CODE" property="pkCenterCode"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_VERTEX" property="pkVertex"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_SETTLE_COUNTRY" property="pkSettleCountry"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="IS_REAL_NAME" property="isRealName"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="IS_BUS_LICENSE" property="isBusLicense"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="IS_MAKER_SPACE" property="isMakerSpace"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_COUNTRY" property="pkCountry"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_RATE" property="pkRate"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_BALANCE" property="aBalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_BALANCE" property="bBalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="R_A_BALANCE" property="rABalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="R_B_BALANCE" property="rBBalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_SUM_AMOUNT" property="aSumAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_SUM_AMOUNT" property="bSumAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_SUM_PV" property="aSumPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_SUM_PV" property="bSumPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_NEW_AMOUNT" property="aNewAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_NEW_AMOUNT" property="bNewAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_NEW_PV" property="aNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_NEW_PV" property="bNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_SUM_REAL_AMOUNT" property="aSumRealAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_SUM_REAL_AMOUNT" property="bSumRealAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="A_SUM_REAL_PV" property="aSumRealPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="B_SUM_REAL_PV" property="bSumRealPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_A_BALANCE" property="repABalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_B_BALANCE" property="repBBalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="R_REP_A_BALANCE" property="rRepABalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="R_REP_B_BALANCE" property="rRepBBalance"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_A_NEW_AMOUNT" property="repANewAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_B_NEW_AMOUNT" property="repBNewAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_A_NEW_PV" property="repANewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_B_NEW_PV" property="repBNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_A_SUM_AMOUNT" property="repASumAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_B_SUM_AMOUNT" property="repBSumAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_A_SUM_PV" property="repASumPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REP_B_SUM_PV" property="repBSumPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REGISTER_AMOUNT" property="registerAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REGISTER_PV" property="registerPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REGISTER_NEW_PV" property="registerNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="UPGRADE_AMOUNT" property="upgradeAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="UPGRADE_PV" property="upgradePv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="UPGRADE_NEW_PV" property="upgradeNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REPURCHASE_AMOUNT" property="repurchaseAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REPURCHASE_PV" property="repurchasePv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REPURCHASE_NEW_PV" property="repurchaseNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="HI_FUN_AMOUNT" property="hiFunAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="HI_FUN_PV" property="hiFunPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="HI_FUN_NEW_PV" property="hiFunNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MALL_AMOUNT" property="mallAmount"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MALL_PV" property="mallPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MALL_NEW_PV" property="mallNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MIN_ACHIEVE" property="minAchieve"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REGISTER_Blo_NEW_PV" property="registerBloNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="UPGRADE_Blo_NEW_PV" property="upgradeBloNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="REPURCHASE_Blo_NEW_PV" property="repurchaseBloNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="HI_FUN_Blo_NEW_PV" property="hiFunBloNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="MALL_Blo_NEW_PV" property="mallBloNewPv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="ROUND" property="round"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="SECOND" property="second"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="ASSESS_TYPE" property="assessType"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_ORDER" property="pkOrder"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="LEVEL" property="level"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="GRADE_VALUE" property="gradeValue"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="parentMemberCode" property="parentMemberCode"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="AP_PK_ID" property="apPkId"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="USABLE_QUANTITY" property="usableQuantity"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <result column="RETAIL_PRICE" property="retailPrice"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="PK_DATA_ID" property="pkDataId"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="directPushNumber" property="directPushNumber"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="historyPerformancePv" property="historyPerformancePv"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="STORE_LEVEL" property="storeLevel"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="IS_MAKER_GIFT" property="isMakerGift"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="EXPIRE_STATUS" property="expireStatus"/>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <result column="IS_PAY_REG" property="isPayReg"/>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </resultMap>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <!-- 会员网体月表数据,用于查询 网体跟业绩分开 横向分表-->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="CuMemberTreeColumn">
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-17 13:49:51 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        period  NUMBER(6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_member         NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_parent         NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_place_parent   NUMBER(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        place_dept        NUMBER(3),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        member_code       VARCHAR2(30) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        member_name       VARCHAR2(100) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        customer_type     NUMBER(2) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        phone             VARCHAR2(40) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_grade          NUMBER(4) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_awards         NUMBER(4) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        account_status    number(1) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pay_status         NUMBER(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        register_authority number(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        category        number(2)  default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        purchase_type    number(2)  default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        purchase_status number(2)  default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        share_status  number(2)  default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        income_status number(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_team_code number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_center_code number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_vertex    number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_settle_country number(4) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        is_real_name    NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        is_bus_license     NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        is_maker_space     NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_country        number(4) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        store_level       NUMBER(2) default 0,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        is_maker_gift     NUMBER(1) default 1,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        expire_status     number(1) default 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <!-- 结算数据会员网体+业绩数据,用于结算 网体跟业绩冗余在一起-->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="CuMemberSettleColumn">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberTreeColumn"></include>,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberSettleDetailColumn"></include>,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberBackColumn"></include>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="CuMemberSettleDetailColumn">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        pk_rate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        NUMBER(6) ,
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            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,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_sum_amount      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_sum_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_sum_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_new_amount      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_new_amount      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_new_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_new_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_sum_real_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_sum_real_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_sum_real_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            b_sum_real_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_a_balance     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_b_balance     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_a_new_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_b_new_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_a_new_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_b_new_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_a_sum_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_b_sum_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_a_sum_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_b_sum_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_new_amount     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_new_pv NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            upgrade_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            upgrade_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            upgrade_new_amount       NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            upgrade_new_pv NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            repurchase_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            repurchase_pv   NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            repurchase_new_amount    NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            repurchase_new_pv NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            hi_fun_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            hi_fun_pv   NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            hi_fun_new_amount        NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            hi_fun_new_pv NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            mall_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            mall_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            mall_new_amount          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            mall_new_pv NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            REGISTER_Blo_NEW_PV  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            UPGRADE_Blo_NEW_PV    NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            REPURCHASE_Blo_NEW_PV    NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            HI_FUN_Blo_NEW_PV    NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            MALL_Blo_NEW_PV    NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            min_achieve       number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            round             NUMBER(6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            second            NUMBER(4) default 1 not null
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="memberParent">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        select pk_member,pk_parent,member_code,member_name,a.pk_awards,account_status,a.register_authority,customer_type,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        income_status,pk_settle_country,purchase_status,share_status,is_maker_space,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        a_balance,b_balance,r_a_balance,r_b_balance,rep_a_balance,rep_b_balance,r_rep_a_balance,r_rep_b_balance,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        register_amount,register_pv,upgrade_amount,upgrade_pv,repurchase_amount,pk_center_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        repurchase_pv,hi_fun_amount,hi_fun_pv,mall_amount,mall_pv,category,pk_grade,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        min_achieve,round,second,bg.grade_value,store_level,expire_status from (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="QueryMemberParent"></include>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ) a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        inner join bd_grade bg
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        on a.pk_grade = bg.pk_id
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="CuMemberBackColumn">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        net_first_achieve
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            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,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_a_sum_amount      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_b_sum_amount      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_a_sum_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_b_sum_pv          NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_a_sum_real_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_b_sum_real_amount NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_a_sum_real_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_b_sum_real_pv     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_a_balance     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_b_balance     NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_a_sum_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_b_sum_amount  NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_a_sum_pv      NUMBER(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            r_rep_b_sum_pv      NUMBER(17,6) default 0 not null
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="CuMemberTableTrig">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        CREATE OR REPLACE TRIGGER
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ${tableName}_TRIG
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        BEFORE INSERT OR UPDATE ON ${tableName} FOR EACH ROW
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        DECLARE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        v_newVal NUMBER(12) := 0;
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        v_incval NUMBER(12) := 0;
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        BEGIN
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            IF INSERTING AND :new.pk_id IS NULL THEN
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        SELECT ${tableNameSeq}.NEXTVAL INTO v_newVal FROM DUAL;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        IF v_newVal = 1 THEN SELECT NVL(max(pk_id), 0) INTO v_newVal FROM ${tableName};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        v_newVal := v_newVal + 1;
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        LOOP
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        EXIT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        WHEN v_incval >= v_newVal;
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        SELECT ${tableNameSeq}.nextval INTO v_incval FROM dual;
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        END LOOP;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        END IF;
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        :new.pk_id := v_newVal;
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        END IF;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        END;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <sql id="QueryMemberParent">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <foreach collection="pkMemberList" item="item" open=" " close=" " separator=" union ">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            select pk_member,pk_parent,member_code,member_name,pk_awards,account_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_authority,customer_type,income_status,pk_settle_country,purchase_status,share_status,is_maker_space,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            a_balance,b_balance,r_a_balance,r_b_balance,rep_a_balance,rep_b_balance,r_rep_a_balance,r_rep_b_balance,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            register_amount,register_pv,upgrade_amount,upgrade_pv,repurchase_amount,pk_center_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            repurchase_pv,hi_fun_amount,hi_fun_pv,mall_amount,mall_pv,category,pk_grade,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            min_achieve,round,second,store_level,expire_status
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            from ${settleTableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            where pay_status = 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            start with pk_member = #{item}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            connect by pk_member = prior pk_parent
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        </foreach>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </sql>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTreeTable">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        create table ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        pk_id NUMBER(20) primary key,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberTreeColumn"></include>
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberSettleTable">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        create table ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberSettleColumn"></include>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-17 13:49:51 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <!-- 创建结算明细表 -->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberRetailDetail">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        create table ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            pk_member           NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            child_node          NUMBER(8) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_parent           NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            stage               NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            stage_status        NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            stage_date          DATE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            point_member_11     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_11            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_12     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_12            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_21     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_21            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_22     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_22            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_23     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_23            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_24     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_24            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_31     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_31            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_32     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_32            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_33     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_33            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_34     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_34            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_35     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_35            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_36     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_36            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_37     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_37            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_38     NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_38            NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_type          NUMBER(1) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            point_gift          NUMBER(1) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            creation_time       DATE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            point_member_first  NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_first         NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-19 10:50:34 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_member_second NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_second        NUMBER(8),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            point_member_third  NUMBER(20),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 19:05:58 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_third         NUMBER(8),
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 13:35:21 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            third_bonus_1       NUMBER(8) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            third_bonus_2       NUMBER(8) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            third_bonus_3       NUMBER(8) default 0 not null
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-17 13:49:51 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <!-- 创建结算明细表会员索引 -->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberRetailDetailMemberIndex">
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-18 16:56:54 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        create unique index PK_${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-17 13:49:51 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        on ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-22 16:35:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        PK_MEMBER, CHILD_NODE, STAGE
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-17 13:49:51 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTreeParentIndex">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        create index ${tableName}_parent
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        on
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        pk_parent
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTreePlaceIndex">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        create index ${tableName}_place
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        on
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        pk_place_parent,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        place_dept
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTableUniqueIndex">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        create unique index ${tableName}_PK_M
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-11 11:05:25 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        on ${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        PK_MEMBER,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        period
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTreeDayOnlyIndex">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-16 09:44:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        create unique index ${tableName}_PK_M
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-11 11:05:25 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        on ${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        PK_MEMBER
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <insert id="insertCuMemberRetailRangeByMember">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        insert into ${settleTableName} (pk_member, pk_parent, member_code, member_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        customer_type, phone, pk_grade, pk_awards, account_status, pay_status, category,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        purchase_status, income_status, pk_team_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        pk_center_code, pk_vertex, pk_settle_country, is_real_name,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 17:24:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                        pk_country, pk_rate, pay_time, system_type, enable_status)
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        select cm.pk_id,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_parent,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               member_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               member_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               customer_type,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               phone,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_settle_grade,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               cm.pk_awards,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               account_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pay_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               category,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               purchase_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               income_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_team_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_center_code,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_vertex,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               pk_settle_country,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               is_real_name,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               cm.pk_country,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               nvl(bc.pk_id, -1) pk_rate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               cm.pay_time,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               cm.system_type,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								               cm.is_activate
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        from cu_member cm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 left join (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            select pk_country, max(pk_id) pk_id
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            from bd_currency
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            where del_flag = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              and pk_country = 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              and enable_state = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              and effective_date <= sysdate
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            group by pk_country) bc
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                           on cm.pk_settle_country = bc.pk_country
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        where cm.del_flag = 0
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </insert>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberTableSequence" statementType="STATEMENT">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="CuMemberTableTrig"></include>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-26 17:54:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <!-- 回退会员奖衔 -->
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="updateBackCuMemberRetailRangeAward">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        merge into ${rangeTableName} a
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-26 17:54:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            using (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                select ca.pk_member, max(old_level) pk_awards
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                from cu_member_awards ca
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         inner join ${rangeTableName} cm
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    on ca.pk_member = cm.pk_member
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                where ca.period = #{period}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  and ca.up_type = 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  and ca.del_flag = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  and cm.pk_awards <= ca.new_level
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                group by ca.pk_member
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ) b
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            on (a.pk_member = b.pk_member)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            when matched then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                update set
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    a.pk_awards = b.pk_awards
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-26 17:54:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <!-- 回退会员奖衔 -->
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="updateCuMemberRetailRangeAwardByDate">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        merge into ${rangeTableName} a
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-26 17:54:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            using (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                select y.pk_member, y.pk_awards
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                from ${rangeTableName} x
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         inner join (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    select a.pk_member, a.new_level pk_awards
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    from cu_member_awards a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             inner join (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        select pk_member, max(pk_id) pk_id
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        from cu_member_awards
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        where del_flag = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          and up_type = 2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          and end_validity_date <= #{settleDate, jdbcType=DATE}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        group by pk_member) b
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        on a.pk_id = b.pk_id
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    where a.del_flag = 0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                ) y
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    on x.pk_member = y.pk_member
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                where x.pk_awards < y.pk_awards
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ) b
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            on (a.pk_member = b.pk_member)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            when matched then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                update set
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    a.pk_awards = b.pk_awards
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberRetailRangeSecondTable">
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 15:45:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        CREATE TABLE ${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 15:45:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            "PK_MEMBER" NUMBER(20,0) NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "PK_PARENT" NUMBER(20,0) NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "PK_GRADE" NUMBER(4,0) NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "PK_AWARDS" NUMBER(4,0) DEFAULT 10 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "ALL_CONSUME_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "ALL_CONSUME_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "ALL_TEAM_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "ALL_TEAM_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REG_CONSUME_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REG_CONSUME_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REG_TEAM_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REG_TEAM_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REP_CONSUME_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REP_CONSUME_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REP_TEAM_NEW_AMOUNT" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "REP_TEAM_NEW_PV" NUMBER(17,6) DEFAULT 0 NOT NULL ENABLE
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <update id="createCuMemberRetailRangeTable">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        create table ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        (
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-03 09:06:50 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            pk_member              NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_parent              NUMBER(20) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            member_code            VARCHAR2(30) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            member_name            VARCHAR2(100) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            customer_type          NUMBER(2) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            phone                  VARCHAR2(40) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_grade               NUMBER(4) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_awards              number(4) default 10 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_share_awards        number(4) default 10 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            enable_status          number(2) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            account_status         number(1) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pay_status             NUMBER(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pay_time               DATE,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            category               number(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            purchase_status        number(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            income_status          number(2) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_team_code           number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_center_code         number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_vertex              number(20),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_settle_country      number(4) not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            is_real_name           NUMBER(1) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_country             number(4) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            system_type            NUMBER(2) default 2 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            pk_rate                NUMBER(6),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            new_consume_pv         number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            consume_pv             number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            month_consume_pv       number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 17:24:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            new_consume_amount     number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            consume_amount         number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            month_consume_amount   number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-03 09:06:50 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            team_new_pv            number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_consume_pv        number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_month_pv          number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_new_amount        number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_consume_amount    number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_month_amount      number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 17:24:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-03 09:06:50 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            recommend_num          number(8) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            team_num               number(8) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            big_team_pv            number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            small_team_pv          number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-09 17:24:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            reg_consume_new_amount number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            reg_consume_new_pv     number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            reg_team_new_amount    number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            reg_team_new_pv        number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_consume_new_amount number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_consume_new_pv     number(17,6) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_team_new_amount    number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-21 09:51:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            rep_team_new_pv        number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-24 18:00:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            point_count            number(8) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-25 18:07:36 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            wait_point_count       number(8) default 0 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            rep_pv_balance         number(17,6) default 0 not null,
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-26 14:54:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            gift_point             number(2) default 1 not null,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            gift_pay_time          DATE
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </update>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-06 16:50:22 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <delete id="truncateCuMemberTreeTable">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        truncate table ${tableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </delete>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <select id="queryExistOracleTable" resultType="java.lang.Integer">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        select 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        from user_tables
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        where table_name = upper(#{tableName})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </select>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <select id="queryExistOrderTableCount" resultType="java.lang.Integer">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        select count(1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        from ${tableName}
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </select>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <select id="queryMemberSettleBySaOrder" resultMap="CuMemberSettleExt">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        select pk_member,member_code,member_name,c.pk_awards,c.pk_grade,account_status,category,income_status,pk_settle_country,
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        is_maker_space,purchase_status,share_status,bg.grade_value,pk_parent,is_maker_space,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        a_balance,b_balance,r_a_balance,r_b_balance,rep_a_balance,rep_b_balance,r_rep_a_balance,r_rep_b_balance,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        register_amount,register_pv,upgrade_amount,upgrade_pv,repurchase_amount,pk_center_code,c.pk_vertex,
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        repurchase_pv,hi_fun_amount,hi_fun_pv,mall_amount,mall_pv,min_achieve,round,second,c.register_authority,store_level,
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        c.is_maker_gift,c.expire_status from ${settleTableName} c
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        left join bd_grade bg
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        on c.pk_grade = bg.pk_id
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        where pk_member in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <foreach collection="memberPkList" item="item" open="(" close=")" separator=",">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            #{item}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        </foreach>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </select>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <select id="batchQueryCuMemberSettleParent" resultMap="CuMemberSettleExt">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <include refid="memberParent"></include>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </select>
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <select id="batchQueryMemberSettleParentByMemberPk" resultMap="CuMemberSettleExt">
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-10 20:31:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        select
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cl.pk_member,cl.member_code,cl.member_name,cl.pk_awards,cl.pk_grade,cl.account_status,cl.category,cl.income_status,cl.pk_settle_country,
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-23 09:44:16 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cl.is_maker_space,cl.purchase_status,cl.share_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cl.a_balance,cl.b_balance,cl.r_a_balance,cl.r_b_balance,cl.rep_a_balance,cl.rep_b_balance,cl.r_rep_a_balance,cl.r_rep_b_balance,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cl.register_amount,cl.register_pv,cl.upgrade_amount,cl.upgrade_pv,cl.repurchase_amount,cl.pk_center_code,cl.register_authority,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cl.repurchase_pv,cl.hi_fun_amount,cl.hi_fun_pv,cl.mall_amount,cl.mall_pv,cl.min_achieve,cl.round,cl.second from ${settleTableName} ct
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        inner join ${settleTableName} cl
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        on ct.pk_parent = cl.pk_member
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        where ct.pk_member in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <foreach collection="memberPkList" item="item" open="(" close=")" separator=",">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            #{item}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        </foreach>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        union
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        select pk_member,member_code,member_name,pk_awards,pk_grade,account_status,category,income_status,pk_settle_country,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        is_maker_space,purchase_status,share_status,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        a_balance,b_balance,r_a_balance,r_b_balance,rep_a_balance,rep_b_balance,r_rep_a_balance,r_rep_b_balance,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        register_amount,register_pv,upgrade_amount,upgrade_pv,repurchase_amount,pk_center_code,register_authority,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        repurchase_pv,hi_fun_amount,hi_fun_pv,mall_amount,mall_pv,min_achieve,round,second from ${settleTableName}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        where pk_member in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        <foreach collection="memberPkList" item="item" open="(" close=")" separator=",">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            #{item}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        </foreach>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    </select>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</mapper>
							 |