<?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.chinaweal.aiccs.aicepsqy.mapper.datamove.StockTransferMapper">

    <!-- 插入股权转移信息 -->
    <insert id="addStockTransferInfo" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.StockTransferModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TRStockTransferTemp(StockId,EntID,EntityNo,Inv,AmPr,TransInv,transAmPr,transferDate,isShow)
        values
            (
                #{entity.stockId,jdbcType=VARCHAR},
                #{entity.entId,jdbcType=CHAR},
                #{entity.entityNo,jdbcType=CHAR},
                #{entity.inv,jdbcType=VARCHAR},
                #{entity.amPr,jdbcType=VARCHAR},
                #{entity.transInv,jdbcType=VARCHAR},
                #{entity.transAmPr,jdbcType=VARCHAR},
                #{entity.transferDate,jdbcType=DATE},
                #{entity.isShow}
            )
        ]]>
    </insert>

    <insert id="addStockTransferInfozs" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.StockTransferModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TRStockTransfer(StockId,EntID,EntityNo,Inv,AmPr,TransInv,transAmPr,transferDate,isShow)
        values
            (
                #{entity.stockId,jdbcType=VARCHAR},
                #{entity.entId,jdbcType=CHAR},
                #{entity.entityNo,jdbcType=CHAR},
                #{entity.inv,jdbcType=VARCHAR},
                #{entity.amPr,jdbcType=VARCHAR},
                #{entity.transInv,jdbcType=VARCHAR},
                #{entity.transAmPr,jdbcType=VARCHAR},
                #{entity.transferDate,jdbcType=DATE},
                #{entity.isShow}
            )
        ]]>
    </insert>

    <!-- 根据StockId查询股权转移信息 -->
    <select id="selectByStockId" resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.StockTransferModel">
        <![CDATA[
        select
            StockId,EntID,EntityNo,Inv,AmPr,TransInv,transAmPr,transferDate,isShow
        from TRStockTransfer
        where StockId = #{stockId,jdbcType=VARCHAR}
        ]]>
    </select>

    <!-- 根据StockId删除股权转移信息 -->
    <delete id="deleteByStockId">
        <![CDATA[
        delete from TRStockTransferTemp
        where StockId = #{stockId,jdbcType=VARCHAR}
        ]]>
    </delete>

    <delete id="deleteByStockIdzs">
        <![CDATA[
        delete from TRStockTransfer
        where StockId = #{stockId,jdbcType=VARCHAR}
        ]]>
    </delete>

    <!-- 根据EntID查询股权转移信息列表 -->
    <select id="selectListByEntId" resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.StockTransferModel">
        <![CDATA[
        select
            StockId,EntID,EntityNo,Inv,AmPr,TransInv,transAmPr,transferDate,isShow
        from TRStockTransfer
        where EntID = #{entId,jdbcType=CHAR}
        ]]>
    </select>

</mapper>
