3250 lines
		
	
	
		
			125 KiB
		
	
	
	
		
			XML
		
	
	
	
			
		
		
	
	
			3250 lines
		
	
	
		
			125 KiB
		
	
	
	
		
			XML
		
	
	
	
| <?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">
 | ||
| <mapper namespace="com.hzs.member.base.mapper.CuMemberMapper">
 | ||
| 
 | ||
|     <!-- 查询登录会员以及状态 -->
 | ||
|     <resultMap id="MemberResultMap" type="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         <id column="PK_ID" property="pkId"/>
 | ||
|         <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="ID_CARD" property="idCard"/>
 | ||
|         <result column="SEX" property="sex"/>
 | ||
|         <result column="BIRTH_DATE" property="birthDate"/>
 | ||
|         <result column="PK_COUNTRY" property="pkCountry"/>
 | ||
|         <result column="PK_SETTLE_COUNTRY" property="pkSettleCountry"/>
 | ||
|         <result column="PARENT" property="parent"/>
 | ||
|         <result column="PK_PARENT" property="pkParent"/>
 | ||
|         <result column="PK_PLACE_PARENT" property="pkPlaceParent"/>
 | ||
|         <result column="PLACE_DEPT" property="placeDept"/>
 | ||
|         <result column="PK_TEAM_CODE" property="pkTeamCode"/>
 | ||
|         <result column="PK_CENTER_CODE" property="pkCenterCode"/>
 | ||
|         <result column="SOURCE" property="source"/>
 | ||
|         <result column="PK_REGISTER_GRADE" property="pkRegisterGrade"/>
 | ||
|         <result column="PK_SETTLE_GRADE" property="pkSettleGrade"/>
 | ||
|         <result column="PK_AWARDS" property="pkAwards"/>
 | ||
|         <result column="PK_MAX_AWARDS" property="pkMaxAwards"/>
 | ||
|         <result column="CONSUME_MONEY" property="consumeMoney"/>
 | ||
|         <result column="CONSUME_ACHIEVE" property="consumeAchieve"/>
 | ||
|         <result column="PURCHASE_STATUS" property="purchaseStatus"/>
 | ||
|         <result column="SHARE_STATUS" property="shareStatus"/>
 | ||
|         <result column="PAY_TIME" property="payTime"/>
 | ||
|         <result column="PAY_STATUS" property="payStatus"/>
 | ||
|         <result column="LOGIN_PWD" property="loginPwd"/>
 | ||
|         <result column="PAY_PWD" property="payPwd"/>
 | ||
|         <result column="LOGIN_PASSWORD" property="loginPassword"/>
 | ||
|         <result column="PAY_PASSWORD" property="payPassword"/>
 | ||
|         <result column="EDIT_NUMBER" property="editNumber"/>
 | ||
|         <result column="PK_CREATOR" property="pkCreator"/>
 | ||
|         <result column="CREATION_TIME" property="creationTime"/>
 | ||
|         <result column="PK_MODIFIED" property="pkModified"/>
 | ||
|         <result column="MODIFIED_TIME" property="modifiedTime"/>
 | ||
|         <result column="REGISTER_AUTHORITY" property="registerAuthority"/>
 | ||
|         <result column="PK_VERTEX" property="pkVertex"/>
 | ||
|         <result column="ACCOUNT_STATUS" property="accountStatus"/>
 | ||
|         <result column="PAY_STATUS" property="payStatus"/>
 | ||
|         <result column="CATEGORY" property="category"/>
 | ||
|         <result column="EMAIL" property="email"/>
 | ||
|         <result column="ORDER_SOURCE" property="orderSource"/>
 | ||
|         <result column="IS_REAL_NAME" property="isRealName"/>
 | ||
|         <result column="IS_BUS_LICENSE" property="isBusLicense"/>
 | ||
|         <result column="IS_MAKER_SPACE" property="isMakerSpace"/>
 | ||
|         <result column="CHANGE_NUMBER" property="changeNumber"/>
 | ||
|         <result column="WECHAT" property="wechat"/>
 | ||
|         <result column="CARD_TYPE" property="cardType"/>
 | ||
|         <result column="NICK_NAME" property="nickName"/>
 | ||
|         <result column="HEAD_PATH" property="headPath"/>
 | ||
|         <result column="DIRECT_PUSH_NUMBER" property="directPushNumber"/>
 | ||
|         <result column="IS_DEALER" property="isDealer"/>
 | ||
|         <result column="SYSTEM_LEVEL" property="systemLevel"/>
 | ||
|         <result column="LECTURER_LEVEL" property="lecturerLevel"/>
 | ||
|         <result column="SUPER_STUDIO" property="superStudio"/>
 | ||
|         <result column="ID_FRONT" property="idFront"/>
 | ||
|         <result column="ID_BACK" property="idBack"/>
 | ||
|         <result column="PK_PROVINCE" property="pkProvince"/>
 | ||
|         <result column="PK_CITY" property="pkCity"/>
 | ||
|         <result column="PK_COUNTY" property="pkCounty"/>
 | ||
|         <result column="ADDRESS" property="address"/>
 | ||
|         <result column="BANK_NAME" property="bankName"/>
 | ||
|         <result column="SUB_BANK_NAME" property="subBankName"/>
 | ||
|         <result column="ACCOUNT_NAME" property="accountName"/>
 | ||
|         <result column="reservedPhone" property="reservedPhone"/>
 | ||
|         <result column="CARD_NUMBER" property="cardNumber"/>
 | ||
|         <result column="certificationTime" property="certificationTime"/>
 | ||
|         <result column="directPushNumber" property="directPushNumber"/>
 | ||
|         <result column="ID_TYPE" property="idType"/>
 | ||
|         <result column="GLOBAL_CODE" property="globalCode"/>
 | ||
|         <result column="COUNTRY_CODE" property="countryCode"/>
 | ||
|         <result column="recommendedOrderNumber" property="recommendedOrderNumber"/>
 | ||
|         <result column="GLOBAL_CODE" property="globalCode"/>
 | ||
|         <result column="COUNTRY_CODE" property="countryCode"/>
 | ||
|         <result column="GRADE_VALUE" property="gradeValue"/>
 | ||
|         <result column="REGISTER_GRADEVAL" property="registerGradeVal"/>
 | ||
|         <result column="AWARDS_VAL" property="awardsVal"/>
 | ||
|         <result column="TEAM_CODE" property="teamCode"/>
 | ||
|         <result column="TEAM_NAME" property="teamName"/>
 | ||
|         <result column="SERVICE_AGREEMENT" property="serviceAgreement"/>
 | ||
|         <result column="EXPIRE_DATE" property="expireDate"/>
 | ||
|         <result column="STOP_DATE" property="stopDate"/>
 | ||
|         <result column="EXPIRE_STATUS" property="expireStatus"/>
 | ||
|         <result column="SERVICE_CODE" property="serviceCode"/>
 | ||
|         <result column="SYSTEM_TYPE" property="systemType"/>
 | ||
|     </resultMap>
 | ||
| 
 | ||
|     <resultMap id="MemberVO" type="com.hzs.member.base.vo.CuMemberVO">
 | ||
|         <id column="PK_ID" property="pkId"/>
 | ||
|         <result column="MEMBER_CODE" property="memberCode"/>
 | ||
|         <result column="MEMBER_NAME" property="memberName"/>
 | ||
|         <result column="NICK_NAME" property="nickName"/>
 | ||
|         <result column="CUSTOMER_TYPE" property="customerType"/>
 | ||
|         <result column="PHONE" property="phone"/>
 | ||
|         <result column="ID_CARD" property="idCard"/>
 | ||
|         <result column="SEX" property="sex"/>
 | ||
|         <result column="BIRTH_DATE" property="birthDate"/>
 | ||
|         <result column="PK_COUNTRY" property="pkCountry"/>
 | ||
|         <result column="PK_SETTLE_COUNTRY" property="pkSettleCountry"/>
 | ||
|         <result column="PAR_MEMBER_CODE" property="parMemberCode"/>
 | ||
|         <result column="PAR_MEMBER_NAME" property="parMemberName"/>
 | ||
|         <result column="PLACE_MEMBER_CODE" property="placeMemberCode"/>
 | ||
|         <result column="PLACE_MEMBER_NAME" property="placeMemberName"/>
 | ||
|         <result column="PLACE_DEPT" property="placeDept"/>
 | ||
|         <result column="CENTER_MEMBER_CODE" property="centerMemberCode"/>
 | ||
|         <result column="CENTER_MEMBER_NAME" property="centerMemberName"/>
 | ||
|         <result column="SOURCE" property="source"/>
 | ||
|         <result column="PK_REGISTER_GRADE" property="pkRegisterGrade"/>
 | ||
|         <result column="PK_SETTLE_GRADE" property="pkSettleGrade"/>
 | ||
|         <result column="PK_AWARDS" property="pkAwards"/>
 | ||
|         <result column="CONSUME_MONEY" property="consumeMoney"/>
 | ||
|         <result column="CONSUME_ACHIEVE" property="consumeAchieve"/>
 | ||
|         <result column="PURCHASE_STATUS" property="purchaseStatus"/>
 | ||
|         <result column="SHARE_STATUS" property="shareStatus"/>
 | ||
|         <result column="PAY_TIME" property="payTime"/>
 | ||
|         <result column="PAY_STATUS" property="payStatus"/>
 | ||
|         <result column="EDIT_NUMBER" property="editNumber"/>
 | ||
|         <result column="CREATION_TIME" property="creationTime"/>
 | ||
|         <result column="REGISTER_AUTHORITY" property="registerAuthority"/>
 | ||
|         <result column="TOP_MEMBER_CODE" property="topMemberCode"/>
 | ||
|         <result column="TOP_MEMBER_NAME" property="topMemberName"/>
 | ||
|         <result column="ACCOUNT_STATUS" property="accountStatus"/>
 | ||
|         <result column="WALLET_STATUS" property="walletStatus"/>
 | ||
|         <result column="PAY_STATUS" property="payStatus"/>
 | ||
|         <result column="CATEGORY" property="category"/>
 | ||
|         <result column="EMAIL" property="email"/>
 | ||
|         <result column="INCOME_STATUS" property="incomeStatus"/>
 | ||
|         <result column="ORDER_SOURCE" property="orderSource"/>
 | ||
|         <result column="IS_REAL_NAME" property="isRealName"/>
 | ||
|         <result column="IS_BUS_LICENSE" property="isBusLicense"/>
 | ||
|         <result column="CHANGE_NUMBER" property="changeNumber"/>
 | ||
|         <result column="WECHAT" property="wechat"/>
 | ||
|         <result column="CARD_TYPE" property="cardType"/>
 | ||
|         <result column="ID_CARD_JUST" property="idCardJust"/>
 | ||
|         <result column="ID_CARD_BACK" property="idCardBack"/>
 | ||
|         <result column="GIFT_PROVINCE" property="giftProvince"/>
 | ||
|         <result column="GIFT_CITY" property="giftCity"/>
 | ||
|         <result column="GIFT_COUNTY" property="giftCounty"/>
 | ||
|         <result column="GIFT_ADDRESS" property="giftAddress"/>
 | ||
|         <result column="BANK_NAME" property="bankName"/>
 | ||
|         <result column="SUB_BANK_NAME" property="subBankName"/>
 | ||
|         <result column="ACCOUNT_NAME" property="accountName"/>
 | ||
|         <result column="PHONE" property="reservePhone"/>
 | ||
|         <result column="CARD_NUMBER" property="cardNumber"/>
 | ||
|         <result column="NICK_NAME" property="nickName"/>
 | ||
|         <result column="HEAD_PATH" property="headPath"/>
 | ||
|         <result column="agent_grade" property="agentGrade"/>
 | ||
|         <result column="DIRECT_PUSH_NUMBER" property="directPushNumber"/>
 | ||
|         <result column="SERVICE_CODE" property="serviceCode"/>
 | ||
|     </resultMap>
 | ||
| 
 | ||
|     <sql id="CuMember_Column">
 | ||
|         select cm.pk_id,
 | ||
|                cm.member_code,
 | ||
|                cm.member_name,
 | ||
|                cm.phone,
 | ||
|                cm.pk_settle_country,
 | ||
|                cm.pk_parent,
 | ||
|                cm.pk_place_parent,
 | ||
|                cm.place_dept,
 | ||
|                cm.pk_team_code,
 | ||
|                cm.pk_center_code,
 | ||
|                cm.category,
 | ||
|                cm.pk_settle_grade,
 | ||
|                cm.pk_awards,
 | ||
|                cm.purchase_status,
 | ||
|                cm.order_source,
 | ||
|                cm.is_real_name,
 | ||
|                cm.is_bus_license,
 | ||
|                cm.is_maker_space,
 | ||
|                cm.share_status,
 | ||
|                cm.pay_pwd,
 | ||
|                cm.register_authority,
 | ||
|                cm.nick_name,
 | ||
|                cm.pk_vertex,
 | ||
|                cm.service_code
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|     </sql>
 | ||
| 
 | ||
|     <!-- 保存会员信息 -->
 | ||
|     <insert id="insertCuMember" parameterType="com.hzs.common.domain.member.base.CuMember">
 | ||
|         INSERT INTO CU_MEMBER (PK_ID, MEMBER_CODE, MEMBER_NAME, CATEGORY, CUSTOMER_TYPE, PHONE, EMAIL, ID_CARD,
 | ||
|                                PK_SETTLE_COUNTRY,
 | ||
|                                PK_PARENT, PK_PLACE_PARENT, PLACE_DEPT, PK_TEAM_CODE, PK_CENTER_CODE, SOURCE,
 | ||
|                                PK_REGISTER_GRADE,
 | ||
|                                PK_SETTLE_GRADE, PK_AWARDS, CONSUME_MONEY, CONSUME_ACHIEVE, PAY_STATUS, LOGIN_PWD,
 | ||
|                                PAY_PWD, LOGIN_PASSWORD, PAY_PASSWORD,
 | ||
|                                PK_VERTEX, ACCOUNT_STATUS, ORDER_SOURCE, PK_CREATOR, CREATION_TIME, PK_COUNTRY, PAY_TIME,
 | ||
|                                GLOBAL_CODE, COUNTRY_CODE, REGISTER_AUTHORITY,
 | ||
|                                EXPIRE_DATE, STOP_DATE, IS_MAKER_GIFT, MAKER_GIFT_TIME)
 | ||
|         VALUES (#{pkId,jdbcType=INTEGER}, #{memberCode}, #{memberName}, #{category}, #{customerType}, #{phone},
 | ||
|                 #{email, jdbcType=VARCHAR}, #{idCard, jdbcType=VARCHAR}, #{pkSettleCountry},
 | ||
|                 #{pkParent}, #{pkPlaceParent,jdbcType=NUMERIC}, #{placeDept,jdbcType=INTEGER},
 | ||
|                 #{pkTeamCode,jdbcType=INTEGER}, #{pkCenterCode,jdbcType=INTEGER}, #{source}, #{pkRegisterGrade},
 | ||
|                 #{pkSettleGrade}, #{pkAwards}, #{consumeMoney,jdbcType=NUMERIC}, #{consumeAchieve,jdbcType=NUMERIC},
 | ||
|                 #{payStatus}, #{loginPwd}, #{payPwd},
 | ||
|                 #{loginPassword}, #{payPassword}, #{pkVertex,jdbcType=INTEGER}, #{accountStatus}, #{orderSource},
 | ||
|                 #{pkCreator,jdbcType=INTEGER}, #{creationTime, jdbcType=TIMESTAMP}, #{pkCountry},
 | ||
|                 #{payTime, jdbcType=TIMESTAMP},
 | ||
|                 #{globalCode, jdbcType=VARCHAR}, #{countryCode, jdbcType=VARCHAR},
 | ||
|                 #{registerAuthority,jdbcType=INTEGER},
 | ||
|                 #{expireDate, jdbcType=DATE}, #{stopDate, jdbcType=DATE}, #{isMakerGift,jdbcType=INTEGER},
 | ||
|                 #{makerGiftTime,jdbcType=TIMESTAMP})
 | ||
|     </insert>
 | ||
| 
 | ||
|     <!-- 批量保存会员信息 -->
 | ||
|     <insert id="insertBatchCuMember">
 | ||
|         insert ALL
 | ||
|         <foreach collection="memberList" item="item" separator=" ">
 | ||
|             into CU_MEMBER (
 | ||
|             PK_ID, MEMBER_CODE, MEMBER_NAME, CUSTOMER_TYPE,
 | ||
|             PHONE, PK_PARENT, PK_PLACE_PARENT, PLACE_DEPT,
 | ||
|             PK_COUNTRY, PK_SETTLE_COUNTRY, SOURCE,
 | ||
|             PK_REGISTER_GRADE, PK_SETTLE_GRADE, PK_AWARDS,
 | ||
|             LOGIN_PWD, PAY_PWD, LOGIN_PASSWORD, PAY_PASSWORD,
 | ||
|             PK_CREATOR, CREATION_TIME, PAY_TIME, PAY_STATUS,
 | ||
|             PK_TEAM_CODE, PK_VERTEX, ORDER_SOURCE, CONSUME_ACHIEVE,
 | ||
|             GLOBAL_CODE, COUNTRY_CODE, EXPIRE_DATE, STOP_DATE
 | ||
|             )
 | ||
|             values (
 | ||
|             #{item.pkId}, #{item.memberCode}, #{item.memberName}, #{item.customerType},
 | ||
|             #{item.phone}, #{item.pkParent}, #{item.pkPlaceParent}, #{item.placeDept},
 | ||
|             #{item.pkCountry}, #{item.pkSettleCountry}, #{item.source},
 | ||
|             #{item.pkRegisterGrade}, #{item.pkSettleGrade}, #{item.pkAwards},
 | ||
|             #{item.loginPwd}, #{item.payPwd}, #{item.loginPassword}, #{item.payPassword},
 | ||
|             #{item.pkCreator}, #{item.creationTime}, #{item.payTime}, #{item.payStatus},
 | ||
|             #{item.pkTeamCode, jdbcType=NUMERIC}, #{item.pkVertex, jdbcType=NUMERIC}, #{item.orderSource},
 | ||
|             #{item.consumeAchieve},
 | ||
|             #{item.globalCode, jdbcType=VARCHAR}, #{item.countryCode, jdbcType=VARCHAR},
 | ||
|             #{item.expireDate, jdbcType=DATE}, #{item.stopDate, jdbcType=DATE}
 | ||
|             )
 | ||
|         </foreach>
 | ||
|         SELECT 1 FROM dual
 | ||
|     </insert>
 | ||
| 
 | ||
|     <!-- 通用查询映射结果 -->
 | ||
|     <select id="queryLoginMember" resultMap="MemberResultMap">
 | ||
|         select cm.*
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="pkMember != null">
 | ||
|             and cm.pk_id = #{pkMember}
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 根据服务编号登录用户(2024.07.09 兼容海外临时需求) -->
 | ||
|     <select id="queryTmpLoginMember" resultMap="MemberResultMap">
 | ||
|         select cm.*
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="serviceCode != null and serviceCode != ''">
 | ||
|             and cm.SERVICE_CODE = #{serviceCode}
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询会员(无删除标记) -->
 | ||
|     <select id="queryMemberNotFlag" resultMap="MemberResultMap">
 | ||
|         select cm.*
 | ||
|         from cu_member cm
 | ||
|         where 1 = 1
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="pkMember != null">
 | ||
|             and cm.pk_id = #{pkMember}
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--and cm.PAY_STATUS=1-->
 | ||
|     <select id="queryMemberInfoByCondition" resultMap="MemberResultMap">
 | ||
|         <include refid="CuMember_Column"/>
 | ||
|         <choose>
 | ||
|             <when test="category != 10">
 | ||
|                 and cm.category = 0
 | ||
|             </when>
 | ||
|         </choose>
 | ||
|         <if test="pkSettleCountry != null">
 | ||
|             and cm.pk_settle_country=#{pkSettleCountry}
 | ||
|         </if>
 | ||
|         <if test="payStatus != null">
 | ||
|             and cm.pay_status=#{payStatus}
 | ||
|         </if>
 | ||
|         <if test="pkId != null ">
 | ||
|             and cm.pk_id = #{pkId}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name = #{memberName}
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone = #{phone}
 | ||
|         </if>
 | ||
|         <if test="pkParent != null and pkParent != ''">
 | ||
|             and cm.pk_parent = #{pkParent}
 | ||
|         </if>
 | ||
|         <if test="pkPlaceParent != null and pkPlaceParent != ''">
 | ||
|             and cm.pk_place_parent = #{pkPlaceParent}
 | ||
|         </if>
 | ||
|         <if test="placeDept != null and placeDept != ''">
 | ||
|             and cm.place_dept = #{placeDept}
 | ||
|         </if>
 | ||
|         <if test="pkSettleGrade != null and pkSettleCountry != null">
 | ||
|             <choose>
 | ||
|                 <when test="pkSettleGrade == 20 and pkSettleCountry == 1">
 | ||
|                     and cm.pk_settle_grade = 1
 | ||
|                 </when>
 | ||
|                 <otherwise>
 | ||
|                     and cm.pk_settle_grade > 1
 | ||
|                 </otherwise>
 | ||
|             </choose>
 | ||
|         </if>
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectPlaceSponsorOnUmbrella" resultMap="MemberResultMap">
 | ||
|         select t.pk_id, t.member_code, t.member_name, t.phone, t.pk_place_parent
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and member_code = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and t.phone=#{phone}
 | ||
|         </if>
 | ||
|         start with t.pk_id = #{memberId}
 | ||
|         connect by t.pk_id = prior t.pk_place_parent
 | ||
|         order by level desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectPlaceSponsorUnderUmbrella" resultMap="MemberResultMap">
 | ||
|         select t.pk_id,
 | ||
|                t.member_code,
 | ||
|                t.member_name,
 | ||
|                t.phone,
 | ||
|                t.pk_place_parent,
 | ||
|                t.pk_parent,
 | ||
|                t.pk_center_code,
 | ||
|                t.PLACE_DEPT
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_place_parent = #{memberId}
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
|         order by level
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectPlaceSponsorUnderUmbrellaByCondition" resultMap="MemberResultMap">
 | ||
|         select * from (
 | ||
|         select t.pk_id,
 | ||
|         t.member_code,
 | ||
|         t.member_name,
 | ||
|         t.phone,
 | ||
|         t.pk_place_parent,
 | ||
|         t.pk_parent,
 | ||
|         t.pk_center_code,
 | ||
|         t.PLACE_DEPT
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_place_parent = #{memberId}
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
|         union
 | ||
|         select t.pk_id,
 | ||
|         t.member_code,
 | ||
|         t.member_name,
 | ||
|         t.phone,
 | ||
|         t.pk_place_parent,
 | ||
|         t.pk_parent,
 | ||
|         t.pk_center_code,
 | ||
|         t.PLACE_DEPT
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 and t.pk_id = #{memberId}
 | ||
|         ) a
 | ||
|         where a.pk_id in
 | ||
|         <foreach collection="cuMemberExtList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item.pkId}
 | ||
|         </foreach>
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectPlaceSponsorLastLeft" resultMap="MemberResultMap">
 | ||
|         <!--
 | ||
|                 select *
 | ||
|                 from (select t.pk_id,
 | ||
|                              t.member_code,
 | ||
|                              t.member_name,
 | ||
|                              t.pk_vertex,
 | ||
|                              t.nick_name,
 | ||
|                              t.service_code
 | ||
|                       from (select *
 | ||
|                             from cu_member
 | ||
|                             where del_flag = 0
 | ||
|                                 start with pk_place_parent = #{memberId}
 | ||
|                             connect by prior pk_id = pk_place_parent) t
 | ||
|                       where t.del_flag = 0
 | ||
|                         and t.place_dept = 1
 | ||
|                           start with t.pk_id = (select u.pk_id
 | ||
|                           from (select *
 | ||
|                           from cu_member
 | ||
|                           where del_flag = 0
 | ||
|                           start with pk_place_parent = #{memberId}
 | ||
|                           connect by prior pk_id = pk_place_parent) u
 | ||
|                           where u.del_flag = 0
 | ||
|                           and u.pk_place_parent = #{memberId}
 | ||
|                           and u.place_dept = #{placeDept, jdbcType=INTEGER})
 | ||
|                       connect by prior
 | ||
|                           t.pk_id = (select u.pk_place_parent
 | ||
|                           from (select *
 | ||
|                           from cu_member
 | ||
|                           where del_flag = 0
 | ||
|                           start with pk_place_parent = #{memberId}
 | ||
|                           connect by prior pk_id = pk_place_parent) u
 | ||
|                           where u.pk_id = t.pk_id
 | ||
|                              and u.place_dept = 1)
 | ||
|                       order by level desc) n
 | ||
|                 where rownum = 1
 | ||
|                 -->
 | ||
|         select *
 | ||
|         from (select t.pk_id, t.member_code, t.member_name, t.pk_vertex, t.nick_name, t.service_code
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|         and t.place_dept = 1 start
 | ||
|         with t.pk_id = (select u.pk_id
 | ||
|         from cu_member u
 | ||
|         where u.del_flag=0 and u.pk_place_parent = #{memberId}
 | ||
|         and u.place_dept = #{placeDept, jdbcType=INTEGER})
 | ||
|         connect by prior
 | ||
|         t.pk_id = (select u.pk_place_parent
 | ||
|         from cu_member u
 | ||
|         where u.pk_id = t.pk_id
 | ||
|         and u.place_dept = 1)
 | ||
|         order by level desc) n
 | ||
|         where rownum = 1
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectBloodKinshipOnUmbrella" resultMap="MemberResultMap">
 | ||
|         select t.pk_id, t.member_code, t.member_name, t.phone, t.pk_parent
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_id = #{memberId}
 | ||
|         connect by t.pk_id = prior t.pk_parent
 | ||
|         order by level
 | ||
|     </select>
 | ||
|     <select id="selectBloodKinshipUnderUmbrella" resultMap="MemberResultMap">
 | ||
|         select t.pk_id, t.member_code, t.member_name, t.phone, t.pk_parent
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_id = #{memberId}
 | ||
|         connect by t.pk_parent = prior t.pk_id
 | ||
|         order by level
 | ||
|     </select>
 | ||
|     <select id="createMemberId" resultType="java.lang.Long">
 | ||
|         SELECT CU_MEMBER_SEQ.NEXTVAL
 | ||
|         FROM DUAL
 | ||
|     </select>
 | ||
|     <!--会员信息列表-->
 | ||
|     <select id="queryCuMemberByCondition" parameterType="com.hzs.member.base.vo.CuMemberVO" resultMap="MemberVO">
 | ||
|         SELECT cm.PK_ID
 | ||
|         FROM cu_member cm
 | ||
|         left join CU_MEMBER_ACCOUNT cma
 | ||
|         on cm.pk_id = cma.PK_MEMBER
 | ||
|         left JOIN cu_member par
 | ||
|         ON par.pk_id = cm.pk_parent
 | ||
|         left JOIN cu_member place
 | ||
|         ON place.pk_id = cm.pk_place_parent
 | ||
|         LEFT JOIN cu_member_team ct
 | ||
|         ON ct.pk_id = cm.pk_team_code
 | ||
|         LEFT JOIN cu_member center
 | ||
|         ON center.pk_id = cm.pk_center_code
 | ||
|         left join bd_awards awa
 | ||
|         on awa.pk_id = cm.PK_AWARDS
 | ||
|         left join bd_grade gr
 | ||
|         on gr.pk_id = cm.PK_REGISTER_GRADE
 | ||
|         left join bd_grade grr
 | ||
|         on grr.pk_id = cm.PK_SETTLE_GRADE
 | ||
|         left join bd_vertex ver
 | ||
|         on cm.pk_vertex = ver.pk_id
 | ||
|         left join CU_MAKER_SPACE cmse on cmse.PK_MEMBER=cm.pk_id and cmse.DEL_FLAG=0 and cmse.store_type = 1
 | ||
|         and cmse.APPROVE_STATUS=5 and cmse.APPLY_STATUS=5
 | ||
|         left join (select pk_member,bg.pk_transaction AGENT_GRADE from cu_member_agent ca
 | ||
|         inner join bd_grade bg
 | ||
|         on ca.agent_grade=bg.pk_id
 | ||
|         where ca.del_flag = 0
 | ||
|         and ca.agent_type = 1) cmat
 | ||
|         on cm.pk_id =cmat.pk_member
 | ||
|         LEFT JOIN CU_MEMBER_HISTROY_AWARDS cmha ON cm.PK_ID = cmha.PK_MEMBER
 | ||
|         LEFT JOIN BD_HISTROY_AWARDS bha ON bha.pk_id = cmha.PK_AWARDS and bha.DEL_FLAG=0
 | ||
|         WHERE cm.del_flag = 0
 | ||
|         and cm.pk_settle_country=#{pkCountry}
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="changeNumber != null">
 | ||
|             and cm.CHANGE_NUMBER=#{changeNumber}
 | ||
|         </if>
 | ||
|         <if test="incomeStatus != null">
 | ||
|             and cm.INCOME_STATUS=#{incomeStatus}
 | ||
|         </if>
 | ||
|         <if test="agentGrade != null">
 | ||
|             and cmat.agent_grade=#{agentGrade}
 | ||
|         </if>
 | ||
|         <if test="isTransfer != null">
 | ||
|             and cma.IS_TRANSFER=#{isTransfer}
 | ||
|         </if>
 | ||
|         <if test="walletStatus != null">
 | ||
|             and cma.IS_WITHDRAW=#{walletStatus}
 | ||
|         </if>
 | ||
|         <if test="isConsume != null">
 | ||
|             and cma.IS_CONSUME=#{isConsume}
 | ||
|         </if>
 | ||
|         <if test="transferStatus != null">
 | ||
|             and cma.TRANSFER_STATUS=#{transferStatus}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="vertexId != null">
 | ||
|             and ver.PK_ID=#{vertexId}
 | ||
|         </if>
 | ||
|         <if test="teamId != null">
 | ||
|             and ct.PK_ID=#{teamId}
 | ||
|         </if>
 | ||
|         <if test="registerAuthority != null">
 | ||
|             and cm.REGISTER_AUTHORITY=#{registerAuthority}
 | ||
|         </if>
 | ||
|         <if test="accountStatus != null">
 | ||
|             and cm.ACCOUNT_STATUS=#{accountStatus}
 | ||
|         </if>
 | ||
|         <if test="isRealName != null">
 | ||
|             and cm.IS_REAL_NAME=#{isRealName}
 | ||
|         </if>
 | ||
|         <if test="serviceAgreement != null">
 | ||
|             and cm.SERVICE_AGREEMENT=#{serviceAgreement}
 | ||
|         </if>
 | ||
|         <if test="isBusLicense != null">
 | ||
|             and cm.is_bus_license=#{isBusLicense}
 | ||
|         </if>
 | ||
|         <if test="orderSource != null">
 | ||
|             and cm.order_source=#{orderSource}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="centerMemberCode != null and centerMemberCode != ''">
 | ||
|             and center.member_code like #{centerMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="centerMemberName != null and centerMemberName != ''">
 | ||
|             and center.member_name like #{centerMemberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="parMemberCode != null and parMemberCode != ''">
 | ||
|             and par.member_code like #{parMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="parMemberName != null and parMemberName != ''">
 | ||
|             and par.member_name like #{parMemberName}||'%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="placeMemberCode != null and placeMemberCode != ''">
 | ||
|             and place.member_code like #{placeMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="placeMemberName != null and placeMemberName != ''">
 | ||
|             and place.member_name like #{placeMemberName}||'%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone=#{phone}
 | ||
|         </if>
 | ||
|         <if test="pkRegisterGrade != null ">
 | ||
|             and cm.pk_register_grade =#{pkRegisterGrade}
 | ||
|         </if>
 | ||
|         <if test="pkSettleGrade != null ">
 | ||
|             and cm.PK_SETTLE_GRADE =#{pkSettleGrade}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards=#{pkAwards}
 | ||
|         </if>
 | ||
|         <if test="directPushNumber != null">
 | ||
|             and cm.DIRECT_PUSH_NUMBER=#{directPushNumber}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="placeDept != null ">
 | ||
|             and cm.place_dept=#{placeDept}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="teamName != null and teamName !=''">
 | ||
|             and ct.team_name like #{teamName}||'%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startDate != null and  startDate !='' ">
 | ||
|             and cm.CREATION_TIME >= to_date(#{startDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDate != null and  endDate !='' ">
 | ||
|             and cm.CREATION_TIME <= to_date(#{endDate} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <if test="startDatePay != null and startDatePay != ''">
 | ||
|             and cm.PAY_TIME >= to_date(#{startDatePay}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDatePay != null and endDatePay != ''">
 | ||
|             and cm.PAY_TIME <= to_date(#{endDatePay} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startExpireDate != null and startExpireDate != ''">
 | ||
|             and cm.EXPIRE_DATE >= to_date(#{startExpireDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endExpireDate != null and endExpireDate != ''">
 | ||
|             and cm.EXPIRE_DATE <= to_date(#{endExpireDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="isWithdraw != null ">
 | ||
|             and cma.IS_WITHDRAW=#{isWithdraw}
 | ||
|         </if>
 | ||
|         <if test="expireStatus != null ">
 | ||
|             and cm.EXPIRE_STATUS=#{expireStatus}
 | ||
|         </if>
 | ||
|         <!-- 体系权限处理 -->
 | ||
|         <if test="vertexList != null and vertexList.size > 0">
 | ||
|             and ver.pk_member in
 | ||
|             <foreach collection="vertexList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <!--团队权限 -->
 | ||
|         <if test="teamList != null and teamList.size > 0">
 | ||
|             and ct.pk_member in
 | ||
|             <foreach collection="teamList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <if test="systemType != null ">
 | ||
|             and cm.SYSTEM_TYPE=#{systemType}
 | ||
|         </if>
 | ||
|         order by cm.CREATION_TIME desc
 | ||
|     </select>
 | ||
| 
 | ||
| 
 | ||
|     <!--会员真实信息列表-->
 | ||
|     <select id="realCuMemberByCondition" parameterType="com.hzs.member.base.vo.CuMemberVO" resultMap="MemberVO">
 | ||
|         SELECT
 | ||
|         cm.PK_ID,
 | ||
|         gr.GRADE_NAME as registerName,
 | ||
|         grr.GRADE_NAME as settleName,
 | ||
|         awa.AWARDS_NAME awardsName,
 | ||
|         cm.member_code,
 | ||
|         cm.SEX,
 | ||
|         cm.BIRTH_DATE,
 | ||
|         cm.member_name,
 | ||
|         cm.phone,
 | ||
|         cm.CARD_TYPE,
 | ||
|         cm.ID_CARD,
 | ||
|         cmg.ID_CARD_JUST,
 | ||
|         cmg.ID_CARD_BACK,
 | ||
|         province.name GIFT_PROVINCE,
 | ||
|         city.name GIFT_CITY,
 | ||
|         county.name GIFT_COUNTY,
 | ||
|         cmg.GIFT_ADDRESS,
 | ||
|         cmb.BANK_NAME,
 | ||
|         cmb.SUB_BANK_NAME,
 | ||
|         cmb.ACCOUNT_NAME,
 | ||
|         cmb.PHONE,
 | ||
|         cmb.CARD_NUMBER,
 | ||
|         cm.EMAIL,
 | ||
|         cm.WECHAT,
 | ||
|         cmg.CREATION_TIME as attestationTime,
 | ||
|         cm.PAY_TIME,
 | ||
|         cm.creation_time
 | ||
|         FROM
 | ||
|         cu_member cm
 | ||
|         left join bd_awards awa on awa.pk_id= cm.PK_AWARDS
 | ||
|         left join bd_grade gr on gr.pk_id=cm.PK_REGISTER_GRADE
 | ||
|         left join bd_grade grr on grr.pk_id=cm.PK_REGISTER_GRADE
 | ||
|         left join cu_member_bank cmb on cmb.PK_MEMBER=cm.PK_ID
 | ||
|         left join CU_MEMBER_GIFT cmg on cmg.PK_MEMBER=cm.PK_ID
 | ||
|         left join bd_area province on province.PK_ID=cmg.GIFT_PROVINCE
 | ||
|         left join bd_area city on city.PK_ID=cmg.GIFT_CITY
 | ||
|         left join bd_area county on county.PK_ID=cmg.GIFT_COUNTY
 | ||
|         WHERE
 | ||
|         cm.del_flag = 0
 | ||
|         and cm.pk_settle_country=#{pkCountry}
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code=#{memberCode}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name=#{memberName}
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone=#{phone}
 | ||
|         </if>
 | ||
|         <if test="pkRegisterGrade != null ">
 | ||
|             and cm.pk_register_grade =#{pkRegisterGrade}
 | ||
|         </if>
 | ||
|         <if test="pkSettleGrade != null ">
 | ||
|             and cm.PK_SETTLE_GRADE =#{pkSettleGrade}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards=#{pkAwards}
 | ||
|         </if>
 | ||
|         <if test="cardType != null">
 | ||
|             and cm.CARD_TYPE=#{cardType}
 | ||
|         </if>
 | ||
|         <if test="birthDate != null">
 | ||
|             and cm.BIRTH_DATE=#{birthDate}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="giftProvince != null">
 | ||
|             and cmg.GIFT_PROVINCE=#{giftProvince}
 | ||
|         </if>
 | ||
|         <if test="giftCity != null">
 | ||
|             and cmg.GIFT_CITY=#{giftCity}
 | ||
|         </if>
 | ||
|         <if test="giftCounty != null">
 | ||
|             and cmg.GIFT_COUNTY=#{giftCounty}
 | ||
|         </if>
 | ||
|         <if test="sex != null">
 | ||
|             and cm.SEX=#{sex}
 | ||
|         </if>
 | ||
|         <if test="pkBdBank != null">
 | ||
|             and cmb.PK_BD_BANK=#{pkBdBank}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="subBankName != null and subBankName != ''">
 | ||
|             and cmb.SUB_BANK_NAME=#{subBankName}
 | ||
|         </if>
 | ||
|         <if test="cardNumber != null and cardNumber != ''">
 | ||
|             and cmb.CARD_NUMBER=#{cardNumber}
 | ||
|         </if>
 | ||
|         <if test="email != null and email != ''">
 | ||
|             and cm.EMAIL=#{email}
 | ||
|         </if>
 | ||
|         <if test="wechat != null and wechat != ''">
 | ||
|             and cm.WECHAT=#{wechat}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startDate != null and  startDate !='' ">
 | ||
|             and cm.CREATION_TIME >= to_date(#{startDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDate != null and  endDate !='' ">
 | ||
|             and cm.CREATION_TIME <= to_date(#{endDate} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <if test="startDatePay != null and startDatePay != ''">
 | ||
|             and cm.PAY_TIME >= to_date(#{startDatePay}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="endDatePay != null and endDatePay != ''">
 | ||
|             and cm.PAY_TIME <= to_date(#{endDatePay} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startAttestationTime != null">
 | ||
|             and cmg.creation_time >= to_date(#{startAttestationTime}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endAttestationTime != null">
 | ||
|             and cmg.creation_time <= to_date(#{endAttestationTime} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="findMemberByMembercodesAndPkcountry" resultMap="MemberResultMap">
 | ||
|         select m.member_code,m.pk_id, m.member_name,m.pk_settle_country
 | ||
|         from cu_member m
 | ||
|         where m.del_flag = 0
 | ||
|         and m.category = 0
 | ||
|         and m.pay_status = 1
 | ||
|         <if test="pkCountry != null">
 | ||
|             and m.pk_settle_country = #{pkCountry}
 | ||
|         </if>
 | ||
|         and m.member_code in
 | ||
|         <foreach collection="memberCodes" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|     </select>
 | ||
| 
 | ||
| 
 | ||
|     <select id="findMemberByMemberCodeList" resultMap="MemberResultMap">
 | ||
|         select m.member_code,m.pk_id, m.member_name,m.pk_settle_country
 | ||
|         from cu_member m
 | ||
|         where m.del_flag = 0
 | ||
|         and m.category = 0
 | ||
|         and m.pay_status = 1
 | ||
|         <if test="pkCountry != null">
 | ||
|             and m.pk_settle_country = #{pkCountry}
 | ||
|         </if>
 | ||
|         <if test="memberCodeList != null and memberCodeList.size > 0">
 | ||
|             and
 | ||
|             m.member_code in
 | ||
|             <foreach collection="memberCodeList" item="item" index="index" open="(" close=")">
 | ||
|                 <if test="index != 0">
 | ||
|                     <choose>
 | ||
|                         <when test="index % 999 == 0">) or m.member_code IN (</when>
 | ||
|                         <otherwise>,</otherwise>
 | ||
|                     </choose>
 | ||
|                 </if>
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 根据会员ID列表查询会员 -->
 | ||
|     <select id="findMemberByMemberId" resultMap="MemberResultMap">
 | ||
|         select cm.pk_id,
 | ||
|         cm.member_code,
 | ||
|         cm.MEMBER_NAME,
 | ||
|         cm.phone,
 | ||
|         cm.pk_settle_country
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.pk_settle_country = #{pkCountry}
 | ||
|         </if>
 | ||
|         and cm.pk_id in
 | ||
|         <foreach collection="pkMemberList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--特殊配置-修改会员编号列表-->
 | ||
|     <select id="puCodeList" parameterType="com.hzs.member.base.vo.UpdateCodeVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateCodeVO">
 | ||
|         select cm.pk_ID as pkId,
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.PHONE as phone,
 | ||
|         cm.PK_SETTLE_GRADE pkSettleGrade,
 | ||
|         cm.PK_AWARDS pkAwards,
 | ||
|         cmp.PK_ID as serviceLogId,
 | ||
|         cmp.NEW_VALUE as newValue,
 | ||
|         cmp.OLD_VALUE as oldValue,
 | ||
|         cmp.changeNumber as changeNumber,
 | ||
|         cmp.CREATION_TIME as creationTime,
 | ||
|         cmp.APPROVE_STATUS as approveStatus,
 | ||
|         cmp.BUSINESS_NO as businessNo,
 | ||
|         cmp.SINGLE_AMOUNT as cost
 | ||
|         from cu_member cm
 | ||
|         INNER JOIN (
 | ||
|         select b.PK_ID,b.pk_member,
 | ||
|         b.OLD_VALUE,
 | ||
|         b.NEW_VALUE,
 | ||
|         b.creation_time,
 | ||
|         b.APPROVE_STATUS,
 | ||
|         b.BUSINESS_NO,
 | ||
|         b.SINGLE_AMOUNT,
 | ||
|         b.APPROVE_NUMBER changeNumber
 | ||
|         from CU_MEMBER_SERVICE_LOG b where b.EDIT_TYPE=109
 | ||
|         ) cmp on cm.pk_ID=cmp.pk_member
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and(cm.member_code like #{memberCode} || '%'
 | ||
|             or cmp.OLD_VALUE like #{memberCode} || '%'
 | ||
|             or cmp.NEW_VALUE like #{memberCode} || '%')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and cmp.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
|         <if test="approveStatus == null">
 | ||
|             and cmp.APPROVE_STATUS=5
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone like #{phone} || '%'
 | ||
|         </if>
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_SETTLE_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards=#{pkAwards}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkSettleGrade != null">
 | ||
|             and cm.PK_SETTLE_GRADE=#{pkSettleGrade}
 | ||
|         </if>
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--    查询会员有效期休止期-->
 | ||
|     <select id="getMemberExpireStopList" parameterType="com.hzs.member.base.vo.UpdateExpireStopVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateExpireStopVO">
 | ||
|         select cm.pk_ID as pkId,
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.phone,
 | ||
|         cmp.PK_ID as serviceLogId,
 | ||
|         cmp.NEW_VALUE as newValue,
 | ||
|         cmp.OLD_VALUE as oldValue,
 | ||
|         cmp.changeNumber as changeNumber,
 | ||
|         cmp.CREATION_TIME as creationTime,
 | ||
|         cmp.APPROVE_STATUS as approveStatus,
 | ||
|         cmp.BUSINESS_NO as businessNo,
 | ||
|         cmp.MODIFIED_TIME modifiedTime
 | ||
|         from cu_member cm
 | ||
|         INNER JOIN (
 | ||
|         select b.PK_ID,b.pk_member,
 | ||
|         b.OLD_VALUE,
 | ||
|         b.NEW_VALUE,
 | ||
|         b.creation_time,
 | ||
|         b.MODIFIED_TIME,
 | ||
|         b.APPROVE_STATUS,
 | ||
|         b.BUSINESS_NO,
 | ||
|         b.SINGLE_AMOUNT,
 | ||
|         b.APPROVE_NUMBER changeNumber
 | ||
|         from CU_MEMBER_SERVICE_LOG b where b.EDIT_TYPE=136
 | ||
|         ) cmp on cm.pk_ID=cmp.pk_member
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode} || '%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and cmp.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_SETTLE_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--    查询全部修改过会员编号的会员记录-->
 | ||
|     <select id="puCodeAllList" parameterType="com.hzs.member.base.vo.UpdateCodeVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateCodeVO">
 | ||
|         select cm.pk_ID as pkId,
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.PHONE as phone,
 | ||
|         cm.PK_SETTLE_GRADE pkSettleGrade,
 | ||
|         cm.PK_AWARDS pkAwards,
 | ||
|         cmp.PK_ID as serviceLogId,
 | ||
|         cmp.NEW_VALUE as newValue,
 | ||
|         cmp.OLD_VALUE as oldValue,
 | ||
|         cmp.changeNumber as changeNumber,
 | ||
|         cmp.CREATION_TIME as creationTime,
 | ||
|         cmp.APPROVE_STATUS as approveStatus,
 | ||
|         cmp.BUSINESS_NO as businessNo,
 | ||
|         cmp.SINGLE_AMOUNT as cost
 | ||
|         from cu_member cm
 | ||
|         INNER JOIN (
 | ||
|         select b.PK_ID,b.pk_member,
 | ||
|         b.OLD_VALUE,
 | ||
|         b.NEW_VALUE,
 | ||
|         b.creation_time,
 | ||
|         b.APPROVE_STATUS,
 | ||
|         b.BUSINESS_NO,
 | ||
|         b.SINGLE_AMOUNT,
 | ||
|         b.APPROVE_NUMBER changeNumber
 | ||
|         from CU_MEMBER_SERVICE_LOG b where b.EDIT_TYPE=109
 | ||
|         ) cmp on cm.pk_ID=cmp.pk_member
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and(cm.member_code like #{memberCode} || '%'
 | ||
|             or cmp.OLD_VALUE like #{memberCode} || '%'
 | ||
|             or cmp.NEW_VALUE like #{memberCode} || '%')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and cmp.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone like #{phone} || '%'
 | ||
|         </if>
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards=#{pkAwards}
 | ||
|         </if>
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkSettleGrade != null">
 | ||
|             and cm.PK_SETTLE_GRADE=#{pkSettleGrade}
 | ||
|         </if>
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
|     <!--查询会员变更前信息-->
 | ||
|     <select id="specialBusinessQuery" parameterType="com.hzs.member.base.vo.UpdateCodeVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateCodeVO">
 | ||
|         select cm.pk_ID as pkId,
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.PK_SETTLE_COUNTRY as pkSettleCountry,
 | ||
|         bc.SHORT_NAME as shortName,
 | ||
|         cm.PHONE as phone,
 | ||
|         cm.PK_SETTLE_GRADE pkSettleGrade,
 | ||
|         cm.PK_AWARDS pkAwards,
 | ||
|         cm.PLACE_DEPT as placeDept,
 | ||
|         par.member_code parMemberCode,
 | ||
|         par.member_name parMemberName,
 | ||
|         place.member_code placeMemberCode,
 | ||
|         place.member_name placeMemberName
 | ||
|         from cu_member cm
 | ||
|         INNER JOIN cu_member par
 | ||
|         ON par.pk_id = cm.pk_parent
 | ||
|         left JOIN cu_member place
 | ||
|         ON place.pk_id = cm.pk_place_parent
 | ||
|         left JOIN BD_COUNTRY bc on bc.pk_id=cm.PK_SETTLE_COUNTRY
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code=#{memberCode}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name=#{memberName}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询会员个人资料 -->
 | ||
|     <select id="queryMemberData" resultType="com.hzs.member.base.vo.MemberDataVO">
 | ||
|         select cm.*,
 | ||
|                bgr.pk_transaction register_grade,
 | ||
|                bgs.pk_transaction settle_grade,
 | ||
|                ba.pk_transaction  awards,
 | ||
|                bam.pk_transaction max_awards,
 | ||
|                bc.short_name      country_name,
 | ||
|                bcs.short_name     settle_country_name,
 | ||
|                cmau.id_card       id_card_auth
 | ||
|         from cu_member cm
 | ||
|                  left join BD_GRADE bgr
 | ||
|                            on bgr.pk_id = cm.pk_register_grade
 | ||
|                                and bgr.del_flag = 0
 | ||
|                  left join BD_GRADE bgs
 | ||
|                            on bgs.pk_id = cm.pk_settle_grade
 | ||
|                                and bgs.del_flag = 0
 | ||
|                  left join BD_AWARDS ba
 | ||
|                            on ba.pk_id = cm.pk_awards
 | ||
|                                and ba.del_flag = 0
 | ||
|                  left join BD_AWARDS bam
 | ||
|                            on bam.pk_id = cm.pk_max_awards
 | ||
|                                and bam.del_flag = 0
 | ||
|                  left join BD_COUNTRY bc
 | ||
|                            on bc.pk_id = cm.pk_country
 | ||
|                  left join BD_COUNTRY bcs
 | ||
|                            on bcs.pk_id = cm.pk_settle_country
 | ||
|                  left join CU_MEMBER_AUTHENTICATION cmau
 | ||
|                            on cmau.pk_member = cm.pk_id
 | ||
|                                and cmau.del_flag = 0
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.pk_id = #{memberId}
 | ||
|     </select>
 | ||
| 
 | ||
|     <update id="batchUpdateMemberNameAndMobileByPkmember">
 | ||
|         MERGE INTO cu_member m
 | ||
|         USING
 | ||
|         (
 | ||
|         <foreach collection="businessMemberList" item="item" index="index" separator="union">
 | ||
|             select #{item.pkMember} pk_member,
 | ||
|             <if test='businessType == "100"'>
 | ||
|                 #{item.newValue} member_name
 | ||
|             </if>
 | ||
|             <if test='businessType == "101"'>
 | ||
|                 #{item.newValue} phone
 | ||
|             </if>
 | ||
|             FROM DUAL
 | ||
|         </foreach>
 | ||
|         ) t
 | ||
|         ON ( t.pk_member=m.pk_id and m.pk_id in
 | ||
|         <foreach collection="businessMemberList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item.pkMember}
 | ||
|         </foreach>)
 | ||
|         WHEN MATCHED THEN
 | ||
|         UPDATE SET
 | ||
|         <if test='businessType == "100"'>
 | ||
|             m.member_name = t.member_name,
 | ||
|         </if>
 | ||
|         <if test='businessType == "101"'>
 | ||
|             m.member_name = DECODE(m.system_type,1,t.phone,m.member_name),
 | ||
|             m.phone = t.phone,
 | ||
|         </if>
 | ||
|         m.MODIFIED_TIME = sysdate,
 | ||
|         m.pk_modified = #{updatePkMember}
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 根据业务类型批量理新 -->
 | ||
|     <update id="batchUpdateMemberByBusinessType" parameterType="com.hzs.member.handlebusiness.vo.HandleBusinessVO">
 | ||
|         update cu_member
 | ||
|         <set>
 | ||
|             <foreach collection="handleBusinessList" item="item" index="index" separator=",">
 | ||
|                 <if test='item.businessType == "102"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         is_real_name = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "103"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         <if test='value == "3"'>
 | ||
|                             login_pwd = #{loginPwd},login_password = #{loginPassword},
 | ||
|                             pay_pwd = #{payPwd},pay_password = #{payPassword}
 | ||
|                         </if>
 | ||
|                         <if test='value == "1"'>
 | ||
|                             login_pwd = #{loginPwd},login_password = #{loginPassword}
 | ||
|                         </if>
 | ||
|                         <if test='value == "2"'>
 | ||
|                             pay_pwd = #{payPwd},pay_password = #{payPassword}
 | ||
|                         </if>
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "106"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         pk_register_grade = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "113"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         pk_settle_grade = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "107"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         pk_awards = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "115"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         pk_country = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "116"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         account_status = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "117"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         income_status = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
| 
 | ||
|                 <if test='item.businessType == "119 "'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value" separator=",">
 | ||
|                         <if test='value == "1"'>
 | ||
|                             purchase_status = 0
 | ||
|                         </if>
 | ||
|                         <if test='value == "2"'>
 | ||
|                             share_status = 0
 | ||
|                         </if>
 | ||
|                         <if test='value == "3"'>
 | ||
|                             purchase_status = 1
 | ||
|                         </if>
 | ||
| 
 | ||
|                         <if test='value == "4"'>
 | ||
|                             share_status = 1
 | ||
|                         </if>
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "120"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         register_authority = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "122"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         is_maker_space = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "142"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         super_studio = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "143"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         is_dealer = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "148"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         LECTURER_LEVEL = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "149"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         SYSTEM_LEVEL = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|                 <if test='item.businessType == "166"'>
 | ||
|                     <foreach collection="item.businessValueList" index="index" item="value">
 | ||
|                         pk_max_awards = #{value}
 | ||
|                     </foreach>
 | ||
|                 </if>
 | ||
|             </foreach>
 | ||
|             ,MODIFIED_TIME = sysdate,
 | ||
|             PK_MODIFIED = #{updatePkMember}
 | ||
|         </set>
 | ||
|         where pk_id in
 | ||
|         <foreach collection="businessMemberList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item.pkMember}
 | ||
|         </foreach>
 | ||
|     </update>
 | ||
| 
 | ||
|     <select id="selectBiddingList" resultType="com.hzs.member.marketnews.vo.UserInvestmentVo">
 | ||
|         select
 | ||
|         cm.MEMBER_CODE memberCode,cm.MEMBER_NAME memberName,cm.PK_REGISTER_GRADE pkRegisterGrade,cm.CREATION_TIME
 | ||
|         creationTime,
 | ||
|         cm.PK_PARENT pkParent,cm.PK_PLACE_PARENT pkPlaceParent,
 | ||
|         (select nvl(sum(so.ORDER_AMOUNT),0) from SA_ORDER so where so.PK_MEMBER = cm.PK_ID
 | ||
|         and so.ORDER_TYPE = 1
 | ||
|         and so.ORDER_STATUS = 1
 | ||
|         and so.DEL_FLAG = 0
 | ||
|         ) regMoney,
 | ||
|         (select nvl(sum(so.ORDER_ACHIEVE),0) from SA_ORDER so where so.PK_MEMBER = cm.PK_ID
 | ||
|         and so.ORDER_TYPE = 1
 | ||
|         and so.ORDER_STATUS = 1
 | ||
|         and so.DEL_FLAG = 0
 | ||
|         ) regPv,
 | ||
|         (mbp.ROUND+1) round,
 | ||
|         mbp.SECOND second,
 | ||
|         so.ORDER_TYPE orderType,cm.PAY_TIME payTime,cm.PLACE_DEPT placeDept
 | ||
|         from CU_MEMBER_BONUS_PUSH mbp
 | ||
|         left join cu_member_bonus mb on mbp.PK_BONUS = mb.PK_ID
 | ||
|         left join cu_member cm on cm.PK_ID = mb.PK_MEMBER
 | ||
|         left join SA_ORDER so on so.PK_ID = mbp.PK_ORDER
 | ||
|         where cm.DEL_FLAG = 0
 | ||
|         and cm.PAY_STATUS = 1
 | ||
|         <if test="memberInfo != null and memberInfo != ''">
 | ||
|             and (cm.member_code=#{memberInfo} or cm.member_name=#{memberInfo})
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code=#{memberCode}
 | ||
|         </if>
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name=#{memberName}
 | ||
|         </if>
 | ||
|         <if test="startCreationTime != null">
 | ||
|             and cm.creation_time >= #{startCreationTime}
 | ||
|         </if>
 | ||
|         <if test="endCreationTime != null">
 | ||
|             and cm.creation_time < #{endCreationTime}
 | ||
|         </if>
 | ||
|         order by mbp.ROUND asc ,mbp.SECOND asc
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--特殊配置-修改结算国列表-->
 | ||
|     <select id="upseCountryList" parameterType="com.hzs.member.base.vo.UpdateSettleCountryVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateSettleCountryVO">
 | ||
|         select cm.pk_ID as pkId,
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cmp.PK_ID as serviceLogId,
 | ||
|         cmp.APPROVE_NUMBER as changeNumber,
 | ||
|         cmp.creation_time as creationTime,
 | ||
|         cm.PK_SETTLE_COUNTRY as pkSettleCountry,
 | ||
|         bc.SHORT_NAME as oldValue,
 | ||
|         bcc.SHORT_NAME as newValue,
 | ||
|         cmp.NEW_VALUE as newSettleCountry,
 | ||
|         cmp.SINGLE_AMOUNT as cost
 | ||
|         from cu_member cm
 | ||
|         INNER JOIN (
 | ||
|         select a.PK_ID,a.pk_member, a.NEW_VALUE, a.APPROVE_NUMBER,
 | ||
|         a.creation_time,a.APPROVE_STATUS,a.BUSINESS_NO,
 | ||
|         a.SINGLE_AMOUNT
 | ||
|         from CU_MEMBER_SERVICE_LOG a
 | ||
|         where a.EDIT_TYPE=124
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and a.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
|         ) cmp on cm.pk_ID=cmp.pk_member
 | ||
|         LEFT JOIN BD_COUNTRY bc on bc.PK_ID=cm.PK_SETTLE_COUNTRY
 | ||
|         LEFT JOIN BD_COUNTRY bcc on bcc.PK_ID=cmp.NEW_VALUE
 | ||
|         where cm.del_flag = 0
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode} || '%'
 | ||
|         </if>
 | ||
| 
 | ||
| 
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--特殊配置 修改结算国列表-->
 | ||
|     <select id="upsettleCountryList" parameterType="com.hzs.member.base.vo.UpdateSettleCountryVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpdateSettleCountryVO">
 | ||
|         select
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.PHONE phone,
 | ||
|         cmp.PK_ID pkId,
 | ||
|         cmp.PK_MEMBER pkMember,
 | ||
|         cmp.APPROVE_NUMBER changeNumber,
 | ||
|         cmp.CREATION_TIME creationTime,
 | ||
|         cmp.APPROVE_STATUS approveStatus,
 | ||
|         bc.SHORT_NAME as oldValue,
 | ||
|         bcc.SHORT_NAME as newValue,
 | ||
|         aw.PK_TRANSACTION pkAwards ,
 | ||
|         ver.VERTEX_NAME as vertexName,
 | ||
|         ct.TEAM_NAME as teamName
 | ||
|         from CU_MEMBER_SERVICE_LOG cmp
 | ||
|         LEFT JOIN CU_SETTLE_COUNTRY_DETAILED b on cmp.PK_ID=b.PK_SERVICE_LOG
 | ||
|         INNER JOIN cu_member cm on cm.pk_ID=cmp.pk_member
 | ||
|         LEFT JOIN BD_COUNTRY bc on bc.PK_ID=cmp.OLD_VALUE
 | ||
|         LEFT JOIN BD_COUNTRY bcc on bcc.PK_ID=cmp.NEW_VALUE
 | ||
|         LEFT JOIN BD_AWARDS aw on aw.PK_ID=cm.PK_AWARDS
 | ||
|         LEFT JOIN cu_member_team ct ON ct.pk_id = cm.pk_team_code
 | ||
|         left join bd_vertex ver on ver.pk_id=ct.PK_BD_VERTEX
 | ||
|         where cmp.EDIT_TYPE = 124 and cm.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode} || '%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and cm.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkCountry != null and approveStatus==5">
 | ||
|             and b.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
|     <!--修改政策币列表-->
 | ||
|     <select id="upPolicyCurrencyList" parameterType="com.hzs.member.base.vo.UpPolicyCurrencyVO"
 | ||
|             resultType="com.hzs.member.base.vo.UpPolicyCurrencyVO">
 | ||
|         select
 | ||
|         cm.MEMBER_CODE as memberCode,
 | ||
|         cm.member_name as memberName,
 | ||
|         cm.PHONE phone,
 | ||
|         cmp.PK_ID pkId,
 | ||
|         cmp.PK_MEMBER pkMember,
 | ||
|         cmp.APPROVE_NUMBER changeNumber,
 | ||
|         cmp.CREATION_TIME creationTime,
 | ||
|         cmp.OLD_VALUE oldValue,
 | ||
|         cmp.NEW_VALUE newValue,
 | ||
|         cmp.BUSINESS_SCOPE businessScope,
 | ||
|         aw.PK_TRANSACTION pkAwards ,
 | ||
|         ver.VERTEX_NAME as vertexName,
 | ||
|         ct.TEAM_NAME as teamName
 | ||
|         from CU_MEMBER_SERVICE_LOG cmp
 | ||
|         LEFT JOIN cu_member cm on cm.pk_ID=cmp.pk_member
 | ||
|         LEFT JOIN BD_AWARDS aw on aw.PK_ID=cm.PK_AWARDS
 | ||
|         LEFT JOIN cu_member_team ct ON ct.pk_id = cm.pk_team_code
 | ||
|         left join bd_vertex ver on ver.pk_id=cm.pk_vertex
 | ||
|         where cmp.EDIT_TYPE = 125 and cm.del_flag = 0
 | ||
|         and cmp.del_flag = 0
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode} || '%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="businessNo != null and businessNo != ''">
 | ||
|             and cm.BUSINESS_NO=#{businessNo}
 | ||
|         </if>
 | ||
|         <if test="pkBdVertex != null">
 | ||
|             and cm.PK_VERTEX=#{pkBdVertex}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.PK_AWARDS=#{pkAwards}
 | ||
|         </if>
 | ||
|         <if test="pkTeamCode != null">
 | ||
|             and cm.pk_team_code=#{pkTeamCode}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cmp.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="approveStatus != null">
 | ||
|             and cmp.APPROVE_STATUS=#{approveStatus}
 | ||
|         </if>
 | ||
|         <if test="startDate != null and endDate != null">
 | ||
|             and cmp.creation_time between #{startDate, jdbcType=TIMESTAMP} and #{endDate, jdbcType=TIMESTAMP}
 | ||
|         </if>
 | ||
|         <if test="pkIdList != null and pkIdList.size > 0">
 | ||
|             and cmp.pk_id in
 | ||
|             <foreach collection="pkIdList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         ORDER BY cmp.CREATION_TIME DESC
 | ||
|     </select>
 | ||
| 
 | ||
| 
 | ||
|     <select id="checkCecharge" parameterType="java.lang.Long"
 | ||
|             resultType="java.lang.Integer">
 | ||
|         select count(1)
 | ||
|         from cu_member_recharge
 | ||
|         where APPROVE_STATE in (0, 1)
 | ||
|           and PK_MEMBER = #{pkMember}
 | ||
|           and DEL_FLAG = 0
 | ||
|     </select>
 | ||
|     <select id="checkWithdraw" parameterType="java.lang.Long"
 | ||
|             resultType="java.lang.Integer">
 | ||
|         select count(1)
 | ||
|         from cu_member_withdraw
 | ||
|         where PK_MEMBER = #{pkMember}
 | ||
|           and APPROVE_STATE not in (4, 5, 6)
 | ||
|           and STATUS = 0
 | ||
|           and DEL_FLAG = 0
 | ||
|     </select>
 | ||
|     <select id="checkAccount" parameterType="java.lang.Long"
 | ||
|             resultType="java.lang.Integer">
 | ||
|         select count(1)
 | ||
|         from cu_member_account
 | ||
|         where (ACCOUNT1 > 0 or
 | ||
|                ACCOUNT2 > 0 or
 | ||
|                ACCOUNT3 > 0 or
 | ||
|                ACCOUNT4 > 0 or
 | ||
|                ACCOUNT5 > 0 or
 | ||
|                ACCOUNT7 > 0 or
 | ||
|                ACCOUNT8 > 0 or
 | ||
|                ACCOUNT9 > 0 or
 | ||
|                ACCOUNT10 > 0)
 | ||
|           and PK_MEMBER = #{pkMember}
 | ||
|     </select>
 | ||
|     <!--查询会员是否存在未完成基础业务办理-->
 | ||
|     <select id="checkmsLogCount"
 | ||
|             resultType="java.lang.Integer">
 | ||
|         select count(1)
 | ||
|         from CU_MEMBER_SERVICE_LOG
 | ||
|         where (APPROVE_STATUS = 1 or
 | ||
|         APPROVE_STATUS = 2 or
 | ||
|         APPROVE_STATUS = 3)
 | ||
|         <if test="pkMember!= null ">
 | ||
|             and PK_MEMBER = #{pkMember}
 | ||
|         </if>
 | ||
|         <if test="editType!= null ">
 | ||
|             and EDIT_TYPE = #{editType}
 | ||
|         </if>
 | ||
|     </select>
 | ||
|     <!--查询会员是否存在未完成注水业绩业务-->
 | ||
|     <select id="checkMemberAchieveCount" parameterType="java.lang.Long"
 | ||
|             resultType="java.lang.Integer">
 | ||
|         select count(1)
 | ||
|         from CU_MEMBER_ACHIEVE_LOG
 | ||
|         where (APPROVE_STATUS = 1 or APPROVE_STATUS = 2 or APPROVE_STATUS = 3)
 | ||
|           and PK_MEMBER = #{pkMember}
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询选择会员列表 -->
 | ||
|     <select id="queryMemberSelect" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select cm.pk_id,
 | ||
|         cm.member_code,
 | ||
|         cm.member_name,
 | ||
|         cm.phone,
 | ||
|         cm.pk_register_grade,
 | ||
|         bdr.pk_transaction register_grade_key,
 | ||
|         cm.pk_settle_grade,
 | ||
|         bds.pk_transaction settle_grade_key,
 | ||
|         cm.pk_awards,
 | ||
|         ba.pk_transaction awards_key
 | ||
|         from cu_member cm
 | ||
|         inner join bd_grade bdr
 | ||
|         on bdr.pk_id = cm.pk_register_grade
 | ||
|         inner join bd_grade bds
 | ||
|         on bds.pk_id = cm.pk_settle_grade
 | ||
|         inner join bd_awards ba
 | ||
|         on ba.pk_id = cm.pk_awards
 | ||
|         where cm.del_flag = 0
 | ||
|         and cm.pk_settle_country = #{pkCountry}
 | ||
|         <if test="param.memberCode != null and param.memberCode != ''">
 | ||
|             and cm.member_code like #{param.memberCode} || '%'
 | ||
|         </if>
 | ||
|         <if test="param.memberName != null and param.memberName != ''">
 | ||
|             and cm.member_name like #{param.memberName} || '%'
 | ||
|         </if>
 | ||
|         <if test="param.phone != null and param.phone != ''">
 | ||
|             and cm.phone = #{param.phone}
 | ||
|         </if>
 | ||
|         <if test="param.pkRegisterGrade != null and param.pkRegisterGrade.size > 0">
 | ||
|             and cm.pk_register_grade in
 | ||
|             <foreach collection="param.pkRegisterGrade" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <if test="param.pkSettleGrade != null and param.pkSettleGrade.size > 0">
 | ||
|             and cm.pk_settle_grade in
 | ||
|             <foreach collection="param.pkSettleGrade" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <if test="param.pkAwards != null and param.pkAwards.size > 0">
 | ||
|             and cm.pk_awards in
 | ||
|             <foreach collection="param.pkAwards" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <if test="param.memberCodeList != null and param.memberCodeList.size > 0">
 | ||
|             and cm.member_code in
 | ||
|             <foreach collection="param.memberCodeList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         order by cm.creation_time desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryCuMemberLastPlaceParent" resultMap="MemberResultMap">
 | ||
|         select cu.place_dept,
 | ||
|                cu.pk_id,
 | ||
|                cu.member_code,
 | ||
|                cu.member_name,
 | ||
|                cu.phone,
 | ||
|                cu.category,
 | ||
|                cu.pk_settle_grade,
 | ||
|                bg.grade_value,
 | ||
|                nick_name,
 | ||
|                service_code,
 | ||
|                pk_vertex
 | ||
|         from (
 | ||
|                  select *
 | ||
|                  from (select 1     place_dept,
 | ||
|                               t.pk_id,
 | ||
|                               t.member_code,
 | ||
|                               t.member_name,
 | ||
|                               t.phone,
 | ||
|                               t.category,
 | ||
|                               t.pk_settle_grade,
 | ||
|                               level lev,
 | ||
|                               t.nick_name,
 | ||
|                               t.service_code,
 | ||
|                               t.pk_vertex
 | ||
|                        from (select *
 | ||
|                              from cu_member start with pk_id=#{pkMember}
 | ||
|                              connect by prior pk_id = pk_place_parent) t
 | ||
|                        where t.place_dept = 1
 | ||
|                          and t.del_flag = 0
 | ||
|                            start
 | ||
|                        with t.pk_id = (select u.pk_id
 | ||
|                            from cu_member u
 | ||
|                            where u.del_flag=0 and u.pk_place_parent=#{pkMember}
 | ||
|                            and place_dept = 1)
 | ||
|                        connect by prior
 | ||
|                            t.pk_id = (select u.pk_place_parent
 | ||
|                            from cu_member u
 | ||
|                            where u.del_flag=0
 | ||
|                               and u.pk_id = t.pk_id
 | ||
|                               and u.place_dept = 1)
 | ||
|                        order by lev desc) n
 | ||
|                  where rownum = 1
 | ||
|                  union
 | ||
|                  select *
 | ||
|                  from (
 | ||
|                           select 2     place_dept,
 | ||
|                                  t.pk_id,
 | ||
|                                  t.member_code,
 | ||
|                                  t.member_name,
 | ||
|                                  t.phone,
 | ||
|                                  t.category,
 | ||
|                                  t.pk_settle_grade,
 | ||
|                                  level lev,
 | ||
|                                  t.nick_name,
 | ||
|                                  t.service_code,
 | ||
|                                  t.pk_vertex
 | ||
|                           from (select *
 | ||
|                                 from cu_member start with pk_id=#{pkMember}
 | ||
|                                 connect by prior pk_id = pk_place_parent) t
 | ||
|                           where t.place_dept = 1
 | ||
|                             and t.del_flag = 0
 | ||
|                               start
 | ||
|                           with t.pk_id = (select u.pk_id
 | ||
|                               from cu_member u
 | ||
|                               where u.del_flag=0 and u.pk_place_parent=#{pkMember}
 | ||
|                               and place_dept = 2)
 | ||
|                           connect by prior
 | ||
|                               t.pk_id = (select u.pk_place_parent
 | ||
|                               from cu_member u
 | ||
|                               where u.del_flag=0
 | ||
|                                  and u.pk_id = t.pk_id
 | ||
|                                  and u.place_dept = 1)
 | ||
|                           union
 | ||
|                           select t.place_dept, t.pk_id, t.member_code, t.member_name, t.phone, t.category, t.pk_settle_grade, 0 lev, t.nick_name, t.service_code, t.pk_vertex
 | ||
|                           from cu_member t
 | ||
|                           where t.place_dept = 2 and t.del_flag = 0 and t.pk_place_parent=#{pkMember}
 | ||
|                           union
 | ||
|                           select 2, t.pk_id, t.member_code, t.member_name, t.phone, t.category, t.pk_settle_grade, -1 lev, t.nick_name, t.service_code, t.pk_vertex
 | ||
|                           from cu_member t
 | ||
|                           where t.del_flag = 0 and t.pk_id=#{pkMember}
 | ||
|                           order by lev desc) n
 | ||
|                  where rownum = 1) cu
 | ||
|                  left join bd_grade bg
 | ||
|                            on cu.pk_settle_grade = bg.pk_id
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectByMemberRealInfo" resultType="com.hzs.member.base.vo.MemberRealInfoVO">
 | ||
|         select
 | ||
|         cm.member_code as memberCode,
 | ||
|         cm.member_name memberName,
 | ||
|         cm.phone phone,
 | ||
|         cm.pk_register_grade as pkRegisterGrade,
 | ||
|         cm.pk_settle_grade as pkSettleGrade,
 | ||
|         cm.pk_awards as pkAwards,
 | ||
|         ma.sex as sex,
 | ||
|         cm.birth_date birthDate,
 | ||
|         ma.id_type idType,
 | ||
|         ma.id_card idCard,
 | ||
|         ma.id_front idFront,
 | ||
|         ma.id_back idBack,
 | ||
|         ma.address address,
 | ||
|         ma.phone reservedPhone,
 | ||
|         ma.card_number cardNumber,
 | ||
|         ma.creation_time certificationTime,
 | ||
|         cm.creation_time creationTime,
 | ||
|         cm.pay_time payTime,
 | ||
|         cm.direct_push_number directPushNumber
 | ||
|         from cu_member_authentication ma
 | ||
|         left join cu_member cm on ma.pk_member = cm.PK_ID
 | ||
|         left join bd_vertex ver on cm.pk_vertex = ver.pk_id
 | ||
|         LEFT JOIN cu_member_team ct ON ct.pk_id = cm.pk_team_code
 | ||
|         where cm.del_flag = 0
 | ||
|         and ma.del_flag = 0
 | ||
|         and cm.PK_SETTLE_COUNTRY = #{pkCountry}
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode} ||'%'
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName} ||'%'
 | ||
|         </if>
 | ||
|         <if test="birthDate != null">
 | ||
|             and cm.birth_date = to_date(#{birthDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone = #{phone}
 | ||
|         </if>
 | ||
|         <if test="pkRegisterGrade != null">
 | ||
|             and cm.pk_register_grade = #{pkRegisterGrade}
 | ||
|         </if>
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards = #{pkAwards}
 | ||
|         </if>
 | ||
|         <if test="pkSettleGrade != null">
 | ||
|             and cm.pk_settle_grade = #{pkSettleGrade}
 | ||
|         </if>
 | ||
|         <if test="idType != null">
 | ||
|             and ma.id_type = #{idType}
 | ||
|         </if>
 | ||
|         <if test="idCard != null and idCard != ''">
 | ||
|             and ma.id_card = #{idCard}
 | ||
|         </if>
 | ||
|         <if test="sex != null">
 | ||
|             and ma.sex = #{sex}
 | ||
|         </if>
 | ||
|         <if test="startCertificationTime != null">
 | ||
|             and ma.CREATION_TIME >= to_date(#{startCertificationTime}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endCertificationTime != null">
 | ||
|             and ma.CREATION_TIME <= to_date(#{endCertificationTime} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <if test="startCreationTime != null">
 | ||
|             and cm.CREATION_TIME >= to_date(#{startCreationTime}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endCreationTime != null">
 | ||
|             and cm.CREATION_TIME <= to_date(#{endCreationTime} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <if test="startPayTime != null">
 | ||
|             and cm.PAY_TIME >= to_date(#{startPayTime}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endPayTime != null">
 | ||
|             and cm.PAY_TIME <= to_date(#{endPayTime} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <!-- 体系权限处理 -->
 | ||
|         <if test="vertexList != null and vertexList.size > 0">
 | ||
|             and ver.pk_member in
 | ||
|             <foreach collection="vertexList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <!--团队权限 -->
 | ||
|         <if test="teamList != null and teamList.size > 0">
 | ||
|             and ct.pk_member in
 | ||
|             <foreach collection="teamList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         order by cm.CREATION_TIME desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectRegList" resultType="com.hzs.member.marketnews.vo.UserInvestmentVo">
 | ||
|         select
 | ||
|         cm.MEMBER_CODE memberCode,
 | ||
|         cm.MEMBER_NAME memberName,
 | ||
|         cm.PK_REGISTER_GRADE pkRegisterGrade,
 | ||
|         cm.CREATION_TIME creationTime,
 | ||
|         cm.PK_PARENT pkParent,
 | ||
|         cm.PK_PLACE_PARENT pkPlaceParent,
 | ||
|         nvl(a.regMoney, 0) regMoney,
 | ||
|         nvl(a.regPv, 0) regPv,
 | ||
|         cm.PAY_TIME payTime,
 | ||
|         cm.PLACE_DEPT placeDept,
 | ||
|         pm.MEMBER_NAME placeParentName,
 | ||
|         pm.MEMBER_CODE placeParentCode,
 | ||
|         pm.pk_vertex place_pk_vertex,
 | ||
|         pm.service_code place_service_code,
 | ||
|         pm.nick_name place_nick_name,
 | ||
|         pp.MEMBER_NAME parentName,
 | ||
|         pp.MEMBER_CODE parentCode,
 | ||
|         pp.pk_vertex parent_pk_vertex,
 | ||
|         pp.service_code parent_service_code,
 | ||
|         pp.nick_name parent_nick_name,
 | ||
|         cm.pk_vertex,
 | ||
|         cm.service_code,
 | ||
|         cm.nick_name
 | ||
|         from cu_member cm
 | ||
|         left join (
 | ||
|         select
 | ||
|                nvl(sum(so.ORDER_AMOUNT),0) regMoney,
 | ||
|                nvl(sum(so.ORDER_ACHIEVE),0) regPv,
 | ||
|                so.PK_MEMBER
 | ||
|         from SA_ORDER so
 | ||
|         where
 | ||
|         ((so.ORDER_TYPE in (1, 24)) or
 | ||
|         (so.order_type = 3 and so.ORDER_TYPE_EXTEND = 1))
 | ||
|         and so.ORDER_STATUS = 1
 | ||
|         and so.DEL_FLAG = 0
 | ||
|         group by so.PK_MEMBER
 | ||
|         )a on a.PK_MEMBER = cm.PK_ID
 | ||
|         left join cu_member pm on pm.pk_id = cm.PK_PLACE_PARENT
 | ||
|         left join cu_member pp on pp.pk_id = cm.PK_PARENT
 | ||
|         where cm.DEL_FLAG = 0
 | ||
|         and cm.PAY_STATUS = 1
 | ||
|         and cm.CATEGORY = 0
 | ||
|         <if test="memberInfo != null and memberInfo != ''">
 | ||
|             and (cm.member_code=#{memberInfo} or cm.member_name=#{memberInfo})
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and (cm.member_code=#{memberCode} or cm.SERVICE_CODE = #{memberCode})
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and (cm.member_name=#{memberName} or cm.nick_name = #{memberName})
 | ||
|         </if>
 | ||
|         <if test="pkRegisterGrade != null">
 | ||
|             and cm.PK_REGISTER_GRADE=#{pkRegisterGrade}
 | ||
|         </if>
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_COUNTRY=#{pkCountry}
 | ||
|         </if>
 | ||
|         <if test="pkCreator != null">
 | ||
|             and cm.PK_CREATOR=#{pkCreator}
 | ||
|         </if>
 | ||
|         <if test="startCreationTime != null">
 | ||
|             and cm.creation_time >= #{startCreationTime}
 | ||
|         </if>
 | ||
|         <if test="endCreationTime != null">
 | ||
|             and cm.creation_time < #{endCreationTime}
 | ||
|         </if>
 | ||
|         order by cm.CREATION_TIME desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="findNoPayMember" resultType="string">
 | ||
|         select m.member_code
 | ||
|         from cu_member m
 | ||
|         where m.del_flag = 0
 | ||
|         and m.category = 0
 | ||
|         and m.pay_status = 0
 | ||
|         and m.pk_settle_country = #{pkCountry}
 | ||
|         and m.member_code in
 | ||
|         <foreach collection="memberCodes" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryMemberByCondition" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select cm.pk_id,cm.member_code,cm.member_name,cm.phone,cm.pk_settle_country,cm.pk_parent,
 | ||
|         cm.pk_place_parent,cm.place_dept,cm.pk_team_code,cm.pk_center_code,cm.category,cm.pk_settle_grade,
 | ||
|         cm.pk_awards,cm.purchase_status,cm.order_source,cm.is_real_name,cm.is_bus_license,cm.is_maker_space,
 | ||
|         cm.share_status,cm.pay_pwd,cm.register_authority,cm.nick_name,bg.grade_value,
 | ||
|         cm.pk_vertex,
 | ||
|         cm.service_code
 | ||
|         from cu_member cm
 | ||
|         left join bd_grade bg
 | ||
|         on cm.pk_settle_grade = bg.pk_id
 | ||
|         where cm.del_flag=0
 | ||
|         <if test="pkSettleCountry != null">
 | ||
|             and cm.pk_settle_country=#{pkSettleCountry}
 | ||
|         </if>
 | ||
|         <if test="pkId != null ">
 | ||
|             and cm.pk_id = #{pkId}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name = #{memberName}
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone = #{phone}
 | ||
|         </if>
 | ||
|         <if test="pkParent != null and pkParent != ''">
 | ||
|             and cm.pk_parent = #{pkParent}
 | ||
|         </if>
 | ||
|         <if test="pkPlaceParent != null and pkPlaceParent != ''">
 | ||
|             and cm.pk_place_parent = #{pkPlaceParent}
 | ||
|         </if>
 | ||
|         <if test="placeDept != null and placeDept != ''">
 | ||
|             and cm.place_dept = #{placeDept}
 | ||
|         </if>
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="parentList" resultType="com.hzs.member.base.vo.ParentMemberVo">
 | ||
|         select a.* from ( select cm.CONSUME_MONEY consumeMoney,cm.CONSUME_ACHIEVE consumeAchieve,cm.member_code
 | ||
|         memberCode,cm.member_name memberName,cm.PK_REGISTER_GRADE pkRegisterGrade,
 | ||
|         cm.PK_SETTLE_GRADE pkSettleGrade,
 | ||
|         cm.CREATION_TIME creationTime,
 | ||
|         cm.pk_vertex,
 | ||
|         cm.nick_name,
 | ||
|         cm.service_code
 | ||
|         from CU_MEMBER cm
 | ||
|         where 1 = 1 and cm.DEL_FLAG = 0 and cm.pay_status=1 and cm.PK_SETTLE_GRADE != 1
 | ||
| 
 | ||
|         <if test="memberInfo != null and memberInfo != ''">
 | ||
|             and (cm.member_code=#{memberInfo} or cm.member_name=#{memberInfo})
 | ||
|         </if>
 | ||
|         <if test="pkParent != null">
 | ||
|             and cm.PK_PARENT = #{pkParent}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and (cm.member_code = #{memberCode} or cm.SERVICE_CODE = #{memberCode})
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and (cm.member_name = #{memberName} or cm.NICK_NAME = #{memberName})
 | ||
|         </if>
 | ||
|         <if test="startCreateTime != null">
 | ||
|             and cm.CREATION_TIME >= #{startCreateTime}
 | ||
|         </if>
 | ||
|         <if test="endCreateTime != null">
 | ||
|             and cm.CREATION_TIME <= #{endCreateTime}
 | ||
|         </if>
 | ||
| 
 | ||
|         union all
 | ||
| 
 | ||
|         select cm.CONSUME_MONEY consumeMoney,cm.CONSUME_ACHIEVE consumeAchieve,cm.member_code memberCode,cm.member_name
 | ||
|         memberName,cm.PK_REGISTER_GRADE pkRegisterGrade,
 | ||
|         cm.PK_SETTLE_GRADE pkSettleGrade,
 | ||
|         cm.CREATION_TIME creationTime,
 | ||
|         cm.pk_vertex,
 | ||
|         cm.nick_name,
 | ||
|         cm.service_code
 | ||
|         from CU_MEMBER cm
 | ||
|         where 1 = 1 and cm.DEL_FLAG = 0 and cm.pay_status=1 and cm.PK_SETTLE_GRADE = 1
 | ||
|         and (
 | ||
|         (select count(so.PK_ID) from sa_order so where so.PK_MEMBER = cm.pk_id and so.DEL_FLAG = 0 and so.ORDER_STATUS =
 | ||
|         1) > 0
 | ||
|         )
 | ||
|         <if test="memberInfo != null and memberInfo != ''">
 | ||
|             and (cm.member_code=#{memberInfo} or cm.member_name=#{memberInfo})
 | ||
|         </if>
 | ||
|         <if test="pkParent != null">
 | ||
|             and cm.PK_PARENT = #{pkParent}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and (cm.member_code = #{memberCode} or cm.SERVICE_CODE = #{memberCode})
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and (cm.member_name = #{memberName} or cm.NICK_NAME = #{memberName})
 | ||
|         </if>
 | ||
|         <if test="startCreateTime != null">
 | ||
|             and cm.CREATION_TIME >= #{startCreateTime}
 | ||
|         </if>
 | ||
|         <if test="endCreateTime != null">
 | ||
|             and cm.CREATION_TIME <= #{endCreateTime}
 | ||
|         </if>
 | ||
|         ) a order by a.creationTime desc
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 校验是否血缘关系 -->
 | ||
|     <select id="checkParent" resultType="int">
 | ||
|         select count(1)
 | ||
|         from cu_member cm
 | ||
|         where cm.member_code = #{topCode} start
 | ||
|         with cm.pk_id = #{pkMember}
 | ||
|         connect by cm.pk_id = prior cm.pk_parent
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询会员是否在血缘下 -->
 | ||
|     <select id="checkMemberByParentList" resultMap="MemberResultMap">
 | ||
|         <foreach collection="topCodeList" item="topCode" separator=" union ">
 | ||
|             select cm.member_code
 | ||
|             from cu_member cm
 | ||
|             where cm.member_code = #{topCode}
 | ||
|             start with cm.pk_id = #{userId}
 | ||
|             connect by cm.pk_id = prior cm.pk_parent
 | ||
|         </foreach>
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 校验会员编号是否存在 -->
 | ||
|     <select id="checkMemberCodeExist" resultType="com.hzs.member.base.dto.MemberCountDTO">
 | ||
|         select tmp.member_code, count(tmp.member_code) member_count
 | ||
|         from (
 | ||
|         select cm.member_code
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|         and (cm.member_code in ('0'
 | ||
|         <foreach collection="codeList" item="item" close=")" index="index">
 | ||
|             <choose>
 | ||
|                 <when test="index % 500 == 0">) or cm.member_code in (#{item}</when>
 | ||
|                 <otherwise>, #{item}</otherwise>
 | ||
|             </choose>
 | ||
|         </foreach>
 | ||
|         )
 | ||
|         <if test="checkEmpty != null and checkEmpty">
 | ||
|             <!-- 需要校验批量空单数据 -->
 | ||
|             union all
 | ||
|             select cmed.member_code
 | ||
|             from CU_MEMBER_EMPTY_DETAIL cmed
 | ||
|             inner join CU_MEMBER_EMPTY cme
 | ||
|             on cme.pk_id = cmed.pk_member_empty
 | ||
|             and cme.status in (1, 2, 4)
 | ||
|             and cme.del_flag = 0
 | ||
|             where cmed.del_flag = 0
 | ||
|             <if test="excludeMemberEmpty != null">
 | ||
|                 and cmed.pk_member_empty != #{excludeMemberEmpty}
 | ||
|             </if>
 | ||
|             and (cmed.member_code in ('0'
 | ||
|             <foreach collection="codeList" item="item" close=")" index="index">
 | ||
|                 <choose>
 | ||
|                     <when test="index % 500 == 0">) or cmed.member_code in (#{item}</when>
 | ||
|                     <otherwise>, #{item}</otherwise>
 | ||
|                 </choose>
 | ||
|             </foreach>
 | ||
|             )
 | ||
|         </if>
 | ||
|         ) tmp
 | ||
|         group by tmp.member_code
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryCuMemberByMemberList" resultType="com.hzs.member.base.vo.CuMemberVO">
 | ||
|         SELECT cm.PK_ID,
 | ||
|         cm.member_code,
 | ||
|         cm.NICK_NAME,
 | ||
|         cm.PAY_TIME,
 | ||
|         cm.CHANGE_NUMBER,
 | ||
|         cm.CREATION_TIME,
 | ||
|         cm.INCOME_STATUS,
 | ||
|         cm.IS_REAL_NAME,
 | ||
|         cm.ACCOUNT_STATUS,
 | ||
|         cm.member_name,
 | ||
|         cm.phone,
 | ||
|         cm.customer_type,
 | ||
|         cm.purchase_status,
 | ||
|         cm.share_status,
 | ||
|         cm.super_studio,
 | ||
|         cm.LECTURER_LEVEL,
 | ||
|         cm.SYSTEM_LEVEL,
 | ||
|         cm.source,
 | ||
|         cm.consume_achieve,
 | ||
|         cm.pay_status,
 | ||
|         cm.email,
 | ||
|         cm.register_authority,
 | ||
|         cm.order_source,
 | ||
|         cm.is_bus_license,
 | ||
|         cm.is_maker_space,
 | ||
|         cm.edit_number,
 | ||
|         cm.consume_money,
 | ||
|         cm.CATEGORY as category,
 | ||
|         cm.IS_DEALER,
 | ||
|         cma.IS_TRANSFER as isTransfer,
 | ||
|         cma.IS_WITHDRAW as isWithdraw,
 | ||
|         cma.IS_CONSUME as isConsume,
 | ||
|         cma.TRANSFER_STATUS as transferStatus,
 | ||
|         ver.VERTEX_NAME as vertexName,
 | ||
|         gr.PK_TRANSACTION as PK_REGISTER_GRADE,
 | ||
|         grr.PK_TRANSACTION as PK_SETTLE_GRADE,
 | ||
|         awa.PK_TRANSACTION as PK_AWARDS,
 | ||
|         awMax.PK_TRANSACTION as pkMaxAwards,
 | ||
|         ct.TEAM_NAME as teamName,
 | ||
|         par.member_code par_member_code,
 | ||
|         par.member_name par_member_name,
 | ||
|         place.member_code place_member_code,
 | ||
|         place.member_name place_member_name,
 | ||
|         cm.place_dept,
 | ||
|         center.member_code center_member_code,
 | ||
|         center.member_name center_member_name,
 | ||
|         cmat.AGENT_GRADE,
 | ||
|         cms.STORE_LEVEL,
 | ||
|         cm.DIRECT_PUSH_NUMBER,
 | ||
|         cm.SERVICE_AGREEMENT,
 | ||
|         cm.EXPIRE_DATE,
 | ||
|         cm.STOP_DATE stopDate,
 | ||
|         cm.IS_MAKER_GIFT isMakerGift,
 | ||
|         cm.MAKER_GIFT_TIME makerGiftTime,
 | ||
|         cm.EXPIRE_STATUS expireStatus,
 | ||
|         cm.SYSTEM_TYPE systemType,
 | ||
|         bha.AWARDS_NAME histroyAwardsName
 | ||
|         FROM cu_member cm
 | ||
|         left join CU_MEMBER_ACCOUNT cma
 | ||
|         on cm.pk_id = cma.PK_MEMBER
 | ||
|         left JOIN cu_member par
 | ||
|         ON par.pk_id = cm.pk_parent
 | ||
|         left JOIN cu_member place
 | ||
|         ON place.pk_id = cm.pk_place_parent
 | ||
|         LEFT JOIN cu_member_team ct
 | ||
|         ON ct.pk_id = cm.pk_team_code
 | ||
|         LEFT JOIN cu_member center
 | ||
|         ON center.pk_id = cm.pk_center_code
 | ||
|         left join bd_awards awa
 | ||
|         on awa.pk_id = cm.PK_AWARDS
 | ||
|         left join bd_awards awMax
 | ||
|         on awMax.pk_id = cm.PK_MAX_AWARDS
 | ||
|         left join bd_grade gr
 | ||
|         on gr.pk_id = cm.PK_REGISTER_GRADE
 | ||
|         left join bd_grade grr
 | ||
|         on grr.pk_id = cm.PK_SETTLE_GRADE
 | ||
|         left join bd_vertex ver
 | ||
|         on cm.pk_vertex = ver.pk_id
 | ||
|         left join (select pk_member,bg.pk_transaction AGENT_GRADE from cu_member_agent ca
 | ||
|         inner join bd_grade bg
 | ||
|         on ca.agent_grade=bg.pk_id
 | ||
|         where ca.del_flag = 0
 | ||
|         and ca.agent_type = 1) cmat
 | ||
|         on cm.pk_id =cmat.pk_member
 | ||
|         left join (select PK_MEMBER,STORE_LEVEL from cu_maker_space
 | ||
|         where STORE_TYPE = 1 and del_flag = 0
 | ||
|         and APPROVE_STATUS = 5) cms
 | ||
|         on cm.pk_id = cms.pk_member
 | ||
|         left join CU_MAKER_SPACE cmse on cmse.PK_MEMBER=cm.pk_id and cmse.DEL_FLAG=0 and cmse.store_type = 1
 | ||
|         and cmse.APPROVE_STATUS=5 and cmse.APPLY_STATUS=5
 | ||
|         LEFT JOIN CU_MEMBER_HISTROY_AWARDS cmha ON cm.PK_ID = cmha.PK_MEMBER
 | ||
|         LEFT JOIN BD_HISTROY_AWARDS bha ON bha.pk_id = cmha.PK_AWARDS and bha.DEL_FLAG=0
 | ||
|         WHERE cm.del_flag = 0 and cm.pk_id in
 | ||
|         <foreach collection="cuMemberVOList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item.pkId}
 | ||
|         </foreach>
 | ||
|         order by cm.CREATION_TIME desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--会员信息导出-->
 | ||
|     <select id="queryCuMemberByMemberListExcel" resultType="com.hzs.member.base.vo.CuMemberVO">
 | ||
|         SELECT cm.PK_ID,
 | ||
|         cm.member_code,
 | ||
|         cm.NICK_NAME,
 | ||
|         cm.PAY_TIME,
 | ||
|         cm.CHANGE_NUMBER,
 | ||
|         cm.CREATION_TIME,
 | ||
|         cm.INCOME_STATUS,
 | ||
|         cm.IS_REAL_NAME,
 | ||
|         cm.ACCOUNT_STATUS,
 | ||
|         cm.member_name,
 | ||
|         cm.phone,
 | ||
|         cm.SYSTEM_TYPE systemType,
 | ||
|         cm.customer_type,
 | ||
|         cm.CATEGORY as category,
 | ||
|         cm.purchase_status,
 | ||
|         cm.share_status,
 | ||
|         cm.super_studio,
 | ||
|         cm.LECTURER_LEVEL,
 | ||
|         cm.SYSTEM_LEVEL,
 | ||
|         cm.source,
 | ||
|         cm.consume_achieve,
 | ||
|         cm.pay_status,
 | ||
|         cm.email,
 | ||
|         cm.register_authority,
 | ||
|         cm.order_source,
 | ||
|         cm.is_bus_license,
 | ||
|         cm.is_maker_space,
 | ||
|         cm.edit_number,
 | ||
|         cm.consume_money,
 | ||
|         cm.IS_DEALER,
 | ||
|         cm.DIRECT_PUSH_NUMBER,
 | ||
|         cma.IS_TRANSFER as isTransfer,
 | ||
|         cma.IS_WITHDRAW as isWithdraw,
 | ||
|         cma.IS_CONSUME as isConsume,
 | ||
|         cma.TRANSFER_STATUS as transferStatus,
 | ||
|         ver.VERTEX_NAME as vertexName,
 | ||
|         ct.TEAM_NAME as teamName,
 | ||
|         gr.PK_TRANSACTION as PK_REGISTER_GRADE,
 | ||
|         grr.PK_TRANSACTION as PK_SETTLE_GRADE,
 | ||
|         awa.PK_TRANSACTION as PK_AWARDS,
 | ||
|         awMax.PK_TRANSACTION as pkMaxAwards,
 | ||
|         par.member_code par_member_code,
 | ||
|         par.member_name par_member_name,
 | ||
|         place.member_code place_member_code,
 | ||
|         place.member_name place_member_name,
 | ||
|         cm.place_dept,
 | ||
|         center.member_code center_member_code,
 | ||
|         center.member_name center_member_name,
 | ||
|         cmat.AGENT_GRADE,
 | ||
|         cms.STORE_LEVEL,
 | ||
|         cm.SERVICE_AGREEMENT,
 | ||
|         cm.EXPIRE_DATE,
 | ||
|         cm.STOP_DATE stopDate,
 | ||
|         cm.EXPIRE_STATUS expireStatus,
 | ||
|         cm.IS_MAKER_GIFT isMakerGift,
 | ||
|         cm.MAKER_GIFT_TIME makerGiftTime,
 | ||
|         bha.AWARDS_NAME histroyAwardsName
 | ||
|         FROM cu_member cm
 | ||
|         inner join CU_MEMBER_ACCOUNT cma
 | ||
|         on cm.pk_id = cma.PK_MEMBER
 | ||
|         INNER JOIN cu_member par
 | ||
|         ON par.pk_id = cm.pk_parent
 | ||
|         LEFT JOIN cu_member place
 | ||
|         ON place.pk_id = cm.pk_place_parent
 | ||
|         LEFT JOIN cu_member_team ct
 | ||
|         ON ct.pk_id = cm.pk_team_code
 | ||
|         LEFT JOIN CU_MAKER_SPACE cmse ON cmse.PK_MEMBER = cm.pk_id
 | ||
|         AND cmse.DEL_FLAG = 0
 | ||
|         AND cmse.store_type = 1
 | ||
|         and cmse.APPROVE_STATUS=5
 | ||
|         and cmse.APPLY_STATUS=5
 | ||
|         LEFT JOIN cu_member center
 | ||
|         ON center.pk_id = cm.pk_center_code
 | ||
|         left join bd_awards awa
 | ||
|         on awa.pk_id = cm.PK_AWARDS
 | ||
|         left join bd_awards awMax
 | ||
|         on awMax.pk_id = cm.PK_MAX_AWARDS
 | ||
|         left join bd_grade gr
 | ||
|         on gr.pk_id = cm.PK_REGISTER_GRADE
 | ||
|         left join bd_grade grr
 | ||
|         on grr.pk_id = cm.PK_SETTLE_GRADE
 | ||
|         left join bd_vertex ver
 | ||
|         on cm.pk_vertex = ver.pk_id
 | ||
|         left join (select pk_member,bg.pk_transaction AGENT_GRADE from cu_member_agent ca
 | ||
|         inner join bd_grade bg
 | ||
|         on ca.agent_grade=bg.pk_id
 | ||
|         where ca.del_flag = 0
 | ||
|         and ca.agent_type = 1) cmat
 | ||
|         on cm.pk_id =cmat.pk_member
 | ||
|         LEFT JOIN CU_MEMBER_HISTROY_AWARDS cmha ON cm.PK_ID = cmha.PK_MEMBER
 | ||
|         LEFT JOIN BD_HISTROY_AWARDS bha ON bha.pk_id = cmha.PK_AWARDS and bha.DEL_FLAG=0
 | ||
|         left join (select PK_MEMBER,STORE_LEVEL from cu_maker_space
 | ||
|         where STORE_TYPE = 1 and del_flag = 0
 | ||
|         and APPROVE_STATUS = 5) cms
 | ||
|         on cm.pk_id = cms.pk_member
 | ||
|         WHERE cm.del_flag = 0 and cm.pk_id in
 | ||
|         (
 | ||
|         SELECT cm.PK_ID
 | ||
|         FROM cu_member cm
 | ||
|         inner join CU_MEMBER_ACCOUNT cma
 | ||
|         on cm.pk_id = cma.PK_MEMBER
 | ||
|         INNER JOIN cu_member par
 | ||
|         ON par.pk_id = cm.pk_parent
 | ||
|         LEFT JOIN cu_member place
 | ||
|         ON place.pk_id = cm.pk_place_parent
 | ||
|         LEFT JOIN cu_member_team ct
 | ||
|         ON ct.pk_id = cm.pk_team_code
 | ||
|         LEFT JOIN cu_member center
 | ||
|         ON center.pk_id = cm.pk_center_code
 | ||
|         left join bd_awards awa
 | ||
|         on awa.pk_id = cm.PK_AWARDS
 | ||
|         left join bd_grade gr
 | ||
|         on gr.pk_id = cm.PK_REGISTER_GRADE
 | ||
|         left join bd_grade grr
 | ||
|         on grr.pk_id = cm.PK_SETTLE_GRADE
 | ||
|         left join bd_vertex ver
 | ||
|         on cm.pk_vertex = ver.pk_id
 | ||
|         left join (select pk_member,bg.pk_transaction AGENT_GRADE from cu_member_agent ca
 | ||
|         inner join bd_grade bg
 | ||
|         on ca.agent_grade=bg.pk_id
 | ||
|         where ca.del_flag = 0
 | ||
|         and ca.agent_type = 1) cmat
 | ||
|         on cm.pk_id =cmat.pk_member
 | ||
|         WHERE cm.del_flag = 0
 | ||
|         and cm.pk_settle_country=#{pkCountry}
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code like #{memberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="memberCodeList != null and memberCodeList.size > 0">
 | ||
|             and
 | ||
|             (cm.member_code in
 | ||
|             <foreach collection="memberCodeList" item="item" index="index" open="(" close=")">
 | ||
|                 <if test="index != 0">
 | ||
|                     <choose>
 | ||
|                         <when test="index % 500 == 0">) or cm.member_code IN (</when>
 | ||
|                         <otherwise>,</otherwise>
 | ||
|                     </choose>
 | ||
|                 </if>
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|             )
 | ||
|         </if>
 | ||
|         <if test="expireStatus != null ">
 | ||
|             and cm.EXPIRE_STATUS=#{expireStatus}
 | ||
|         </if>
 | ||
|         <if test="changeNumber != null">
 | ||
|             and cm.CHANGE_NUMBER=#{changeNumber}
 | ||
|         </if>
 | ||
|         <if test="agentGrade != null">
 | ||
|             and cmat.agent_grade=#{agentGrade}
 | ||
|         </if>
 | ||
|         <if test="isTransfer != null">
 | ||
|             and cma.IS_TRANSFER=#{isTransfer}
 | ||
|         </if>
 | ||
|         <if test="walletStatus != null">
 | ||
|             and cma.IS_WITHDRAW=#{walletStatus}
 | ||
|         </if>
 | ||
|         <if test="isConsume != null">
 | ||
|             and cma.IS_CONSUME=#{isConsume}
 | ||
|         </if>
 | ||
|         <if test="transferStatus != null">
 | ||
|             and cma.TRANSFER_STATUS=#{transferStatus}
 | ||
|         </if>
 | ||
|         <if test="vertexId != null">
 | ||
|             and ver.PK_ID=#{vertexId}
 | ||
|         </if>
 | ||
|         <if test="teamId != null">
 | ||
|             and ct.PK_ID=#{teamId}
 | ||
|         </if>
 | ||
|         <if test="registerAuthority != null">
 | ||
|             and cm.REGISTER_AUTHORITY=#{registerAuthority}
 | ||
|         </if>
 | ||
|         <if test="accountStatus != null">
 | ||
|             and cm.ACCOUNT_STATUS=#{accountStatus}
 | ||
|         </if>
 | ||
|         <if test="isRealName != null">
 | ||
|             and cm.IS_REAL_NAME=#{isRealName}
 | ||
|         </if>
 | ||
|         <if test="serviceAgreement != null">
 | ||
|             and cm.SERVICE_AGREEMENT=#{serviceAgreement}
 | ||
|         </if>
 | ||
|         <if test="isBusLicense != null">
 | ||
|             and cm.is_bus_license=#{isBusLicense}
 | ||
|         </if>
 | ||
|         <if test="orderSource != null">
 | ||
|             and cm.order_source=#{orderSource}
 | ||
|         </if>
 | ||
|         <if test="centerMemberCode != null and centerMemberCode != ''">
 | ||
|             and center.member_code like #{centerMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="centerMemberName != null and centerMemberName != ''">
 | ||
|             and center.member_name like #{centerMemberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="parMemberCode != null and parMemberCode != ''">
 | ||
|             and par.member_code like #{parMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="parMemberName != null and parMemberName != ''">
 | ||
|             and par.member_name like #{parMemberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="placeMemberCode != null and placeMemberCode != ''">
 | ||
|             and place.member_code like #{placeMemberCode}||'%'
 | ||
|         </if>
 | ||
|         <if test="placeMemberName != null and placeMemberName != ''">
 | ||
|             and place.member_name like #{placeMemberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and cm.member_name like #{memberName}||'%'
 | ||
|         </if>
 | ||
|         <if test="phone != null and phone != ''">
 | ||
|             and cm.phone=#{phone}
 | ||
|         </if>
 | ||
|         <if test="pkRegisterGrade != null ">
 | ||
|             and cm.pk_register_grade =#{pkRegisterGrade}
 | ||
|         </if>
 | ||
|         <if test="pkSettleGrade != null ">
 | ||
|             and cm.PK_SETTLE_GRADE =#{pkSettleGrade}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="pkAwards != null">
 | ||
|             and cm.pk_awards=#{pkAwards}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="directPushNumber != null">
 | ||
|             and cm.DIRECT_PUSH_NUMBER=#{directPushNumber}
 | ||
|         </if>
 | ||
|         <if test="placeDept != null ">
 | ||
|             and cm.place_dept=#{placeDept}
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="teamName != null and teamName !=''">
 | ||
|             and ct.team_name like #{teamName}||'%'
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startDate != null and  startDate !='' ">
 | ||
|             and cm.CREATION_TIME >= to_date(#{startDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDate != null and  endDate !='' ">
 | ||
|             and cm.CREATION_TIME <= to_date(#{endDate} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         <if test="startDatePay != null and startDatePay != ''">
 | ||
|             and cm.PAY_TIME >= to_date(#{startDatePay}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDatePay != null and endDatePay != ''">
 | ||
|             and cm.PAY_TIME <= to_date(#{endDatePay} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="startExpireDate != null and startExpireDate != ''">
 | ||
|             and cm.EXPIRE_DATE >= to_date(#{startExpireDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endExpireDate != null and endExpireDate != ''">
 | ||
|             and cm.EXPIRE_DATE <= to_date(#{endExpireDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
| 
 | ||
|         <if test="isTransfer != null ">
 | ||
|             and cma.IS_TRANSFER=#{isTransfer}
 | ||
|         </if>
 | ||
|         <if test="isWithdraw != null ">
 | ||
|             and cma.IS_WITHDRAW=#{isWithdraw}
 | ||
|         </if>
 | ||
|         <if test="isConsume != null ">
 | ||
|             and cma.IS_CONSUME=#{isConsume}
 | ||
|         </if>
 | ||
|         <if test="systemType != null ">
 | ||
|             and cm.SYSTEM_TYPE=#{systemType}
 | ||
|         </if>
 | ||
| 
 | ||
|         <!-- 体系权限处理 -->
 | ||
|         <if test="vertexList != null and vertexList.size > 0">
 | ||
|             and ver.pk_member in
 | ||
|             <foreach collection="vertexList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <!--团队权限 -->
 | ||
|         <if test="teamList != null and teamList.size > 0">
 | ||
|             and ct.pk_member in
 | ||
|             <foreach collection="teamList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         )
 | ||
|         order by cm.CREATION_TIME desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="findAll" resultMap="MemberResultMap">
 | ||
|         select *
 | ||
|         from cu_member
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectByDeptNumberCount" resultType="long">
 | ||
| 
 | ||
|         select count(t.pk_id)
 | ||
|         from CU_MEMBER t
 | ||
|         where t.CATEGORY = 0
 | ||
|           and t.del_flag = 0
 | ||
|             start
 | ||
|         with t.PK_PLACE_PARENT = #{pkMember} and t.PLACE_DEPT = #{placeDept}
 | ||
|         connect by t.PK_PLACE_PARENT = prior t.PK_ID
 | ||
|     </select>
 | ||
|     <select id="selectPlaceSponsorUnderUmbrellaByCode" resultMap="MemberResultMap">
 | ||
|         select *
 | ||
|         from (select t.pk_id,
 | ||
|                      t.member_code,
 | ||
|                      t.member_name,
 | ||
|                      t.phone,
 | ||
|                      t.pk_place_parent,
 | ||
|                      t.pk_parent,
 | ||
|                      t.pk_center_code,
 | ||
|                      t.PLACE_DEPT,
 | ||
|                      t.service_code
 | ||
|               from cu_member t
 | ||
|               where t.del_flag = 0 start
 | ||
|               with t.pk_place_parent = #{memberId}
 | ||
|               connect by t.pk_place_parent = prior t.pk_id) a
 | ||
|         where (a.member_code = #{placeParentCode} or a.service_code = #{placeParentCode})
 | ||
|     </select>
 | ||
| 
 | ||
|     <!--根据用户编号、用户用户名查询用户信息-->
 | ||
|     <select id="selectMemberByMemberCode" resultMap="MemberResultMap">
 | ||
|         select m.member_code, m.member_name
 | ||
|         from cu_member m
 | ||
|         where m.del_flag = 0
 | ||
|         and m.category = 0
 | ||
|         and m.pk_settle_country = #{pkCountry}
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and m.member_code=#{memberCode}
 | ||
|         </if>
 | ||
|         <if test="memberName != null and memberName != ''">
 | ||
|             and m.member_name=#{memberName}
 | ||
|         </if>
 | ||
|         ORDER BY m.CREATION_TIME DESC
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询最末安置人(根据会员编号) -->
 | ||
|     <select id="queryLastPlaceByMemberCode" resultMap="MemberResultMap">
 | ||
|         select *
 | ||
|         from (select level, cm.*
 | ||
|               from cu_member cm
 | ||
|               where cm.del_flag = 0
 | ||
|                 and cm.place_dept = 1
 | ||
|                   start
 | ||
|               with (cm.pk_place_parent =
 | ||
|                   (select pk_id
 | ||
|                   from cu_member
 | ||
|                   where member_code = #{memberCode}) and
 | ||
|                   cm.place_dept = #{placeDept})
 | ||
|               connect by cm.pk_place_parent = prior cm.pk_id
 | ||
|               order by level desc) tmp
 | ||
|         where rownum = 1
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询指定数量会员SEQ -->
 | ||
|     <select id="querySeqList" resultType="long">
 | ||
|         SELECT CU_MEMBER_SEQ.nextval
 | ||
|         FROM (select level from dual connect by #{param} >= level)
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 根据会员编号批量查询会员信息 -->
 | ||
|     <select id="queryMemberListByCode" resultType="com.hzs.common.domain.member.base.CuMember">
 | ||
|         select cm.*
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|         and (cm.member_code in (''
 | ||
|         <foreach collection="memberCodeList" item="item" close=")" index="index">
 | ||
|             <choose>
 | ||
|                 <when test="index % 500 == 0">) or cm.member_code in (#{item}</when>
 | ||
|                 <otherwise>, #{item}</otherwise>
 | ||
|             </choose>
 | ||
|         </foreach>
 | ||
|         )
 | ||
|         order by cm.pk_id
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="checkPlaceSponsorUnderUmbrella" resultType="long">
 | ||
|         select count(1)
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|           and t.member_code = #{memberCode} start
 | ||
|         with t.pk_place_parent = #{pkMember}
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
|         order by level
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 校验是否安置关系 -->
 | ||
|     <select id="checkPlaceParent" resultType="int">
 | ||
|         select count(1)
 | ||
|         from cu_member cm
 | ||
|         where cm.member_code = #{topCode} start
 | ||
|         with cm.pk_id = #{pkMember}
 | ||
|         connect by cm.pk_id = prior cm.pk_place_parent
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectBloodKinshipUnderUmbrellaByMemberIds" resultType="com.hzs.member.base.vo.MemberTeamInfoVo">
 | ||
|         <foreach collection="memberIds" item="memberId" separator="union">
 | ||
|             select count(t.pk_id) numberCount, sum(t.CONSUME_ACHIEVE) numberAchieve,#{memberId} pkMember
 | ||
|             from cu_member t
 | ||
|             where t.del_flag = 0 start
 | ||
|             with t.pk_id = #{memberId}
 | ||
|             connect by t.pk_parent = prior t.pk_id
 | ||
|         </foreach>
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryMemberLeftRightCount" resultType="com.hzs.common.domain.member.base.CuMember">
 | ||
|         select 1 placeDept, count(t.pk_id) pkId
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_place_parent = #{pkMember} and place_dept=1
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
|         union
 | ||
|         select 2 placeDept, count(t.pk_id) pkId
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0 start
 | ||
|         with t.pk_place_parent = #{pkMember} and place_dept=2
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
|         order by placeDept
 | ||
|     </select>
 | ||
| 
 | ||
|     <update id="updateParentById">
 | ||
|         update CU_MEMBER
 | ||
|         set PK_PARENT          = #{pkParent},
 | ||
|             DIRECT_PUSH_NUMBER = #{directPushNumber}
 | ||
|         where PK_ID = #{pkMember}
 | ||
|     </update>
 | ||
| 
 | ||
|     <update id="updatePlaceParentAndPlaceDeptById">
 | ||
|         update CU_MEMBER
 | ||
|         set PK_PLACE_PARENT = #{pkPlaceParent},
 | ||
|             PLACE_DEPT      = #{placeDept}
 | ||
|         where PK_ID = #{pkMember}
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 校验会员编号是否存在 -->
 | ||
|     <select id="checkCodeExist" resultType="string">
 | ||
|         select member_code
 | ||
|         from cu_member cm
 | ||
|         where 1 = 1
 | ||
|         and (cm.member_code in ('0'
 | ||
|         <foreach collection="memberCodeList" item="item" close=")" index="index">
 | ||
|             <choose>
 | ||
|                 <when test="index % 500 == 0">) or cm.member_code in (#{item}</when>
 | ||
|                 <otherwise>, #{item}</otherwise>
 | ||
|             </choose>
 | ||
|         </foreach>
 | ||
|         )
 | ||
|         union
 | ||
|         select member_code
 | ||
|         from cu_member_empty_code cmec
 | ||
|         where cmec.del_flag = 0
 | ||
|         and (cmec.member_code in ('0'
 | ||
|         <foreach collection="memberCodeList" item="item" close=")" index="index">
 | ||
|             <choose>
 | ||
|                 <when test="index % 500 == 0">) or cmec.member_code in (#{item}</when>
 | ||
|                 <otherwise>, #{item}</otherwise>
 | ||
|             </choose>
 | ||
|         </foreach>
 | ||
|         )
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询海粉订单 -->
 | ||
|     <select id="queryFansOrder" resultMap="MemberResultMap">
 | ||
|         select cm.member_code,
 | ||
|                cm.member_name,
 | ||
|                cm.phone,
 | ||
|                cm.login_password,
 | ||
|                cm.pay_password
 | ||
|         from sa_order so
 | ||
|                  inner join cu_member cm
 | ||
|                             on cm.pk_id = so.pk_creator
 | ||
|         where so.del_flag = 0
 | ||
|           and so.order_type = 3
 | ||
|           and so.order_code = #{orderCode}
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询注册订单信息 -->
 | ||
|     <select id="queryRegisterOrder" resultMap="MemberResultMap">
 | ||
|         select cm.member_code,
 | ||
|                cm.member_name,
 | ||
|                cm.phone,
 | ||
|                cm.login_password,
 | ||
|                cm.pay_password
 | ||
|         from sa_order so
 | ||
|                  inner join cu_member cm
 | ||
|                             on cm.pk_id = so.pk_member
 | ||
|         where so.del_flag = 0
 | ||
|           and so.order_type in (1, 7, 24)
 | ||
|           and so.order_code = #{orderCode}
 | ||
|           and so.pk_creator = #{pkMember}
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryDateBySummary" resultType="com.hzs.member.base.vo.MemberMeritsSummaryVo">
 | ||
|         select sa.ORDER_TYPE orderType,
 | ||
|         sum(sa.order_amount-nvl(sa.CONSUME_AMOUNT,0)) amount,
 | ||
|         sum(sa.order_achieve) achieve
 | ||
|         from SA_ORDER sa
 | ||
|         inner join cu_member cm on sa.pk_member=cm.pk_id and cm.DEL_FLAG = 0 and cm.CATEGORY=0
 | ||
|         where sa.ORDER_STATUS = 1
 | ||
|         and sa.DEL_FLAG = 0
 | ||
|         and to_char(sa.pay_time, 'yyyy-mm-dd') = #{time}
 | ||
|         and sa.PK_COUNTRY = #{pkCountry}
 | ||
|         <if test="pkBdVertexStrList!=null and pkBdVertexStrList.size> 0 ">
 | ||
|             and cm.PK_VERTEX in
 | ||
|             <foreach collection="pkBdVertexStrList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         group by sa.ORDER_TYPE
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="selectPlaceErrorCode" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select m.pk_place_parent pkPlaceParent,
 | ||
|                m.place_dept      placeDept,
 | ||
|                count(1)          times
 | ||
|         from cu_member m
 | ||
|         where m.del_flag = 0
 | ||
|           and m.pay_status = 1
 | ||
|           and m.pk_place_parent is not null
 | ||
|           and m.pk_settle_country = 1
 | ||
|         group by m.pk_place_parent, m.place_dept
 | ||
|         having count(1) > 1
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryCuMemberUnderUmbrella" resultType="com.hzs.common.domain.member.base.CuMember">
 | ||
|         select *
 | ||
|         from (
 | ||
|                  select pk_id
 | ||
|                  from cu_member start with pk_id=83999
 | ||
|                  connect by pk_parent = prior pk_id)
 | ||
|         where pk_id = #{pkMember}
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="checkPlaceDeptAndMemberCode" resultType="java.lang.Long">
 | ||
|         select count(c.pk_id)
 | ||
|         from cu_member c
 | ||
|         where c.PLACE_DEPT = #{placeDept}
 | ||
|           and c.del_flag = 0
 | ||
|           and c.PK_PLACE_PARENT =
 | ||
|               (select cm.pk_id from cu_member cm where cm.MEMBER_CODE = #{placeDeptMemberCode} and cm.del_flag = 0)
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="checkMemberVertex" resultMap="MemberResultMap">
 | ||
|         select t.pk_id,
 | ||
|         t.member_code,
 | ||
|         t.member_name,
 | ||
|         t.phone,
 | ||
|         t.pk_place_parent,
 | ||
|         t.pk_parent,
 | ||
|         t.pk_center_code,
 | ||
|         t.PLACE_DEPT
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|         and t.MEMBER_CODE = #{memberCode}
 | ||
|         start
 | ||
|         with t.pk_place_parent in (select bv.PK_MEMBER
 | ||
|         from BD_VERTEX bv
 | ||
|         where bv.pk_id in
 | ||
| 
 | ||
|         <foreach collection="vertexIdList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|         )
 | ||
|         connect by t.pk_place_parent = prior t.pk_id
 | ||
| 
 | ||
|         union all
 | ||
| 
 | ||
|         select t.pk_id,
 | ||
|         t.member_code,
 | ||
|         t.member_name,
 | ||
|         t.phone,
 | ||
|         t.pk_place_parent,
 | ||
|         t.pk_parent,
 | ||
|         t.pk_center_code,
 | ||
|         t.PLACE_DEPT
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|         and t.MEMBER_CODE = #{memberCode}
 | ||
|         and t.pk_id in (select bv.PK_MEMBER
 | ||
|         from BD_VERTEX bv
 | ||
|         where bv.pk_id in
 | ||
|         <foreach collection="vertexIdList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|         )
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="checkMemberParent" resultType="long">
 | ||
|         select count(t.pk_id)
 | ||
|         from cu_member t
 | ||
|         where t.del_flag = 0
 | ||
|           and t.member_code = #{memberCode} start
 | ||
|         with t.pk_id = #{pkMember}
 | ||
|         connect by t.pk_parent = prior t.pk_id
 | ||
| 
 | ||
|     </select>
 | ||
| 
 | ||
|     <update id="updateMemberEditNumber">
 | ||
|         update cu_member m
 | ||
|         set m.change_number = nvl(m.change_number,0) + 1,
 | ||
|         m.modified_time = sysdate,
 | ||
|         m.pk_modified = #{updatePkMember}
 | ||
|         where m.pk_id in
 | ||
|         <foreach collection="pkMemberList" item="item" open="(" close=")" separator=",">
 | ||
|             #{item}
 | ||
|         </foreach>
 | ||
|     </update>
 | ||
| 
 | ||
|     <select id="checkMemberPlaceParent" resultMap="MemberResultMap">
 | ||
|         select t.PK_ID, t.MEMBER_NAME, t.MEMBER_CODE, t.PK_PLACE_PARENT, level
 | ||
|         from cu_member t
 | ||
|             start
 | ||
|         with t.PK_ID = #{pkMember}
 | ||
|         connect by t.PK_ID = prior t.PK_PLACE_PARENT
 | ||
|         order by level
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="checkPlaceMemberList" resultType="long">
 | ||
|         select count(t.PK_ID)
 | ||
|         from cu_member t
 | ||
|         where t.member_code = #{editNewPlaceMemberCode} start
 | ||
|         with t.PK_ID = #{pkMember}
 | ||
|         connect by t.PK_PLACE_PARENT = prior t.pk_id
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询安置会员列表 -->
 | ||
|     <select id="queryPlaceMemberList" resultMap="MemberResultMap">
 | ||
|         select cm.*
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and cm.pk_place_parent =
 | ||
|               (select cm.pk_id
 | ||
|                from cu_member cm
 | ||
|                where cm.member_code = #{memberCode})
 | ||
|         order by cm.pk_id
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询血缘上所属体系 -->
 | ||
|     <select id="queryParentVertex" resultMap="MemberResultMap">
 | ||
|         select *
 | ||
|         from (select cm.*
 | ||
|               from cu_member cm
 | ||
|               where cm.pk_vertex is not null
 | ||
|                 and cm.del_flag = 0
 | ||
|                   start
 | ||
|               with cm.pk_id = #{pkMember}
 | ||
|               connect by cm.pk_id = prior cm.pk_parent
 | ||
|               order by level)
 | ||
|         where rownum = 1
 | ||
|     </select>
 | ||
| 
 | ||
|     <update id="updateMemberExpireDate">
 | ||
|         UPDATE cu_member m
 | ||
|         SET m.modified_time = SYSDATE,
 | ||
|             m.pk_modified   = 100000000,
 | ||
|             m.expire_date   = add_months(m.expire_date, 12),
 | ||
|             m.stop_date     = add_months(m.stop_date, 12)
 | ||
|         WHERE m.expire_date <= add_months(trunc(SYSDATE), 4)
 | ||
|           AND m.pk_id IN (SELECT rw.pk_member
 | ||
|                           FROM bd_agreement_renewal_white rw
 | ||
|                           WHERE rw.del_flag = 0
 | ||
|                             AND rw.type = 1)
 | ||
|     </update>
 | ||
| 
 | ||
| 
 | ||
|     <select id="getMemberConsumptionStat" resultType="com.hzs.member.base.vo.MemberConsumptionStatVo">
 | ||
|         select
 | ||
|         cm.MEMBER_CODE memberCode,
 | ||
|         cm.MEMBER_NAME memberName,
 | ||
|         so.orderAmount orderAmount ,
 | ||
|         so.orderAchieve orderAchieve
 | ||
|         from cu_member cm
 | ||
|         left join (
 | ||
|         select so.PK_CREATOR,
 | ||
|         nvl(sum(oi.PRICE * oi.QUANTITY),0) orderAmount,
 | ||
|         nvl(sum(oi.ACHIEVEMENT * oi.QUANTITY),0) orderAchieve
 | ||
|         from SA_ORDER_ITEMS oi
 | ||
|         left join sa_order so on so.PK_ID = oi.PK_ORDER
 | ||
|         left join BD_WARES bw on bw.PK_ID = oi.PK_WARES
 | ||
| 
 | ||
|         where so.del_flag = 0
 | ||
|         and oi.del_flag = 0
 | ||
|         and so.ORDER_STATUS = 1
 | ||
|         <if test="specialArea != null">
 | ||
|             and bw.SPECIAL_AREA = #{specialArea}
 | ||
|         </if>
 | ||
|         <if test="pkProductList != null and pkProductList.size > 0">
 | ||
|             and oi.pk_wares in
 | ||
|             <foreach collection="pkProductList" item="item" open="(" close=")" separator=",">
 | ||
|                 #{item}
 | ||
|             </foreach>
 | ||
|         </if>
 | ||
|         <if test="startPayTime != null">
 | ||
|             and so.PAY_TIME >= #{startPayTime}
 | ||
|         </if>
 | ||
|         <if test="endPayTime != null">
 | ||
|             and so.PAY_TIME <= #{endPayTime}
 | ||
|         </if>
 | ||
|         group by so.PK_CREATOR
 | ||
|         )so on so.PK_CREATOR = cm.PK_ID
 | ||
|         where cm.DEL_FLAG = 0
 | ||
|         and cm.PAY_STATUS = 1
 | ||
|         and so.orderAmount > 0
 | ||
| 
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_SETTLE_COUNTRY = #{pkCountry}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.member_code=#{memberCode}
 | ||
|         </if>
 | ||
|         group by cm.MEMBER_CODE ,cm.MEMBER_NAME ,orderAmount ,orderAchieve
 | ||
|         order by orderAmount desc
 | ||
| 
 | ||
|     </select>
 | ||
|     <!--     查询表是否存在-->
 | ||
|     <select id="selectExistTable" resultType="Integer">
 | ||
|         select count(1)
 | ||
|         from user_tables t
 | ||
|         where t.table_name = upper('${achieveTable}')
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryBloodKinshipUnderUmbrella" resultType="long">
 | ||
|         <foreach collection="paramList" item="item" separator=" union ">
 | ||
|             <!--
 | ||
|             select ${item.pkMember}
 | ||
|             from cu_member t
 | ||
|             where t.del_flag = 0
 | ||
|             and t.pk_id = #{item.loginMember}
 | ||
|             start with t.pk_id = #{item.pkMember}
 | ||
|             connect by t.pk_parent = prior t.pk_id
 | ||
|                 -->
 | ||
|             select ${item.pkMember}
 | ||
|             from cu_member cm
 | ||
|             where cm.del_flag = 0
 | ||
|             and cm.pk_id = #{item.pkMember}
 | ||
|             start with cm.pk_id = #{item.loginMember}
 | ||
|             connect by cm.pk_id = prior cm.pk_parent
 | ||
|         </foreach>
 | ||
| 
 | ||
|         <!--        <foreach collection="waresAuthorityParentParamList" item="item" separator="union all">-->
 | ||
|         <!--            select t.PK_ID pkMember , count(t.PK_ID) memberCount-->
 | ||
|         <!--            from cu_member t-->
 | ||
|         <!--            where t.del_flag = 0-->
 | ||
|         <!--            and t.PK_ID = #{item.loginMember} start-->
 | ||
|         <!--            with t.pk_id = #{item.pkMember}-->
 | ||
|         <!--            connect by t.pk_parent = prior t.pk_id-->
 | ||
|         <!--            group by t.PK_ID-->
 | ||
|         <!--        </foreach>-->
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryPlaceSponsorUnderUmbrella" resultType="long">
 | ||
|         <foreach collection="paramList" item="item" separator=" union ">
 | ||
|             <!--
 | ||
|             select ${item.pkMember}
 | ||
|             from cu_member t
 | ||
|             where t.del_flag = 0
 | ||
|             and t.pk_id = #{item.loginMember}
 | ||
|             start with t.pk_id = #{item.pkMember}
 | ||
|             connect by t.pk_place_parent = prior t.pk_id
 | ||
|             -->
 | ||
|             select ${item.pkMember}
 | ||
|             from cu_member cm
 | ||
|             where cm.del_flag = 0
 | ||
|             and cm.pk_id = #{item.pkMember}
 | ||
|             start with cm.pk_id = #{item.loginMember}
 | ||
|             connect by cm.pk_id = prior cm.pk_place_parent
 | ||
|         </foreach>
 | ||
| 
 | ||
|         <!--        <foreach collection="waresAuthorityParentParamList" item="item" separator="union all">-->
 | ||
|         <!--            select *-->
 | ||
|         <!--            from (select t.pk_id,-->
 | ||
|         <!--            t.member_code,-->
 | ||
|         <!--            t.member_name,-->
 | ||
|         <!--            t.phone,-->
 | ||
|         <!--            t.pk_place_parent,-->
 | ||
|         <!--            t.pk_parent,-->
 | ||
|         <!--            t.pk_center_code,-->
 | ||
|         <!--            t.PLACE_DEPT-->
 | ||
|         <!--            from cu_member t-->
 | ||
|         <!--            where t.del_flag = 0 start-->
 | ||
|         <!--            with t.pk_place_parent = #{item.pkMember}-->
 | ||
|         <!--            connect by t.pk_place_parent = prior t.pk_id) a-->
 | ||
|         <!--            where a.member_code = #{item.loginMemberCode}-->
 | ||
|         <!--        </foreach>-->
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询同姓名、同手机号,奖衔最高的人 -->
 | ||
|     <select id="querySameMemberByAwards" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select cm.*
 | ||
|         from (select cm.*, ba.awards_value, rownum
 | ||
|               from cu_member cm
 | ||
|                        inner join bd_awards ba
 | ||
|                                   on ba.pk_id = cm.pk_max_awards
 | ||
|               where cm.del_flag = 0
 | ||
|                 and cm.category = 0
 | ||
|                 and cm.pk_settle_country = #{pkCountry}
 | ||
|                 and cm.member_name = #{memberName}
 | ||
|                 and cm.phone = #{phone}
 | ||
|               order by ba.awards_value desc) cm
 | ||
|         where rownum = 1
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 重置【有效期】【休止期】 -->
 | ||
|     <update id="resetExpireAndStopDate">
 | ||
|         update cu_member cm
 | ||
|         set cm.expire_date   = #{expireDate},
 | ||
|             cm.stop_date     = #{stopDate},
 | ||
|             cm.modified_time = sysdate
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and cm.member_name = #{memberName}
 | ||
|           and cm.phone = #{phone}
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 批量更新【有效期】【休止期】 -->
 | ||
|     <update id="updateExpireAndStopDate">
 | ||
|         update cu_member cm
 | ||
|         set (cm.expire_date, cm.stop_date) =
 | ||
|         (select cm.expire_date, add_months(cm.expire_date, ${stopMonth}) stop_date
 | ||
|         from cu_member cm
 | ||
|         where cm.pk_id = #{pkMember}),
 | ||
|         cm.pk_modified = #{pkMember},
 | ||
|         cm.modified_time = sysdate
 | ||
|         where cm.del_flag = 0
 | ||
|         and cm.category = 0
 | ||
|         and cm.pk_settle_country = #{pkCountry}
 | ||
|         and cm.member_name = #{memberName}
 | ||
|         and cm.phone = #{phone}
 | ||
|         <if test="expireDate != null">
 | ||
|             and #{expireDate} >= cm.expire_date
 | ||
|         </if>
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 批量更新【休止期】 -->
 | ||
|     <update id="updateStopDate">
 | ||
|         update cu_member cm
 | ||
|         set cm.stop_date     = add_months(cm.expire_date, ${stopMonth}),
 | ||
|             cm.modified_time = sysdate,
 | ||
|             cm.pk_modified   = #{pkMember}
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and cm.member_name = #{memberName}
 | ||
|           and cm.phone = #{phone}
 | ||
|           and cm.stop_date != add_months(cm.expire_date, ${stopMonth})
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 变更户籍更新【有效期】【休止期】 -->
 | ||
|     <update id="updateExpireAndStopDateByChange">
 | ||
|         update cu_member cm
 | ||
|         set (cm.expire_date, cm.stop_date) =
 | ||
|                 (select max(cm.expire_date)                           expire_date,
 | ||
|                         add_months(max(cm.expire_date), ${stopMonth}) stop_date
 | ||
|                  from cu_member cm
 | ||
|                  where cm.del_flag = 0
 | ||
|                    and cm.category = 0
 | ||
|                    and cm.pk_settle_country = #{pkCountry}
 | ||
|                    and cm.member_name = #{memberName}
 | ||
|                    and cm.phone = #{phone}),
 | ||
|             cm.pk_modified                 = #{pkMember},
 | ||
|             cm.modified_time               = sysdate
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and cm.member_name = #{memberName}
 | ||
|           and cm.phone = #{phone}
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 更新有效状态 -->
 | ||
|     <update id="updateExpireStatus">
 | ||
|         update cu_member cm
 | ||
|         set cm.expire_status = (case
 | ||
|         when cm.expire_date >= TRUNC(sysdate) then
 | ||
|         1
 | ||
|         when TRUNC(sysdate) > cm.expire_date and
 | ||
|         cm.stop_date >= TRUNC(sysdate) then
 | ||
|         2
 | ||
|         end)
 | ||
|         where cm.del_flag = 0
 | ||
|         and cm.category = 0
 | ||
|         and cm.pk_settle_country = #{pkCountry}
 | ||
|         and cm.member_name = #{memberName}
 | ||
|         and cm.phone = #{phone}
 | ||
|         <if test="pkMember != null">
 | ||
|             and cm.pk_id = #{pkMember}
 | ||
|         </if>
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 批量更新会员休止期时间 -->
 | ||
|     <update id="flushStopDateBatch">
 | ||
|         merge into cu_member cm
 | ||
|             using (select cm.member_name, cm.phone, max(cm.pk_max_awards)
 | ||
|                    from cu_member cm
 | ||
|                    where cm.del_flag = 0
 | ||
|                      and cm.pk_settle_country = #{pkCountry}
 | ||
|                      and cm.category = 0
 | ||
|                      and cm.pk_max_awards != 1
 | ||
|                    group by cm.member_name, cm.phone) tmp
 | ||
|             on (cm.member_name = tmp.member_name and cm.phone = tmp.phone and cm.del_flag = 0 and
 | ||
|                 cm.pk_settle_country = #{pkCountry} and cm.category = 0)
 | ||
|             WHEN MATCHED THEN
 | ||
|                 update set cm.stop_date = add_months(cm.expire_date, 12),
 | ||
|                     cm.modified_time = sysdate
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 批量刷新会员【休止期】状态 -->
 | ||
|     <update id="flushExpireStatusBatch">
 | ||
|         update cu_member cm
 | ||
|         set cm.expire_status = 2,
 | ||
|             cm.modified_time = sysdate
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and TRUNC(sysdate) > cm.expire_date
 | ||
|           and cm.stop_date >= TRUNC(sysdate)
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 批量刷新会员【已终止】状态 -->
 | ||
|     <update id="flushStopStatusBatch">
 | ||
|         update cu_member cm
 | ||
|         set cm.expire_status = 3,
 | ||
|             cm.category      = 2,
 | ||
|             cm.modified_time = sysdate
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_country = #{pkCountry}
 | ||
|           and TRUNC(sysdate) > cm.stop_date
 | ||
|     </update>
 | ||
| 
 | ||
|     <!-- 查询菜单用户 -->
 | ||
|     <select id="getMenuMember" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select cm.*,
 | ||
|                case
 | ||
|                    when tmp1.pk_member is null then
 | ||
|                        1
 | ||
|                    else
 | ||
|                        0
 | ||
|                    end experience_center_show,
 | ||
|                case
 | ||
|                    when tmp2.pk_member is null then
 | ||
|                        1
 | ||
|                    else
 | ||
|                        0
 | ||
|                    end special_registration,
 | ||
|                case
 | ||
|                    when tmp10.store_level = 2 then
 | ||
|                        0
 | ||
|                    else
 | ||
|                        1
 | ||
|                    end wholesale_show,
 | ||
|                case
 | ||
|                    when tmp10.store_level = 1 or tmp10.store_level = 0 then
 | ||
|                        0
 | ||
|                    else
 | ||
|                        1
 | ||
|                    end maker_space_show
 | ||
|         from cu_member cm
 | ||
|                  left join (select distinct cmsc.pk_member
 | ||
|                             from cu_authority_control cmsc
 | ||
|                             where cmsc.pk_member = #{pkMember}
 | ||
|                               and cmsc.control_type = 1
 | ||
|                               and cmsc.del_flag = 0) tmp1
 | ||
|                            on tmp1.pk_member = cm.pk_id
 | ||
|                  left join (select distinct cmsc.pk_member
 | ||
|                             from cu_authority_control cmsc
 | ||
|                             where cmsc.pk_member = #{pkMember}
 | ||
|                               and cmsc.control_type = 2
 | ||
|                               and cmsc.del_flag = 0) tmp2
 | ||
|                            on tmp2.pk_member = cm.pk_id
 | ||
|                  left join (select cms.pk_member, cms.store_level
 | ||
|                             from cu_maker_space cms
 | ||
|                             where cms.del_flag = 0
 | ||
|                               and cms.store_type = 1
 | ||
|                               and cms.pk_member = #{pkMember}
 | ||
|                               and cms.APPROVE_STATUS = 5
 | ||
|                               and cms.APPLY_STATUS = 5) tmp10
 | ||
|                            on tmp10.pk_member = cm.pk_id
 | ||
|         where cm.pk_id = #{pkMember}
 | ||
|           and cm.del_flag = 0
 | ||
|     </select>
 | ||
| 
 | ||
|     <select id="queryMemberServiceCodeList" resultType="com.hzs.member.base.vo.MemberServiceCodeVo">
 | ||
|         select cm.SERVICE_CODE serviceCode,cm.MEMBER_CODE memberCode,cm.MEMBER_NAME memberName,cm.NICK_NAME nickName,
 | ||
|         bg.GRADE_NAME gradeName ,ba.AWARDS_NAME awardsName,bv.VERTEX_NAME vertexName,cm.CREATION_TIME creationTime
 | ||
|         from CU_MEMBER cm
 | ||
|         left join bd_grade bg
 | ||
|         on bg.pk_id = cm.pk_settle_grade
 | ||
|         left join bd_awards ba on ba.pk_id = cm.PK_AWARDS
 | ||
|         left join bd_vertex bv
 | ||
|         on bv.pk_id = cm.PK_VERTEX
 | ||
|         where cm.del_flag = 0 and cm.SERVICE_CODE is not null
 | ||
|         <if test="pkCountry != null">
 | ||
|             and cm.PK_SETTLE_COUNTRY = #{pkCountry}
 | ||
|         </if>
 | ||
|         <if test="serviceCode != null and serviceCode != ''">
 | ||
|             and cm.SERVICE_CODE = #{serviceCode}
 | ||
|         </if>
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             and cm.MEMBER_CODE = #{memberCode}
 | ||
|         </if>
 | ||
|         <if test="startDate != null and  startDate !='' ">
 | ||
|             and cm.CREATION_TIME >= to_date(#{startDate}, 'yyyy-mm-dd')
 | ||
|         </if>
 | ||
|         <if test="endDate != null and  endDate !='' ">
 | ||
|             and cm.CREATION_TIME <= to_date(#{endDate} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
 | ||
|         </if>
 | ||
|         order by cm.SERVICE_CODE desc
 | ||
|     </select>
 | ||
| 
 | ||
|     <update id="updateMemberCodeByServiceCodeBlack">
 | ||
|         update CU_MEMBER
 | ||
|         set SERVICE_CODE = null
 | ||
|         where MEMBER_CODE = #{memberCode}
 | ||
|     </update>
 | ||
| 
 | ||
|     <select id="getMaxServiceCode" resultType="java.lang.String">
 | ||
|         select max(t.SERVICE_CODE)
 | ||
|         from CU_MEMBER t
 | ||
|         where t.PK_COUNTRY = #{pkCountry}
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 根据会员编号获取推荐人信息 -->
 | ||
|     <select id="getParentMember" resultType="com.hzs.common.domain.member.base.CuMember">
 | ||
|         select cmp.*
 | ||
|         from cu_member cm
 | ||
|                  left join cu_member cmp
 | ||
|                            on cmp.pk_id = cm.pk_parent
 | ||
|         where cm.member_code = #{memberCode}
 | ||
|     </select>
 | ||
| 
 | ||
|     <!-- 查询同姓名同手机号指定等级会员数量 -->
 | ||
|     <select id="countGradeMemberPoint" resultType="int">
 | ||
|         select count(1)
 | ||
|         from cu_member cm
 | ||
|         where cm.del_flag = 0
 | ||
|           and cm.pk_country = #{pkCountry}
 | ||
|           and cm.category = 0
 | ||
|           and cm.pk_settle_grade = #{pkGrade}
 | ||
|           and cm.member_name = #{memberName}
 | ||
|           and cm.phone = #{phone}
 | ||
|     </select>
 | ||
|     <select id="querySponsorOnUmbrella" resultType="com.hzs.common.domain.member.ext.CuMemberExt">
 | ||
|         select * from(
 | ||
|         <foreach collection="memberCodeList" item="item" index="index" separator="union">
 | ||
|             select t.pk_id, t.member_code, t.member_name, t.phone, t.pk_place_parent,level num
 | ||
|             from cu_member t
 | ||
|             where t.del_flag = 0 and member_code = #{item}
 | ||
|             start with t.pk_id = #{memberId}
 | ||
|             connect by t.pk_id = prior t.pk_place_parent
 | ||
|         </foreach>)
 | ||
|         order by num desc
 | ||
|     </select>
 | ||
|     <select id="getTableData" resultType="com.hzs.common.domain.member.ext.CuMemberSettleExt">
 | ||
|         select *
 | ||
|         from ${tableName}
 | ||
|         where pk_member = #{userId}
 | ||
|     </select>
 | ||
|     <select id="getSelectRegionDetail" resultType="com.hzs.member.base.vo.CheckRegionDetailVO">
 | ||
|         SELECT
 | ||
|         cmrr.PROVINCE provinceId,
 | ||
|         cmrr.CITY cityId,
 | ||
|         cmrr.COUNTY countyId,
 | ||
|         p.name provinceName,
 | ||
|         c.name cityName,
 | ||
|         pc.name countyName
 | ||
|         FROM
 | ||
|         CU_MEMBER_RETAIL_REGION cmrr
 | ||
|         INNER JOIN cu_member cm ON cmrr.pk_member = cm.pk_id
 | ||
|         LEFT JOIN BD_VERTEX bv ON cm.PK_VERTEX = bv.PK_ID
 | ||
|         LEFT JOIN BD_REGION_VERTEX brv ON bv.REGION_VERTEX_PK_ID = brv.PK_ID
 | ||
|         LEFT JOIN BD_AREA P ON P.PK_ID = cmrr.PROVINCE AND P.DEL_FLAG = 0
 | ||
|         LEFT JOIN BD_AREA C ON C.PK_ID = cmrr.CITY AND C.DEL_FLAG = 0
 | ||
|         LEFT JOIN BD_AREA PC ON PC.PK_ID = cmrr.COUNTY AND PC.DEL_FLAG = 0
 | ||
|         where cmrr.del_flag = 0
 | ||
|         AND cmrr.PK_MEMBER IN ( #{userId} )
 | ||
|         and cmrr.EFFECTIVE = 0
 | ||
|         <if test="type != null and type == 1">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY = 0
 | ||
|             and cmrr.COUNTY = 0
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 2">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY != 0
 | ||
|             and cmrr.COUNTY = 0
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 3">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY != 0
 | ||
|             and cmrr.COUNTY != 0
 | ||
|         </if>
 | ||
|     </select>
 | ||
|     <select id="getRegionList" resultType="com.hzs.common.domain.system.base.BdArea"
 | ||
|             parameterType="java.lang.Long">
 | ||
|         select ba.PK_ID, ba.PARENT, ba.NAME
 | ||
|         from bd_area ba
 | ||
|         where ba.del_flag = 0
 | ||
|         and ba.pk_country = 1
 | ||
|         and ba.ENABLE_STATE = 0
 | ||
|         and ba.pk_id not in (
 | ||
|         SELECT
 | ||
|         <if test="type != null and type == 1">
 | ||
|             PROVINCE
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 2">
 | ||
|             CITY
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 3">
 | ||
|             COUNTY
 | ||
|         </if>
 | ||
|         FROM
 | ||
|         CU_MEMBER_RETAIL_REGION cmrr
 | ||
|         INNER JOIN cu_member cm ON cmrr.pk_member = cm.pk_id
 | ||
|         LEFT JOIN BD_VERTEX bv ON cm.PK_VERTEX = bv.PK_ID
 | ||
|         LEFT JOIN BD_REGION_VERTEX brv ON bv.REGION_VERTEX_PK_ID = brv.PK_ID
 | ||
|         where 1=1
 | ||
|         AND cmrr.PK_MEMBER NOT IN (#{userId} )
 | ||
|         AND cmrr.EFFECTIVE = 0
 | ||
|         AND cmrr.DEL_FLAG = 0
 | ||
|         <if test="type != null and type == 1">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY = 0
 | ||
|             and cmrr.COUNTY = 0
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 2">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY != 0
 | ||
|             and cmrr.COUNTY = 0
 | ||
|         </if>
 | ||
|         <if test="type != null and type == 3">
 | ||
|             and cmrr.PROVINCE != 0
 | ||
|             and cmrr.CITY != 0
 | ||
|             and cmrr.COUNTY != 0
 | ||
|         </if>
 | ||
|         )
 | ||
|         order by ba.pk_id asc
 | ||
|     </select>
 | ||
|     <select id="queryDeleteDeadLockList" resultType="com.hzs.member.base.vo.DeleteDeadLockVO">
 | ||
|         SELECT
 | ||
|         cu.MEMBER_CODE,
 | ||
|         cu.MEMBER_NAME,bdg.GRADE_NAME as pkSettleGrade,
 | ||
|         cus.MEMBER_CODE AS parMemberCode,
 | ||
|         cuss.MEMBER_CODE AS placeMemberCode,cu.PLACE_DEPT,
 | ||
|         cu.CREATION_TIME
 | ||
|         FROM
 | ||
|         CU_MEMBER cu
 | ||
|         LEFT JOIN CU_MEMBER cus ON cu.PK_PARENT = cus.PK_ID
 | ||
|         LEFT JOIN CU_MEMBER cuss ON cu.PK_PLACE_PARENT = cuss.PK_ID
 | ||
|         LEFT JOIN BD_GRADE bdg ON cu.PK_SETTLE_GRADE = bdg.PK_ID
 | ||
|         WHERE
 | ||
|         cu.DEL_FLAG = 0
 | ||
|         AND cu.CATEGORY = 2
 | ||
|         <if test="memberCode != null and memberCode != ''">
 | ||
|             AND cu.MEMBER_CODE = #{memberCode}
 | ||
|         </if>
 | ||
|     </select>
 | ||
|     <select id="queryIsDeadMember" resultType="java.lang.Integer">
 | ||
|         SELECT
 | ||
|             COUNT(*)
 | ||
|         FROM
 | ||
|             (
 | ||
|                 SELECT
 | ||
|                     MEMBER_CODE
 | ||
|                 FROM
 | ||
|                     CU_MEMBER
 | ||
|                 WHERE
 | ||
|                     DEL_FLAG = 0 START WITH MEMBER_CODE = #{memberCode} CONNECT BY PRIOR PK_ID = PK_PARENT UNION ALL
 | ||
|                 SELECT
 | ||
|                     MEMBER_CODE
 | ||
|                 FROM
 | ||
|                     CU_MEMBER
 | ||
|                 WHERE
 | ||
|                     DEL_FLAG = 0 START WITH MEMBER_CODE = #{memberCode} CONNECT BY PRIOR PK_ID = PK_PLACE_PARENT
 | ||
|             ) t
 | ||
|         WHERE
 | ||
|             t.MEMBER_CODE != #{memberCode}
 | ||
|     </select>
 | ||
| 
 | ||
| 
 | ||
| </mapper>
 |