| | |
| | | <arg column="stock_plate" jdbcType="VARCHAR" javaType="java.lang.String" /> |
| | | <arg column="spread_rate_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" /> |
| | | <arg column="margin_add" jdbcType="DECIMAL" javaType="java.math.BigDecimal" /> |
| | | <arg column="status" jdbcType="INTEGER" javaType="java.lang.Integer" /> |
| | | <arg column="lock_days" jdbcType="INTEGER" javaType="java.lang.Integer" /> |
| | | |
| | | </constructor> |
| | | </resultMap> |
| | | <sql id="Base_Column_List" > |
| | |
| | | stock_gid, stock_spell, buy_order_id, buy_order_time, buy_order_price, sell_order_id, |
| | | sell_order_time, sell_order_price, profit_target_price, stop_target_price, order_direction, |
| | | order_num, order_lever, order_total_price, order_fee, order_spread, order_stay_fee, |
| | | order_stay_days, profit_and_lose, all_profit_and_lose,is_lock,lock_msg,stock_plate,spread_rate_price,margin_add,buy_order_id_index |
| | | order_stay_days, profit_and_lose, all_profit_and_lose,is_lock,lock_msg,stock_plate,spread_rate_price,margin_add,buy_order_id_index,status,lock_days |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
| | | select |
| | |
| | | order_direction, order_num, order_lever, |
| | | order_total_price, order_fee, order_spread, |
| | | order_stay_fee, order_stay_days, profit_and_lose, |
| | | all_profit_and_lose, is_lock, lock_msg,stock_plate,spread_rate_price) |
| | | all_profit_and_lose, is_lock, lock_msg,stock_plate,spread_rate_price,status,lock_days) |
| | | values (#{id,jdbcType=INTEGER}, #{positionType,jdbcType=INTEGER}, #{positionSn,jdbcType=VARCHAR}, |
| | | #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, #{agentId,jdbcType=INTEGER}, |
| | | #{stockName,jdbcType=VARCHAR}, #{stockCode,jdbcType=VARCHAR}, #{stockGid,jdbcType=VARCHAR}, |
| | |
| | | #{orderTotalPrice,jdbcType=DECIMAL}, #{orderFee,jdbcType=DECIMAL}, #{orderSpread,jdbcType=DECIMAL}, |
| | | #{orderStayFee,jdbcType=DECIMAL}, #{orderStayDays,jdbcType=INTEGER}, #{profitAndLose,jdbcType=DECIMAL}, |
| | | #{allProfitAndLose,jdbcType=DECIMAL}, #{isLock,jdbcType=INTEGER}, #{lockMsg,jdbcType=VARCHAR}, |
| | | #{stockPlate,jdbcType=VARCHAR},#{spreadRatePrice,jdbcType=DECIMAL} |
| | | #{stockPlate,jdbcType=VARCHAR},#{spreadRatePrice,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER},#{lockDays,jdbcType=INTEGER} |
| | | ) |
| | | </insert> |
| | | |
| | |
| | | <if test="spreadRatePrice != null" > |
| | | spread_rate_price, |
| | | </if> |
| | | <if test="status != null" > |
| | | status, |
| | | </if> |
| | | <if test="lockDays != null" > |
| | | lock_days, |
| | | </if> |
| | | |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | |
| | | </if> |
| | | <if test="spreadRatePrice != null" > |
| | | #{spreadRatePrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="status != null" > |
| | | #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="lockDays != null" > |
| | | #{lockDays,jdbcType=INTEGER}, |
| | | </if> |
| | | |
| | | </trim> |
| | |
| | | <if test="marginAdd != null" > |
| | | margin_add = #{marginAdd,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="status != null" > |
| | | status = #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="lockDays != null" > |
| | | lock_days = #{lockDays,jdbcType=INTEGER}, |
| | | </if> |
| | | |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | |
| | | lock_msg = #{lockMsg,jdbcType=VARCHAR}, |
| | | stock_plate = #{stockPlate,jdbcType=VARCHAR}, |
| | | buy_order_id_index = #{buyOrderIdIndex,jdbcType=DECIMAL}, |
| | | spread_rate_price = #{spreadRatePrice,jdbcType=DECIMAL} |
| | | spread_rate_price = #{spreadRatePrice,jdbcType=DECIMAL}, |
| | | status = #{status,jdbcType=INTEGER}, |
| | | lock_days = #{lockDays,jdbcType=INTEGER} |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | |
| | | 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 test="state != null"> |
| | | and status = #{state, jdbcType=INTEGER} |
| | | </if> |
| | | <if test="stockCode != null and stockCode != '' "> |
| | | and stock_code like CONCAT('%','${stockCode}','%') |
| | |
| | | <if test="searchId != null "> |
| | | and agent_id = #{searchId} |
| | | </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"> |
| | | and status = #{state, jdbcType=INTEGER} |
| | | </if> |
| | | <if test="userId != null and userId != '' "> |
| | | and user_id = #{userId} |
| | |
| | | ORDER BY id ASC |
| | | limit 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="getDailyProfitByMonth" parameterType="map" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(buy_order_time, '%Y-%m-%d') AS recordDate, |
| | | CAST( |
| | | SUM( |
| | | ( |
| | | COALESCE (sell_order_price, 0) - COALESCE (buy_order_price, 0) |
| | | ) * COALESCE (order_num, 1) - COALESCE (order_fee, 0) - COALESCE (order_spread, 0) |
| | | ) AS CHAR |
| | | ) AS profit |
| | | FROM |
| | | user_position |
| | | WHERE |
| | | DATE_FORMAT(buy_order_time, '%Y-%m') = #{yearMonth} |
| | | AND status = 2 |
| | | AND user_id = #{userId} |
| | | GROUP BY DATE_FORMAT(buy_order_time, '%Y-%m-%d') |
| | | </select> |
| | | |
| | | </mapper> |
| | | |