he2802 1 年之前
父節點
當前提交
535840181a
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

+ 10 - 10
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -736,7 +736,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="dangAnList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
-        SELECT u.* from `user` u where  1=1
+        SELECT DISTINCT u.* from `user` u
+        <if test="educationTypeId != null or businessId != null or majorId != null" >
+            LEFT JOIN `order` o ON o.user_id = u.user_id and o.`status` = 1
+            LEFT JOIN order_goods og ON o.order_sn = og.order_sn AND og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2
+            LEFT JOIN goods g ON og.goods_id = g.goods_id
+        </if>
+        where  1=1
         <if test="telphone != null and telphone != ''" >
             AND u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
         </if>
@@ -750,19 +756,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             AND u.company_name like concat('%', #{companyName}, '%')
         </if>
         <if test="majorId != null and majorId != ''" >
-            AND (SELECT count(*) FROM `order` o
-            LEFT JOIN order_goods og ON o.order_sn = og.order_sn
-            LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 )  AND og.refund_status != 2 AND g.major_id = #{majorId})>0
+            AND g.major_id = #{majorId}
         </if>
         <if test="educationTypeId != null and educationTypeId != ''" >
-            AND (SELECT count(*) FROM `order` o
-            LEFT JOIN order_goods og ON o.order_sn = og.order_sn
-            LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 )  AND og.refund_status != 2 AND g.education_type_id = #{educationTypeId})>0
+            AND g.education_type_id = #{educationTypeId}
         </if>
         <if test="businessId != null and businessId != ''" >
-            AND (SELECT count(*) FROM `order` o
-            LEFT JOIN order_goods og ON o.order_sn = og.order_sn
-            LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 )  AND og.refund_status != 2 AND g.business_id = #{businessId})>0
+            AND g.business_id = #{businessId}
         </if>
         <if test="promiseUploadSign != null and promiseUploadSign == 1" >
             AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1