<?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.nq.dao.StockMarketsDayMapper" >
|
<resultMap id="BaseResultMap" type="com.nq.pojo.StockMarketsDay" >
|
<constructor >
|
<idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
|
<arg column="stock_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
|
<arg column="stock_name" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="stock_code" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="stock_gid" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="ymd" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="hms" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="now_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
|
<arg column="crease_rate" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
|
<arg column="open_px" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="close_px" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="business_balance" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="business_amount" jdbcType="VARCHAR" javaType="java.lang.String" />
|
<arg column="add_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
|
<arg column="add_time_str" jdbcType="VARCHAR" javaType="java.lang.String" />
|
</constructor>
|
</resultMap>
|
<sql id="Base_Column_List" >
|
id, stock_id, stock_name, stock_code, stock_gid, ymd, hms, now_price, crease_rate,
|
open_px, close_px, business_balance, business_amount, add_time, add_time_str
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
select
|
<include refid="Base_Column_List" />
|
from stock_markets_day
|
where id = #{id,jdbcType=INTEGER}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
delete from stock_markets_day
|
where id = #{id,jdbcType=INTEGER}
|
</delete>
|
<insert id="insert" parameterType="com.nq.pojo.StockMarketsDay" >
|
insert into stock_markets_day (id, stock_id, stock_name,
|
stock_code, stock_gid, ymd,
|
hms, now_price, crease_rate,
|
open_px, close_px, business_balance,
|
business_amount, add_time, add_time_str
|
)
|
values (#{id,jdbcType=INTEGER}, #{stockId,jdbcType=INTEGER}, #{stockName,jdbcType=VARCHAR},
|
#{stockCode,jdbcType=VARCHAR}, #{stockGid,jdbcType=VARCHAR}, #{ymd,jdbcType=VARCHAR},
|
#{hms,jdbcType=VARCHAR}, #{nowPrice,jdbcType=DECIMAL}, #{creaseRate,jdbcType=DECIMAL},
|
#{openPx,jdbcType=VARCHAR}, #{closePx,jdbcType=VARCHAR}, #{businessBalance,jdbcType=VARCHAR},
|
#{businessAmount,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{addTimeStr,jdbcType=VARCHAR}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="com.nq.pojo.StockMarketsDay" >
|
insert into stock_markets_day
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
id,
|
</if>
|
<if test="stockId != null" >
|
stock_id,
|
</if>
|
<if test="stockName != null" >
|
stock_name,
|
</if>
|
<if test="stockCode != null" >
|
stock_code,
|
</if>
|
<if test="stockGid != null" >
|
stock_gid,
|
</if>
|
<if test="ymd != null" >
|
ymd,
|
</if>
|
<if test="hms != null" >
|
hms,
|
</if>
|
<if test="nowPrice != null" >
|
now_price,
|
</if>
|
<if test="creaseRate != null" >
|
crease_rate,
|
</if>
|
<if test="openPx != null" >
|
open_px,
|
</if>
|
<if test="closePx != null" >
|
close_px,
|
</if>
|
<if test="businessBalance != null" >
|
business_balance,
|
</if>
|
<if test="businessAmount != null" >
|
business_amount,
|
</if>
|
<if test="addTime != null" >
|
add_time,
|
</if>
|
<if test="addTimeStr != null" >
|
add_time_str,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
#{id,jdbcType=INTEGER},
|
</if>
|
<if test="stockId != null" >
|
#{stockId,jdbcType=INTEGER},
|
</if>
|
<if test="stockName != null" >
|
#{stockName,jdbcType=VARCHAR},
|
</if>
|
<if test="stockCode != null" >
|
#{stockCode,jdbcType=VARCHAR},
|
</if>
|
<if test="stockGid != null" >
|
#{stockGid,jdbcType=VARCHAR},
|
</if>
|
<if test="ymd != null" >
|
#{ymd,jdbcType=VARCHAR},
|
</if>
|
<if test="hms != null" >
|
#{hms,jdbcType=VARCHAR},
|
</if>
|
<if test="nowPrice != null" >
|
#{nowPrice,jdbcType=DECIMAL},
|
</if>
|
<if test="creaseRate != null" >
|
#{creaseRate,jdbcType=DECIMAL},
|
</if>
|
<if test="openPx != null" >
|
#{openPx,jdbcType=VARCHAR},
|
</if>
|
<if test="closePx != null" >
|
#{closePx,jdbcType=VARCHAR},
|
</if>
|
<if test="businessBalance != null" >
|
#{businessBalance,jdbcType=VARCHAR},
|
</if>
|
<if test="businessAmount != null" >
|
#{businessAmount,jdbcType=VARCHAR},
|
</if>
|
<if test="addTime != null" >
|
#{addTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="addTimeStr != null" >
|
#{addTimeStr,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.nq.pojo.StockMarketsDay" >
|
update stock_markets_day
|
<set >
|
<if test="stockId != null" >
|
stock_id = #{stockId,jdbcType=INTEGER},
|
</if>
|
<if test="stockName != null" >
|
stock_name = #{stockName,jdbcType=VARCHAR},
|
</if>
|
<if test="stockCode != null" >
|
stock_code = #{stockCode,jdbcType=VARCHAR},
|
</if>
|
<if test="stockGid != null" >
|
stock_gid = #{stockGid,jdbcType=VARCHAR},
|
</if>
|
<if test="ymd != null" >
|
ymd = #{ymd,jdbcType=VARCHAR},
|
</if>
|
<if test="hms != null" >
|
hms = #{hms,jdbcType=VARCHAR},
|
</if>
|
<if test="nowPrice != null" >
|
now_price = #{nowPrice,jdbcType=DECIMAL},
|
</if>
|
<if test="creaseRate != null" >
|
crease_rate = #{creaseRate,jdbcType=DECIMAL},
|
</if>
|
<if test="openPx != null" >
|
open_px = #{openPx,jdbcType=VARCHAR},
|
</if>
|
<if test="closePx != null" >
|
close_px = #{closePx,jdbcType=VARCHAR},
|
</if>
|
<if test="businessBalance != null" >
|
business_balance = #{businessBalance,jdbcType=VARCHAR},
|
</if>
|
<if test="businessAmount != null" >
|
business_amount = #{businessAmount,jdbcType=VARCHAR},
|
</if>
|
<if test="addTime != null" >
|
add_time = #{addTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="addTimeStr != null" >
|
add_time_str = #{addTimeStr,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.nq.pojo.StockMarketsDay" >
|
update stock_markets_day
|
set stock_id = #{stockId,jdbcType=INTEGER},
|
stock_name = #{stockName,jdbcType=VARCHAR},
|
stock_code = #{stockCode,jdbcType=VARCHAR},
|
stock_gid = #{stockGid,jdbcType=VARCHAR},
|
ymd = #{ymd,jdbcType=VARCHAR},
|
hms = #{hms,jdbcType=VARCHAR},
|
now_price = #{nowPrice,jdbcType=DECIMAL},
|
crease_rate = #{creaseRate,jdbcType=DECIMAL},
|
open_px = #{openPx,jdbcType=VARCHAR},
|
close_px = #{closePx,jdbcType=VARCHAR},
|
business_balance = #{businessBalance,jdbcType=VARCHAR},
|
business_amount = #{businessAmount,jdbcType=VARCHAR},
|
add_time = #{addTime,jdbcType=TIMESTAMP},
|
add_time_str = #{addTimeStr,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
|
|
<select id="selectRateByDaysAndStockCode" parameterType="map" resultType="decimal">
|
select sum(a.crease_rate) FROM (
|
select crease_rate
|
FROM stock_markets_day
|
WHERE stock_id = #{stockId}
|
order by id DESC
|
limit 0,#{days}) as a
|
</select>
|
|
|
|
</mapper>
|