| | |
| | | FROM user_position |
| | | WHERE |
| | | user_id = #{uid} |
| | | <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> |
| | | UNION ALL |
| | | SELECT |
| | | p.id, |
| | |
| | | null agent_id, |
| | | s.stock_name, |
| | | s.stock_code, |
| | | s.stock_gid, |
| | | s.stock_type stock_gid, |
| | | s.stock_spell, |
| | | p.stock_ai_order_id buy_order_id, |
| | | p.creat_date buy_order_time, |
| | |
| | | </if> |
| | | ) a |
| | | WHERE a.position_type != 1 |
| | | <if test="state != null "> |
| | | <if test="state == 0"> |
| | | and a.sell_order_id is null |
| | | </if> |
| | | <if test="state == 1"> |
| | | and a.sell_order_id is not null |
| | | </if> |
| | | </if> |
| | | <if test="stockCode != null and stockCode != '' "> |
| | | and a.stock_code like CONCAT('%','${stockCode}','%') |
| | | </if> |
| | |
| | | <if test="positionType != null"> |
| | | and a.position_type = #{positionType} |
| | | </if> |
| | | <if test="stockType != null and stockType != '' "> |
| | | and a.stock_gid = #{stockType} |
| | | </if> |
| | | ORDER BY a.buy_order_time DESC |
| | | </select> |
| | | |