zyy
2025-07-14 4b442bd9648115e6ef6fbe3fb8f6b7b1e6d30785
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nq.dao.StockAiOrderMapper" >
 
  <sql id="Base_Column_List" >
    id, user_id, stock_ai_id, buy_date, buy_amount, remain_amount, real_earning, status, audit_date
  </sql>
 
  <select id="getAdminStockAiOrderList" resultType="com.nq.vo.stock.ai.StockAiOrderVO">
    SELECT s.id, user_id, stock_ai_id, buy_date, buy_amount, remain_amount, real_earning, s.status, audit_date,
        phone, real_name, stock_name, success_rate, expected_earning, cycle, a.stock_type
    FROM stock_ai_order s
    LEFT JOIN user u ON u.id = s.user_id
    LEFT JOIN stock_ai a ON a.id = s.stock_ai_id
    <where>
      <if test="stockType != null and stockType != ''">
        and a.stock_type = #{stockType}
      </if>
      <if test="status != null and status != ''">
        and s.status = #{status}
      </if>
      <if test="userId != null">
        and u.id = #{userId}
      </if>
      <if test="phone != null and phone != ''">
        and u.phone like concat('%',#{phone},'%')
      </if>
    </where>
    ORDER BY buy_date DESC
  </select>
 
  <select id="getStockAiOrderList" resultType="com.nq.vo.stock.ai.StockAiOrderTypeVO">
    SELECT s.id, user_id, stock_ai_id, buy_date, buy_amount, remain_amount, real_earning, s.status, audit_date,
    a.stock_name, a.stock_type
    FROM stock_ai_order s
    LEFT JOIN stock_ai a ON a.id = s.stock_ai_id
    <where>
      <if test="status != null and status != ''">
        and s.status = #{status}
      </if>
      <if test="userId != null">
        and user_id = #{userId}
      </if>
    </where>
    ORDER BY buy_date DESC
  </select>
 
</mapper>