张延森 2 年前
父节点
当前提交
3a6a3283a2

+ 2
- 5
src/main/java/com/yunzhi/marketing/broker/controller/BrokerController.java 查看文件

@@ -80,12 +80,9 @@ public class BrokerController extends BaseController {
80 80
     public ResponseBean getWxBrokerOfMine(HttpServletRequest request) throws Exception {
81 81
         String personId = getPersonId(request);
82 82
 
83
-        Integer customerNum = iTaPersonService.getCustNumOf(personId);
83
+        BrokerSummery brokerSummery = iTaPersonService.getBrokerSummeryBy(personId);
84 84
 
85
-        Map<String, Object> result = new HashMap<>();
86
-        result.put("customerNum", customerNum);
87
-
88
-        return ResponseBean.success(result);
85
+        return ResponseBean.success(brokerSummery);
89 86
     }
90 87
 
91 88
     @RequestMapping(value="/wx/bindBroker",method= RequestMethod.PUT)

+ 2
- 2
src/main/java/com/yunzhi/marketing/mapper/TaPersonMapper.java 查看文件

@@ -279,7 +279,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
279 279
                                          @Param("personType") String personType,
280 280
                                          @Param("recommendAgent") String recommendAgent);
281 281
 
282
-    IPage<BrokerSummery> getWxBrokerRankPage(IPage<BrokerSummery> page, @Param("personType") String personBroker, @Param("rankType") String rankType);
282
+    IPage<BrokerSummery> getWxBrokerRankPage(IPage<BrokerSummery> page, @Param("personType") String personType, @Param("rankType") String rankType);
283 283
 
284
-    Integer getCustNumOf(@Param("personId") String personId);
284
+    BrokerSummery getBrokerSummeryBy(@Param("personId") String personId, @Param("personType") String personType);
285 285
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/service/ITaPersonService.java 查看文件

@@ -139,5 +139,5 @@ public interface ITaPersonService extends IService<TaPerson> {
139 139
 
140 140
     IPage<BrokerSummery> getWxBrokerRankPage(IPage<BrokerSummery> page, String rankType);
141 141
 
142
-    Integer getCustNumOf(String personId);
142
+    BrokerSummery getBrokerSummeryBy(String personId);
143 143
 }

+ 2
- 2
src/main/java/com/yunzhi/marketing/service/impl/TaPersonServiceImpl.java 查看文件

@@ -1363,7 +1363,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
1363 1363
     }
1364 1364
 
1365 1365
     @Override
1366
-    public Integer getCustNumOf(String personId) {
1367
-        return baseMapper.getCustNumOf(personId);
1366
+    public BrokerSummery getBrokerSummeryBy(String personId) {
1367
+        return baseMapper.getBrokerSummeryBy(personId, CommConstant.PERSON_BROKER);
1368 1368
     }
1369 1369
 }

+ 29
- 5
src/main/resources/mapper/TaPersonMapper.xml 查看文件

@@ -772,14 +772,38 @@ FROM
772 772
             t.total_commission DESC
773 773
         </if>
774 774
     </select>
775
-    <select id="getCustNumOf" resultType="java.lang.Integer">
775
+    <select id="getBrokerSummeryBy" resultType="com.yunzhi.marketing.broker.vo.BrokerSummery">
776 776
         SELECT
777
-            count( 1 )
777
+            t.*,
778
+            s.customer_num,
779
+            m.broker_num
778 780
         FROM
779
-            xlk_channel_customer a
781
+            ta_person t
782
+                LEFT JOIN (
783
+                SELECT
784
+                    a.recommend_person,
785
+                    count( 1 ) AS customer_num
786
+                FROM
787
+                    xlk_channel_customer a
788
+                WHERE
789
+                    a.recommend_person_type = #{personType}
790
+                  AND a.`status` = 2
791
+                GROUP BY
792
+                    a.recommend_person
793
+            ) s ON s.recommend_person = t.person_id
794
+                LEFT JOIN (
795
+                SELECT
796
+                    a.recommend_agent,
797
+                    count( 1 ) AS broker_num
798
+                FROM
799
+                    ta_person a
800
+                WHERE
801
+                    a.person_type = #{personType}
802
+                  AND a.`status` > - 1
803
+            ) m ON m.recommend_agent = t.person_id
780 804
         WHERE
781
-            a.recommend_person = #{personId}
782
-          AND a.`status` = 2
805
+            t.person_id = #{personId}
806
+          AND t.`status` &gt; -1
783 807
     </select>
784 808
 
785 809
     <insert id="savePersonPosition" parameterType="com.yunzhi.marketing.entity.TaPersonPositon">