From 2bb6d396b9e9a8d58ba47504591b71e48d6d6bfb Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Mon, 19 Aug 2024 14:30:32 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapper/UserPositionMapper.xml |   55 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/src/main/resources/mapper/UserPositionMapper.xml b/src/main/resources/mapper/UserPositionMapper.xml
index f96e1da..297730d 100644
--- a/src/main/resources/mapper/UserPositionMapper.xml
+++ b/src/main/resources/mapper/UserPositionMapper.xml
@@ -454,9 +454,9 @@
       <if test="stockSpell != null and stockSpell != '' ">
         and stock_spell like CONCAT('%','${stockSpell}','%')
       </if>
-      <if test="stockType != null and stockType!= ''">
-        and stock_gid = #{stockType}
-      </if>
+<!--      <if test="stockType != null and stockType!= ''">-->
+<!--        and stock_gid = #{stockType}-->
+<!--      </if>-->
 
 
     </where>
@@ -485,31 +485,40 @@
     <include refid="Base_Column_List"/>
     FROM user_position
     <where>
-      <if test="searchId != null  ">
-        and agent_id = #{searchId}
+      1=1
+      <if test="ids != null and ids.size > 0">
+        AND agent_id IN
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+          #{id}
+        </foreach>
       </if>
-      <if test="state != null  ">
-        <if test="state == 0">
-          and sell_order_id is null
-        </if>
-        <if test="state == 1">
-          and sell_order_id is not null
-        </if>
+      <if test="state != null">
+        <choose>
+          <when test="state == 0">
+            AND sell_order_id IS NULL
+          </when>
+          <when test="state == 1">
+            AND sell_order_id IS NOT NULL
+          </when>
+        </choose>
       </if>
-      <if test="userId != null and userId != '' ">
-        and user_id = #{userId}
+      <if test="userId != null and userId != ''">
+        AND user_id = #{userId}
       </if>
-      <if test="positionSn != null and positionSn != '' ">
-        and position_sn like CONCAT('%','${positionSn}','%')
+      <if test="positionSn != null and positionSn != ''">
+        AND position_sn LIKE CONCAT('%', #{positionSn}, '%')
       </if>
-      <if test="positionType != null ">
-        and position_type = #{positionType}
+      <if test="positionType != null and positionType != ''">
+        AND position_type = #{positionType}
       </if>
-      <if test="beginTime != null ">
-        and sell_order_time <![CDATA[>=]]> #{beginTime}
+      <if test="beginTime != null and beginTime != ''">
+        AND sell_order_time <![CDATA[>=]]> #{beginTime}
       </if>
-      <if test="endTime != null ">
-        and sell_order_time <![CDATA[<=]]> #{endTime}
+      <if test="endTime != null and endTime != ''">
+        AND sell_order_time <![CDATA[<=]]> #{endTime}
+      </if>
+      <if test="phone != null and phone != ''">
+        AND user_id = (SELECT id FROM user WHERE phone = #{phone})
       </if>
     </where>
     ORDER BY id DESC
@@ -603,5 +612,7 @@
     limit 1
   </select>
 
+
+
 </mapper>
 

--
Gitblit v1.9.3