TBotKlineModelInfoMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.TBotKlineModelInfoMapper">
  6. <resultMap type="TBotKlineModelInfo" id="TBotKlineModelInfoResult">
  7. <result property="id" column="id"/>
  8. <result property="modelId" column="model_id"/>
  9. <result property="dateTime" column="date_time"/>
  10. <result property="open" column="open"/>
  11. <result property="close" column="close"/>
  12. <result property="high" column="high"/>
  13. <result property="low" column="low"/>
  14. <result property="x" column="x"/>
  15. <result property="y" column="y"/>
  16. </resultMap>
  17. <sql id="selectTBotKlineModelInfoVo">
  18. select id, model_id, date_time, open, close, high, low, x, y
  19. from t_bot_kline_model_info
  20. </sql>
  21. <select id="selectTBotKlineModelInfoList" parameterType="TBotKlineModelInfo" resultMap="TBotKlineModelInfoResult">
  22. <include refid="selectTBotKlineModelInfoVo"/>
  23. <where>
  24. <if test="modelId != null ">and model_id = #{modelId}</if>
  25. <if test="dateTime != null ">and date_time = #{dateTime}</if>
  26. <if test="open != null ">and open = #{open}</if>
  27. <if test="close != null ">and close = #{close}</if>
  28. <if test="high != null ">and high = #{high}</if>
  29. <if test="low != null ">and low = #{low}</if>
  30. </where>
  31. </select>
  32. <select id="selectTBotKlineModelInfoById" parameterType="Long" resultMap="TBotKlineModelInfoResult">
  33. <include refid="selectTBotKlineModelInfoVo"/>
  34. where id = #{id}
  35. </select>
  36. <insert id="insertModelInfo" parameterType="java.util.List">
  37. insert into t_bot_kline_model_info (model_id, date_time, open, close, high, low ,x,y) VALUES
  38. <foreach collection="list" item="item" separator=",">
  39. (#{item.modelId}, #{item.dateTime}, #{item.open}, #{item.close}, #{item.high}, #{item.low}, #{item.x},
  40. #{item.y} )
  41. </foreach>
  42. </insert>
  43. <insert id="insertTBotKlineModelInfo" parameterType="TBotKlineModelInfo" useGeneratedKeys="true" keyProperty="id">
  44. insert into t_bot_kline_model_info
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="modelId != null">model_id,</if>
  47. <if test="dateTime != null">date_time,</if>
  48. <if test="open != null">open,</if>
  49. <if test="close != null">close,</if>
  50. <if test="high != null">high,</if>
  51. <if test="low != null">low,</if>
  52. </trim>
  53. <trim prefix="values (" suffix=")" suffixOverrides=",">
  54. <if test="modelId != null">#{modelId},</if>
  55. <if test="dateTime != null">#{dateTime},</if>
  56. <if test="open != null">#{open},</if>
  57. <if test="close != null">#{close},</if>
  58. <if test="high != null">#{high},</if>
  59. <if test="low != null">#{low},</if>
  60. </trim>
  61. </insert>
  62. <update id="updateTBotKlineModelInfo" parameterType="TBotKlineModelInfo">
  63. update t_bot_kline_model_info
  64. <trim prefix="SET" suffixOverrides=",">
  65. <if test="modelId != null">model_id = #{modelId},</if>
  66. <if test="dateTime != null">date_time = #{dateTime},</if>
  67. <if test="open != null">open = #{open},</if>
  68. <if test="close != null">close = #{close},</if>
  69. <if test="high != null">high = #{high},</if>
  70. <if test="low != null">low = #{low},</if>
  71. </trim>
  72. where id = #{id}
  73. </update>
  74. <delete id="deleteTBotKlineModelInfoById" parameterType="Long">
  75. delete
  76. from t_bot_kline_model_info
  77. where id = #{id}
  78. </delete>
  79. <delete id="deleteTBotKlineModelInfoByIds" parameterType="String">
  80. delete from t_bot_kline_model_info where id in
  81. <foreach item="id" collection="array" open="(" separator="," close=")">
  82. #{id}
  83. </foreach>
  84. </delete>
  85. <select id="selectBotLineList" parameterType="java.util.HashMap" resultMap="TBotKlineModelInfoResult">
  86. SELECT t.date_time as date_time,
  87. t.`open` as open,
  88. t.`close` as close,
  89. t.high as high,
  90. t.low as low ,
  91. t.model_id as model_id
  92. FROM
  93. t_bot_kline_model_info t
  94. INNER JOIN
  95. t_bot_kline_model l
  96. ON t.model_id=l.id
  97. WHERE l.symbol=#{symbol}
  98. and t.date_time &lt;=#{nowTime}
  99. and t.y != 0
  100. order BY t.date_time ASC
  101. </select>
  102. </mapper>