1
zj
2024-08-19 2bb6d396b9e9a8d58ba47504591b71e48d6d6bfb
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>
        <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}
        AND user_id = #{userId}
      </if>
      <if test="positionSn != null and positionSn != '' ">
        and position_sn like CONCAT('%','${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>