<?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.ym.mec.biz.dal.dao.SysEmailDao">
    <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.SysEmail">
        <id column="id_" jdbcType="INTEGER" property="id"/>
        <result column="host_name_" jdbcType="VARCHAR" property="hostName"/>
        <result column="smtp_port_" jdbcType="INTEGER" property="smtpPort"/>
        <result column="user_name_" jdbcType="VARCHAR" property="userName"/>
        <result column="password_" jdbcType="VARCHAR" property="password"/>
        <result column="from_" jdbcType="VARCHAR" property="from"/>
        <result column="from_name_" jdbcType="VARCHAR" property="fromName"/>
        <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
    </resultMap>

    <sql id="Base_Column_List">
        id_, host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_
    </sql>

    <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
            parameterType="com.ym.mec.biz.dal.entity.SysEmail">
        insert into sys_email(host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.hostName}, #{entity.smtpPort}, #{entity.userName}, #{entity.password}, #{entity.from},
            #{entity.fromName}, #{entity.tenantId})
        </foreach>
    </insert>
    <select id="query" resultType="com.ym.mec.biz.dal.entity.SysEmail">
        select * from sys_email where tenant_id_ = #{tenantId}
    </select>

</mapper>
