<?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.nantian.cloud.dbcapp.mapper.energyinfo.CompanyContacterMapper">
    <insert id="saveCompanyContacter">
        insert into ynenergy_info.company_contacter(id,enterpriseCode, contacterName, phone, dept, job, fax, email, remark, state, digest,address)
        <foreach collection="list" item="item" separator="union" open="(" close=")">
           select  #{item.id},#{item.enterpriseCode},#{item.contacterName},#{item.phone},#{item.dept},#{item.job},#{item.fax},#{item.email},#{item.remark},#{item.state},#{item.digest},#{item.address}
        </foreach>
    </insert>
    <update id="updateCompanyContacter">
        <foreach collection="list" item="data"  separator=";" >
            update  `ynenergy_info`.`company_contacter`
            set
            enterpriseCode =#{data.enterpriseCode} ,
            contacterName =#{data.contacterName} ,
            phone = #{data.phone},
            dept = #{data.dept},
            job = #{data.job} ,
            fax = #{data.fax} ,
            email = #{data.email} ,
            remark = #{data.remark} ,
            state = #{data.state} ,
            digest = #{data.digest} ,
            address = #{data.address}
            where id = #{data.id}
        </foreach>
    </update>

    <select id="getData" resultType="com.nantian.cloud.dbcapp.entity.CompanyContacter">
        SELECT id,enterpriseCode,contacterName,phone,dept,job,fax,email,remark,state,digest,address
        FROM `ynenergy_info`.`company_contacter` WHERE `enterpriseCode` = #{epc}
    </select>
</mapper>
