You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RuoYi-Vue/stock-system/src/main/resources/mapper/stocksystem/StockIndexMapper.xml

179 lines
10 KiB

<?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.ruoyi.stocksystem.mapper.StockIndexMapper">
<resultMap type="StockIndex" id="StockIndexResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="tradeDay" column="trade_day" />
<result property="open" column="open" />
<result property="close" column="close" />
<result property="high" column="high" />
<result property="low" column="low" />
<result property="differrange" column="differRange" />
<result property="volume" column="volume" />
<result property="amount" column="amount" />
<result property="limitupnum" column="limitupnum" />
<result property="limitdownnum" column="limitdownnum" />
<result property="suspendnum" column="suspendnum" />
<result property="risenum" column="risenum" />
<result property="fallnum" column="fallnum" />
<result property="flatnum" column="flatnum" />
<result property="componentnum" column="componentnum" />
<result property="mv" column="mv" />
<result property="pettm" column="pettm" />
<result property="pettmMid" column="pettm_mid" />
<result property="liqmv" column="liqmv" />
<result property="rcnthigh" column="rcnthigh" />
<result property="rcntlow" column="rcntlow" />
<result property="amountmv" column="amountmv" />
<result property="amountliqmv" column="amountliqmv" />
<result property="orderParam" column="orderParam" />
</resultMap>
<sql id="selectStockIndexVo">
select id, code, name, trade_day, open, close, high, low, differRange, volume, amount, limitupnum, limitdownnum, suspendnum, risenum, fallnum, flatnum, componentnum, mv, pettm, pettm_mid, liqmv, rcnthigh, rcntlow from stock_index
</sql>
<select id="selectStockIndexList" parameterType="StockIndex" resultMap="StockIndexResult">
<include refid="selectStockIndexVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="tradeDay != null "> and trade_day = #{tradeDay}</if>
<if test="open != null "> and open = #{open}</if>
<if test="close != null "> and close = #{close}</if>
<if test="high != null "> and high = #{high}</if>
<if test="low != null "> and low = #{low}</if>
<if test="differrange != null "> and differRange = #{differrange}</if>
<if test="volume != null "> and volume = #{volume}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="limitupnum != null "> and limitupnum = #{limitupnum}</if>
<if test="limitdownnum != null "> and limitdownnum = #{limitdownnum}</if>
<if test="suspendnum != null "> and suspendnum = #{suspendnum}</if>
<if test="risenum != null "> and risenum = #{risenum}</if>
<if test="fallnum != null "> and fallnum = #{fallnum}</if>
<if test="flatnum != null "> and flatnum = #{flatnum}</if>
<if test="componentnum != null "> and componentnum = #{componentnum}</if>
<if test="mv != null "> and mv = #{mv}</if>
<if test="pettm != null "> and pettm = #{pettm}</if>
<if test="pettmMid != null "> and pettm_mid = #{pettmMid}</if>
<if test="liqmv != null "> and liqmv = #{liqmv}</if>
<if test="rcnthigh != null "> and rcnthigh = #{rcnthigh}</if>
<if test="rcntlow != null "> and rcntlow = #{rcntlow}</if>
</where>
</select>
<select id="selectStockIndexById" parameterType="Long" resultMap="StockIndexResult">
<include refid="selectStockIndexVo"/>
where id = #{id}
</select>
<insert id="insertStockIndex" parameterType="StockIndex" useGeneratedKeys="true" keyProperty="id">
insert into stock_index
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null and name != ''">name,</if>
<if test="tradeDay != null">trade_day,</if>
<if test="open != null">open,</if>
<if test="close != null">close,</if>
<if test="high != null">high,</if>
<if test="low != null">low,</if>
<if test="differrange != null">differRange,</if>
<if test="volume != null">volume,</if>
<if test="amount != null">amount,</if>
<if test="limitupnum != null">limitupnum,</if>
<if test="limitdownnum != null">limitdownnum,</if>
<if test="suspendnum != null">suspendnum,</if>
<if test="risenum != null">risenum,</if>
<if test="fallnum != null">fallnum,</if>
<if test="flatnum != null">flatnum,</if>
<if test="componentnum != null">componentnum,</if>
<if test="mv != null">mv,</if>
<if test="pettm != null">pettm,</if>
<if test="pettmMid != null">pettm_mid,</if>
<if test="liqmv != null">liqmv,</if>
<if test="rcnthigh != null">rcnthigh,</if>
<if test="rcntlow != null">rcntlow,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="tradeDay != null">#{tradeDay},</if>
<if test="open != null">#{open},</if>
<if test="close != null">#{close},</if>
<if test="high != null">#{high},</if>
<if test="low != null">#{low},</if>
<if test="differrange != null">#{differrange},</if>
<if test="volume != null">#{volume},</if>
<if test="amount != null">#{amount},</if>
<if test="limitupnum != null">#{limitupnum},</if>
<if test="limitdownnum != null">#{limitdownnum},</if>
<if test="suspendnum != null">#{suspendnum},</if>
<if test="risenum != null">#{risenum},</if>
<if test="fallnum != null">#{fallnum},</if>
<if test="flatnum != null">#{flatnum},</if>
<if test="componentnum != null">#{componentnum},</if>
<if test="mv != null">#{mv},</if>
<if test="pettm != null">#{pettm},</if>
<if test="pettmMid != null">#{pettmMid},</if>
<if test="liqmv != null">#{liqmv},</if>
<if test="rcnthigh != null">#{rcnthigh},</if>
<if test="rcntlow != null">#{rcntlow},</if>
</trim>
</insert>
<update id="updateStockIndex" parameterType="StockIndex">
update stock_index
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="tradeDay != null">trade_day = #{tradeDay},</if>
<if test="open != null">open = #{open},</if>
<if test="close != null">close = #{close},</if>
<if test="high != null">high = #{high},</if>
<if test="low != null">low = #{low},</if>
<if test="differrange != null">differRange = #{differrange},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="limitupnum != null">limitupnum = #{limitupnum},</if>
<if test="limitdownnum != null">limitdownnum = #{limitdownnum},</if>
<if test="suspendnum != null">suspendnum = #{suspendnum},</if>
<if test="risenum != null">risenum = #{risenum},</if>
<if test="fallnum != null">fallnum = #{fallnum},</if>
<if test="flatnum != null">flatnum = #{flatnum},</if>
<if test="componentnum != null">componentnum = #{componentnum},</if>
<if test="mv != null">mv = #{mv},</if>
<if test="pettm != null">pettm = #{pettm},</if>
<if test="pettmMid != null">pettm_mid = #{pettmMid},</if>
<if test="liqmv != null">liqmv = #{liqmv},</if>
<if test="rcnthigh != null">rcnthigh = #{rcnthigh},</if>
<if test="rcntlow != null">rcntlow = #{rcntlow},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStockIndexById" parameterType="Long">
delete from stock_index where id = #{id}
</delete>
<delete id="deleteStockIndexByIds" parameterType="String">
delete from stock_index where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectStockIndexTradeVolumeList" parameterType="StockIndex" resultMap="StockIndexResult">
select code, name, trade_day,(amount/(select SUM(amount) as amounts from stock_index where trade_day = #{tradeDay}))/(liqmv/(select SUM(liqmv) as liqmv from stock_index where trade_day = #{tradeDay})) as amountliqmv,amount/mv as amountmv,amount,liqmv, mv,open, close, high, low, differRange, volume, limitupnum, limitdownnum, suspendnum, risenum, fallnum, flatnum, componentnum, pettm, pettm_mid, liqmv, rcnthigh, rcntlow
from stock_index where trade_day = #{tradeDay} and componentnum > 20 ORDER BY amountliqmv DESC
</select>
<select id="selectStockIndexRecordsList" parameterType="StockIndex" resultMap="StockIndexResult">
select code, name, trade_day, limitupnum, limitdownnum, suspendnum, risenum, fallnum, flatnum, componentnum, rcnthigh, rcntlow
from stock_index where trade_day = #{tradeDay} ORDER BY ${orderParam} DESC
</select>
</mapper>