<?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.yami.trading.dao.future.FuturesOrderMapper">
|
|
<sql id="tFuturesOrderColumns">
|
a.uuid AS "uuid",
|
a.party_id AS "partyId",
|
a.symbol AS "symbol",
|
a.order_no AS "orderNo",
|
a.direction AS "direction",
|
a.timenum AS "timenum",
|
a.timeunit AS "timeunit",
|
a.unit_amount AS "unitAmount",
|
a.volume AS "volume",
|
a.fee AS "fee",
|
a.profit_ratio AS "profitRatio",
|
a.profit AS "profit",
|
a.trade_avg_price AS "tradeAvgPrice",
|
a.close_avg_price AS "closeAvgPrice",
|
a.state AS "state",
|
a.create_time AS "createTime",
|
a.close_time AS "closeTime",
|
a.settlement_time AS "settlementTime",
|
a.profit_loss AS "profitLoss",
|
a.create_by AS "createBy",
|
a.update_by AS "updateBy",
|
a.update_time AS "updateTime",
|
a.remarks AS "remarks",
|
a.del_flag AS "delFlag",
|
a.create_time_ts AS "createTimeTs",
|
a.update_time_ts AS "updateTimeTs"
|
|
</sql>
|
|
<sql id="tFuturesOrderJoins">
|
|
</sql>
|
|
|
<select id="findByHourAndSate" resultType="com.yami.trading.bean.future.domain.FuturesOrder">
|
select a.* from t_futures_order a left join tz_user b on a.PARTY_ID = b.user_id
|
<where>
|
<if test="state!=null and state!=''">
|
and a.state=#{state}
|
</if>
|
<if test="roleName!=null and roleName!=''">
|
and b.role_name=#{roleName}
|
</if>
|
and timestampdiff(minute, FROM_UNIXTIME(a.settlement_time), #{nowTime}) < 24*60
|
and del_flag = 0
|
</where>
|
</select>
|
|
|
|
|
<select id="findById" resultType="com.yami.trading.bean.future.dto.TFuturesOrderDTO">
|
SELECT
|
<include refid="tFuturesOrderColumns"/>
|
FROM t_futures_order a
|
<include refid="tFuturesOrderJoins"/>
|
WHERE a.uuid = #{id} and a.del_flag = 0
|
</select>
|
|
<select id="findList" resultType="com.yami.trading.bean.future.dto.TFuturesOrderDTO">
|
SELECT
|
<include refid="tFuturesOrderColumns"/>
|
FROM t_futures_order a
|
<include refid="tFuturesOrderJoins"/>
|
${ew.customSqlSegment}
|
</select>
|
|
|
<!--代理商逻辑 todo -->
|
<select id="listRecord" resultType="com.yami.trading.bean.future.dto.TFuturesOrderDTO" >
|
select * from t_futures_order a left join tz_user b on a.party_id = b.user_id
|
left join t_item item on a.symbol = item.symbol
|
<where>
|
<if test="query.type!=null and query.type!=''">
|
and item.type=#{query.type}
|
</if>
|
<if test="query.orderNo!=null and query.orderNo!=''">
|
and a.order_no=#{query.orderNo}
|
</if>
|
<if test="query.direction!=null and query.direction!=''">
|
and a.direction=#{query.direction}
|
</if>
|
<if test="query.tradeAvgPrice!=null and query.tradeAvgPrice!=''">
|
and a.trade_avg_price=#{query.tradeAvgPrice}
|
</if>
|
|
<if test="query.children != null and query.children.size() >0">
|
AND a.party_id in
|
<foreach collection="query.children" item="item" index="index" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
</if>
|
<if test="query.symbol!=null and query.symbol!=''">
|
and a.symbol=#{query.symbol}
|
</if>
|
|
<if test="query.volume!=null and query.volume!=''">
|
and a.volume=#{query.volume}
|
</if>
|
<if test="query.state!=null and query.state!=''">
|
and a.state=#{query.state}
|
</if>
|
<if test="query.userCode!=null and query.userCode!=''">
|
and b.user_code=#{query.userCode}
|
</if>
|
<if test="query.roleName!=null and query.roleName!=''">
|
and b.role_name=#{query.roleName}
|
</if>
|
<if test="query.userId!=null and query.userId!=''">
|
and b.user_id=#{query.userId}
|
</if>
|
<if test="query.roleName!=null and query.roleName!=''">
|
and b.role_name=#{query.roleName}
|
</if>
|
<if test="query.ip!=null and query.ip!=''">
|
and b.user_lastip like CONCAT('%', #{query.ip}, '%')
|
</if>
|
<if test="query.userName!=null and query.userName!=''">
|
AND (b.user_name like CONCAT('%', #{query.userName}, '%') or b.user_code like CONCAT('%', #{query.userName}, '%'))
|
</if>
|
</where>
|
order by a.create_time desc
|
</select>
|
|
</mapper>
|