feat: 智聪记账管理,期货同步功能修改。

This commit is contained in:
tianyongbao
2025-04-03 14:42:53 +08:00
parent fc55bbefbe
commit 6cb4672a39
13 changed files with 377 additions and 46 deletions

View File

@@ -28,17 +28,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="futureId" column="future_id" />
<result property="futureName" column="future_name" />
<result property="exchangeName" column="exchange_name" />
</resultMap>
<sql id="selectFuturesDailyHistoryVo">
select a.id, a.ts_code, a.trade_date, a.pre_close, a.pre_settle, a.open, a.high, a.low, a.close, a.settle, a.change1, a.vol, a.amount, a.change2, a.oi, a.oi_chg, a.delv_settle, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag from futures_daily_history a
select
a.id,
a.ts_code,
a.trade_date,
a.future_id,
a.pre_close,
a.pre_settle,
a.open,
a.high,
a.low,
a.close,
a.settle,
a.change1,
a.vol,
a.amount,
a.change2,
a.oi,
a.oi_chg,
a.delv_settle,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
ifbi.name as future_name,
ie.short_name as exchange_name
from
futures_daily_history a
left join invest_future_base_infor ifbi on
ifbi.id = a.future_id
left join invest_future_standard_infor ifsi on
ifsi.id = ifbi.standard_id
left join invest_exchange ie on
ie.id = ifsi.exchange_id
</sql>
<select id="selectFuturesDailyHistoryList" parameterType="FuturesDailyHistoryDto" resultMap="FuturesDailyHistoryResult">
<include refid="selectFuturesDailyHistoryVo"/>
<where>
a.del_flag='0'
<if test="tsCode != null and tsCode != ''"> and a.ts_code = #{tsCode}</if>
<if test="tsCode != null and tsCode != ''"> and (a.ts_code like '%'|| #{tsCode}||'%' or ifbi.name like '%'|| #{tsCode}||'%')</if>
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.trade_date, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.trade_date, 'yyyy-MM-dd')>=#{startTime}
</if>
<if test="tradeDate != null and tradeDate != ''"> and a.trade_date = #{tradeDate}</if>
<if test="preClose != null and preClose != ''"> and a.pre_close = #{preClose}</if>
<if test="preSettle != null and preSettle != ''"> and a.pre_settle = #{preSettle}</if>
@@ -55,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="oiChg != null and oiChg != ''"> and a.oi_chg = #{oiChg}</if>
<if test="delvSettle != null and delvSettle != ''"> and a.delv_settle = #{delvSettle}</if>
</where>
order by a.create_time desc
order by a.trade_date desc,a.ts_code
</select>
<select id="selectFuturesDailyHistoryById" parameterType="String" resultMap="FuturesDailyHistoryResult">
@@ -89,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
<if test="futureId != null">future_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@@ -114,6 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="futureId != null">#{futureId},</if>
</trim>
</insert>
@@ -142,6 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="futureId != null">future_id = #{futureId},</if>
</trim>
where id = #{id}
</update>
@@ -166,4 +213,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</update>
<insert id="batchInsertFuturesDailyHistory">
insert into futures_daily_history(id, future_id, ts_code, trade_date,pre_close,pre_settle, open, high, low, close, settle, change1, change2, vol, amount, oi, oi_chg, delv_settle, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.id},
#{item.futureId},
#{item.tsCode},
#{item.tradeDate},
#{item.preClose},
#{item.preSettle},
#{item.open},
#{item.high},
#{item.low},
#{item.close},
#{item.settle},
#{item.change1},
#{item.change2},
#{item.vol},
#{item.amount},
#{item.oi},
#{item.oiChg},
#{item.delvSettle},
#{item.remark},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime})
</foreach>
</insert>
</mapper>