<?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.InvestmentEntMapper">

    <!-- 插入投资企业信息 -->
    <insert id="insertInvestment" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.InvestmentEntModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TRInvestmentEntTemp(InvestmentID,EntID,EntityNo,InveName,InveRegistNo,InvestAmount,Department,isShow)
        values(
                  #{entity.investmentId},
                  #{entity.entId},
                  #{entity.entityNo},
                  #{entity.inveName},
                  #{entity.inveRegistNo},
                  #{entity.investAmount,jdbcType=NUMERIC},
                  #{entity.department,jdbcType=CHAR},
                  #{entity.isShow}
              )
        ]]>
    </insert>

    <insert id="insertInvestmentzs" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.InvestmentEntModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TRInvestmentEnt(InvestmentID,EntID,EntityNo,InveName,InveRegistNo,InvestAmount,Department,isShow)
        values(
                  #{entity.investmentId},
                  #{entity.entId},
                  #{entity.entityNo},
                  #{entity.inveName},
                  #{entity.inveRegistNo},
                  #{entity.investAmount,jdbcType=NUMERIC},
                  #{entity.department,jdbcType=CHAR},
                  #{entity.isShow}
              )
        ]]>
    </insert>

    <!-- 根据InvestmentID查询投资企业信息 -->
    <select id="selectByInvestmentId" resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.InvestmentEntModel">
        <![CDATA[
        select
            InvestmentID,EntID,EntityNo,InveName,InveRegistNo,InvestAmount,Department,isShow
        from TRInvestmentEnt
        where InvestmentID = #{investmentId}
        ]]>
    </select>

    <!-- 根据InvestmentID删除投资企业信息 -->
    <delete id="deleteByInvestmentId">
        <![CDATA[
        delete from TRInvestmentEntTemp
        where InvestmentID = #{investmentId}
        ]]>
    </delete>

    <delete id="deleteByInvestmentIdzs">
        <![CDATA[
        delete from TRInvestmentEnt
        where InvestmentID = #{investmentId}
        ]]>
    </delete>

    <!-- 根据EntID查询投资企业信息列表 -->
    <select id="selectListByEntId" resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.InvestmentEntModel">
        <![CDATA[
        select
            InvestmentID,EntID,EntityNo,InveName,InveRegistNo,InvestAmount,Department,isShow
        from TRInvestmentEnt
        where EntID = #{entId}
        ]]>
    </select>

</mapper>
