TContractLossMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.bussiness.mapper.TContractLossMapper">
  6. <resultMap type="TContractLoss" id="TContractLossResult">
  7. <result property="id" column="id" />
  8. <result property="delegateType" column="delegate_type" />
  9. <result property="status" column="status" />
  10. <result property="positionId" column="position_id" />
  11. <result property="userId" column="user_id" />
  12. <result property="earnPrice" column="earn_price" />
  13. <result property="losePrice" column="lose_price" />
  14. <result property="createTime" column="create_time" />
  15. <result property="earnDelegatePrice" column="earn_delegate_price" />
  16. <result property="loseDelegatePrice" column="lose_delegate_price" />
  17. <result property="earnNumber" column="earn_number" />
  18. <result property="loseNumber" column="lose_number" />
  19. <result property="lossType" column="loss_type" />
  20. <result property="updateTime" column="update_time" />
  21. <result property="type" column="type" />
  22. <result property="symbol" column="symbol" />
  23. <result property="leverage" column="leverage" />
  24. </resultMap>
  25. <sql id="selectTContractLossVo">
  26. select id, delegate_type, status, position_id, user_id, earn_price, lose_price, create_time, earn_delegate_price, lose_delegate_price, earn_number, lose_number, loss_type, update_time ,type,leverage, symbol from t_contract_loss
  27. </sql>
  28. <select id="selectTContractLossList" parameterType="TContractLoss" resultMap="TContractLossResult">
  29. <include refid="selectTContractLossVo"/>
  30. <where>
  31. <if test="delegateType != null "> and delegate_type = #{delegateType}</if>
  32. <if test="status != null "> and status = #{status}</if>
  33. <if test="positionId != null and positionId != ''"> and position_id = #{positionId}</if>
  34. <if test="userId != null "> and user_id = #{userId}</if>
  35. <if test="earnPrice != null "> and earn_price = #{earnPrice}</if>
  36. <if test="losePrice != null "> and lose_price = #{losePrice}</if>
  37. <if test="earnDelegatePrice != null "> and earn_delegate_price = #{earnDelegatePrice}</if>
  38. <if test="loseDelegatePrice != null "> and lose_delegate_price = #{loseDelegatePrice}</if>
  39. <if test="earnNumber != null "> and earn_number = #{earnNumber}</if>
  40. <if test="loseNumber != null "> and lose_number = #{loseNumber}</if>
  41. <if test="lossType != null "> and loss_type = #{lossType}</if>
  42. <if test="type != null "> and type = #{type}</if>
  43. <if test="symbol != null "> and symbol = #{symbol}</if>
  44. <if test="leverage != null "> and leverage = #{leverage}</if>
  45. </where>
  46. </select>
  47. <select id="selectTContractLossById" parameterType="Long" resultMap="TContractLossResult">
  48. <include refid="selectTContractLossVo"/>
  49. where id = #{id}
  50. </select>
  51. <insert id="insertTContractLoss" parameterType="TContractLoss" useGeneratedKeys="true" keyProperty="id">
  52. insert into t_contract_loss
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="delegateType != null">delegate_type,</if>
  55. <if test="status != null">status,</if>
  56. <if test="positionId != null">position_id,</if>
  57. <if test="userId != null">user_id,</if>
  58. <if test="earnPrice != null">earn_price,</if>
  59. <if test="losePrice != null">lose_price,</if>
  60. <if test="createTime != null">create_time,</if>
  61. <if test="earnDelegatePrice != null">earn_delegate_price,</if>
  62. <if test="loseDelegatePrice != null">lose_delegate_price,</if>
  63. <if test="earnNumber != null">earn_number,</if>
  64. <if test="loseNumber != null">lose_number,</if>
  65. <if test="lossType != null">loss_type,</if>
  66. <if test="updateTime != null">update_time,</if>
  67. <if test="symbol != null and symbol!='' "> symbol,</if>
  68. <if test="leverage != null ">leverage,</if>
  69. <if test="type != null "> type,</if>
  70. </trim>
  71. <trim prefix="values (" suffix=")" suffixOverrides=",">
  72. <if test="delegateType != null">#{delegateType},</if>
  73. <if test="status != null">#{status},</if>
  74. <if test="positionId != null">#{positionId},</if>
  75. <if test="userId != null">#{userId},</if>
  76. <if test="earnPrice != null">#{earnPrice},</if>
  77. <if test="losePrice != null">#{losePrice},</if>
  78. <if test="createTime != null">#{createTime},</if>
  79. <if test="earnDelegatePrice != null">#{earnDelegatePrice},</if>
  80. <if test="loseDelegatePrice != null">#{loseDelegatePrice},</if>
  81. <if test="earnNumber != null">#{earnNumber},</if>
  82. <if test="loseNumber != null">#{loseNumber},</if>
  83. <if test="lossType != null">#{lossType},</if>
  84. <if test="updateTime != null">#{updateTime},</if>
  85. <if test="symbol != null and symbol!='' ">#{symbol},</if>
  86. <if test="leverage != null ">#{leverage},</if>
  87. <if test="type != null ">#{type},</if>
  88. </trim>
  89. </insert>
  90. <update id="updateTContractLoss" parameterType="TContractLoss">
  91. update t_contract_loss
  92. <trim prefix="SET" suffixOverrides=",">
  93. <if test="delegateType != null">delegate_type = #{delegateType},</if>
  94. <if test="status != null">status = #{status},</if>
  95. <if test="positionId != null">position_id = #{positionId},</if>
  96. <if test="userId != null">user_id = #{userId},</if>
  97. <if test="earnPrice != null">earn_price = #{earnPrice},</if>
  98. <if test="losePrice != null">lose_price = #{losePrice},</if>
  99. <if test="createTime != null">create_time = #{createTime},</if>
  100. <if test="earnDelegatePrice != null">earn_delegate_price = #{earnDelegatePrice},</if>
  101. <if test="loseDelegatePrice != null">lose_delegate_price = #{loseDelegatePrice},</if>
  102. <if test="earnNumber != null">earn_number = #{earnNumber},</if>
  103. <if test="loseNumber != null">lose_number = #{loseNumber},</if>
  104. <if test="lossType != null">loss_type = #{lossType},</if>
  105. <if test="updateTime != null">update_time = #{updateTime},</if>
  106. <if test="symbol != null and symbol!='' ">symbol=#{symbol},</if>
  107. <if test="leverage != null ">leverage=#{leverage},</if>
  108. <if test="type != null ">type=#{type},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <delete id="deleteTContractLossById" parameterType="Long">
  113. delete from t_contract_loss where id = #{id}
  114. </delete>
  115. <delete id="deleteTContractLossByIds" parameterType="String">
  116. delete from t_contract_loss where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. <update id="updateContractLoss" parameterType="java.lang.Long">
  122. update t_contract_loss
  123. set status=1
  124. where position_id = #{positionId}
  125. </update>
  126. </mapper>