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

    <!-- 插入网站信息（固定表名TREntWebTemp，无需动态分表） -->
    <insert id="insertWeb" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.EntWebModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TREntWebTemp(WebID,EntID,EntityNo,WebType,WebName,WebUrl,WebIp,WebIcp,isShow)
        values
            (
                #{entity.webId},#{entity.entId}, #{entity.entityNo},#{entity.webType},
                #{entity.webName},#{entity.webUrl},#{entity.webIp,jdbcType=VARCHAR},
                #{entity.webIcp,jdbcType=VARCHAR},#{entity.isShow}
            )
        ]]>
    </insert>

    <insert id="insertWebzs" parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.EntWebModel" useGeneratedKeys="false">
        <![CDATA[
        insert into
            TREntWeb(WebID,EntID,EntityNo,WebType,WebName,WebUrl,WebIp,WebIcp,isShow)
        values
            (
                #{entity.webId},#{entity.entId}, #{entity.entityNo},#{entity.webType},
                #{entity.webName},#{entity.webUrl},#{entity.webIp,jdbcType=VARCHAR},
                #{entity.webIcp,jdbcType=VARCHAR},#{entity.isShow}
            )
        ]]>
    </insert>

    <!-- 查询：根据EntityNo和EntID（固定表名） -->
    <select id="selectWebByEntityNoAndEntId"
            resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.EntWebModel">
        <![CDATA[
        select
            WebID,EntID,EntityNo,WebType,WebName,WebUrl,WebIp,WebIcp,isShow
        from TREntWeb
        where EntityNo = #{entityNo}
          and EntID = #{entId} and Dstate !='2'
        ]]>
    </select>

    <!-- 更新：根据EntityNo和EntID（固定表名） -->
    <update id="updateWebByEntityNoAndEntId"
            parameterType="com.chinaweal.aiccs.aicepsqy.entity.datamove.EntWebModel">
        <![CDATA[
        update TREntWeb
        set
            WebID = #{entity.webId},
            WebType = #{entity.webType},
            WebName = #{entity.webName},
            WebUrl = #{entity.webUrl},
            WebIp = #{entity.webIp,jdbcType=VARCHAR},
            WebIcp = #{entity.webIcp,jdbcType=VARCHAR},
            isShow = #{entity.isShow}
        where
            EntityNo = #{entityNo}
          and EntID = #{entId}
        ]]>
    </update>

    <!-- 根据WebId查询网站信息 -->
    <select id="selectEntWebModelByWebId" resultType="com.chinaweal.aiccs.aicepsqy.entity.datamove.EntWebModel">
    <![CDATA[
        select
            WebID, EntID, EntityNo, WebType, WebName, WebUrl, WebIp, WebIcp, isShow
        from TREntWebTemp
        where WebID = #{webId}
        ]]>
    </select>

    <!-- 根据WebId删除网站信息 -->
    <delete id="deleteEntWebModelByWebId">
    <![CDATA[
        delete from TREntWebTemp
        where WebID = #{webId}
        ]]>
    </delete>

    <delete id="deleteEntWebModelByWebIdzs">
    <![CDATA[
        delete from TREntWeb
        where WebID = #{webId}
        ]]>
    </delete>

</mapper>
