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 |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/src/main/resources/mapper/UserPositionMapper.xml b/src/main/resources/mapper/UserPositionMapper.xml
index 1edb775..297730d 100644
--- a/src/main/resources/mapper/UserPositionMapper.xml
+++ b/src/main/resources/mapper/UserPositionMapper.xml
@@ -485,36 +485,41 @@
     <include refid="Base_Column_List"/>
     FROM user_position
     <where>
-      <if test="searchId != null  and searchId != '' ">
-        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 positionType != ''">
-        and position_type = #{positionType}
+        AND position_type = #{positionType}
       </if>
       <if test="beginTime != null and beginTime != ''">
-        and sell_order_time <![CDATA[>=]]> #{beginTime}
+        AND sell_order_time <![CDATA[>=]]> #{beginTime}
       </if>
       <if test="endTime != null and endTime != ''">
-        and sell_order_time <![CDATA[<=]]> #{endTime}
+        AND sell_order_time <![CDATA[<=]]> #{endTime}
       </if>
       <if test="phone != null and phone != ''">
-        and user_id  = (select id from  user where phone =  #{phone})
+        AND user_id = (SELECT id FROM user WHERE phone = #{phone})
       </if>
-
     </where>
     ORDER BY id DESC
   </select>

--
Gitblit v1.9.3