<?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.StockPreMapper">
|
|
<resultMap type="com.nq.pojo.StockPre" id="StockPreResult">
|
<result property="id" column="id" />
|
<result property="stockCode" column="stock_code" />
|
<result property="transactionBeginTime" column="transaction_begin_time" />
|
<result property="transactionEndTime" column="transaction_end_time" />
|
<result property="transactionPrice" column="transaction_price" />
|
</resultMap>
|
|
<sql id="selectStockPreVo">
|
select id, stock_code, transaction_begin_time, transaction_end_time, transaction_price from stock_pre
|
</sql>
|
|
<select id="selectStockPreList" parameterType="com.nq.pojo.StockPre" resultMap="StockPreResult">
|
<include refid="selectStockPreVo"/>
|
<where>
|
<if test="stockCode != null and stockCode != ''"> and stock_code = #{stockCode}</if>
|
<if test="transactionBeginTime != null "> and transaction_begin_time = #{transactionBeginTime}</if>
|
<if test="transactionEndTime != null "> and transaction_end_time = #{transactionEndTime}</if>
|
<if test="transactionPrice != null "> and transaction_price = #{transactionPrice}</if>
|
</where>
|
</select>
|
|
<select id="selectStockPreById" parameterType="Long" resultMap="StockPreResult">
|
<include refid="selectStockPreVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="selectStockPreByCode" parameterType="String" resultMap="StockPreResult">
|
<include refid="selectStockPreVo"/>
|
where stock_code = #{stockCode}
|
</select>
|
|
<insert id="insertStockPre" parameterType="com.nq.pojo.StockPre" useGeneratedKeys="true" keyProperty="id">
|
insert into stock_pre
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="stockCode != null">stock_code,</if>
|
<if test="transactionBeginTime != null">transaction_begin_time,</if>
|
<if test="transactionEndTime != null">transaction_end_time,</if>
|
<if test="transactionPrice != null">transaction_price,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="stockCode != null">#{stockCode},</if>
|
<if test="transactionBeginTime != null">#{transactionBeginTime},</if>
|
<if test="transactionEndTime != null">#{transactionEndTime},</if>
|
<if test="transactionPrice != null">#{transactionPrice},</if>
|
</trim>
|
</insert>
|
|
<update id="updateStockPre" parameterType="com.nq.pojo.StockPre">
|
update stock_pre
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="stockCode != null">stock_code = #{stockCode},</if>
|
<if test="transactionBeginTime != null">transaction_begin_time = #{transactionBeginTime},</if>
|
<if test="transactionEndTime != null">transaction_end_time = #{transactionEndTime},</if>
|
<if test="transactionPrice != null">transaction_price = #{transactionPrice},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteStockPreById" parameterType="Long">
|
delete from stock_pre where id = #{id}
|
</delete>
|
|
<delete id="deleteStockPreByIds" parameterType="String">
|
delete from stock_pre where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|