<?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.ylx.massage.mapper.TAddressMapper">

    <resultMap type="com.ylx.massage.domain.TAddress" id="TAddressMap">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="openid" column="openid" jdbcType="VARCHAR"/>
        <result property="phone" column="phone" jdbcType="VARCHAR"/>
        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
        <result property="atlasAdd" column="atlas_add" jdbcType="VARCHAR"/>
        <result property="longitude" column="longitude" jdbcType="NUMERIC"/>
        <result property="latitude" column="latitude" jdbcType="NUMERIC"/>
        <result property="type" column="type" jdbcType="INTEGER"/>
        <result property="address" column="address" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
    </resultMap>

    <!-- 批量插入 -->
    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
        insert into ry-vue.t_address(openidphoneuser_nameaddlongitudelatitudetypeaddresscreate_timeupdate_timeis_delete)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.openid}#{entity.phone}#{entity.userName}#{entity.add}#{entity.longitude}#{entity.latitude}#{entity.type}#{entity.address}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
        </foreach>
    </insert>
    <!-- 批量插入或按主键更新 -->
    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
        insert into ry-vue.t_address(openidphoneuser_nameaddlongitudelatitudetypeaddresscreate_timeupdate_timeis_delete)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.openid}#{entity.phone}#{entity.userName}#{entity.add}#{entity.longitude}#{entity.latitude}#{entity.type}#{entity.address}#{entity.createTime}#{entity.updateTime}#{entity.isDelete})
        </foreach>
        on duplicate key update
        openid = values(openid) phone = values(phone) user_name = values(user_name) add = values(add) longitude =
        values(longitude) latitude = values(latitude) type = values(type) address = values(address) create_time =
        values(create_time) update_time = values(update_time) is_delete = values(is_delete)
    </insert>

</mapper>

