From e94e6721a4aeb8c21e97878239ec3429fc76d1ad Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 08 May 2023 14:23:45 +0800
Subject: [PATCH] 创建订单之前的判断修改

---
 src/main/resources/mapper/modules/MallMemberMapper.xml |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml
index 39b2a28..30011e0 100644
--- a/src/main/resources/mapper/modules/MallMemberMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -12,6 +12,8 @@
                IFNULL(c.commission,0) commission,
                IFNULL(c.star,0) star,
                IFNULL(c.total_score,0) totalScore,
+               IFNULL(c.voucher_cnt,0) voucherCnt,
+               IFNULL(c.voucher_amount,0) voucherAmount,
                d.description levelName
         FROM mall_member m
         left join mall_member a on m.referrer_id = a.invite_id
@@ -21,6 +23,9 @@
             <if test="record != null" >
                 <if test="record.name!=null and record.name!=''">
                     and m.name like concat('%',  #{record.name},'%')
+                </if>
+                <if test="record.accountLogin!=null and record.accountLogin!=''">
+                    and m.account_login like concat('%',  #{record.accountLogin},'%')
                 </if>
                 <if test="record.account!=null and record.account!=''">
                     and (
@@ -93,11 +98,11 @@
              from mall_order_info e
                       inner join mall_member b on e.member_id=b.ID
                       inner join mall_order_item c on e.id = c.order_id -- and c.is_normal=2
-             where e.status in (2, 3, 4) and e.order_type=1 and (b.invite_id=a.invite_id or find_in_set(a.invite_id, e.referrer_ids))) amount,
+             where e.status in (2, 3, 4) and e.order_type=1 and (b.invite_id=a.invite_id or find_in_set(a.invite_id, b.referrer_ids))) amount,
             (select count(1) from mall_member e
                       inner join mall_order_info b on e.id=b.member_id and b.status in (2, 3, 4)
-             where find_in_set(a.invite_id, e.referrer_ids)) orderCnt,
-            (select count(1) from mall_member x where find_in_set(a.invite_id, x.referrer_ids)) cnt
+             where e.invite_id=a.invite_id or find_in_set(a.invite_id, e.referrer_ids)) orderCnt,
+            (select count(1) from mall_member x where x.invite_id=a.invite_id or find_in_set(a.invite_id, x.referrer_ids)) cnt
         from mall_member a
         inner join mall_member_wallet p on a.id=p.member_id
         left join data_dictionary_custom u on a.level=u.code and u.type='AGENT_LEVEL'
@@ -161,6 +166,9 @@
         left join data_dictionary_custom a on a.code = m.level
         <where>
             <if test="record != null" >
+                <if test="record.accountLogin!=null and record.accountLogin!=''">
+                    and m.account_login like concat('%',  #{record.accountLogin},'%')
+                </if>
                 <if test="record.name!=null and record.name!=''">
                     and m.name like concat('%',  #{record.name},'%')
                 </if>
@@ -224,8 +232,7 @@
                 ifnull(sum(b.amount),0)
             FROM
                 mall_member e
-                    INNER JOIN mall_order_info b ON e.id = b.member_id
-                    AND b. STATUS = 4
+                    INNER JOIN mall_achieve_record b ON e.id = b.member_id
             WHERE
                 e.invite_id = #{inviteId}
                OR e.referrer_id = #{inviteId}
@@ -273,7 +280,7 @@
         SELECT a.id,d.code levelCode
         FROM mall_member a
                  LEFT JOIN data_dictionary_custom d on d.code = a.level
-        where a.id = #{id} and d.type = 'AGENT_LEVEL'
+        where a.id = #{id} and d.type = 'AGENT_LEVEL_REQUIRE'
         GROUP BY a.id
     </select>
 
@@ -432,4 +439,31 @@
         from mall_member
         where store_master = #{state}
     </select>
+
+    <select id="selectByRole" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        select * from mall_member
+        <where>
+            <if test="type == 3">
+                and creater = #{state}
+            </if>
+            <if test="type == 4">
+                and partner = #{state}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByLevel" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        select * from mall_member
+        where level = #{level}
+    </select>
+
+    <select id="selectByAccountLogin" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        select * from mall_member
+        where account_login = #{accountLogin}
+    </select>
+
+    <select id="selectInfoByAccountLoginAndPwd" resultType="cc.mrbird.febs.mall.entity.MallMember">
+        select * from mall_member
+        where account_login = #{accountLogin} and password = #{password}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1