<?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.cmeeting.mapper.primary.WeComUserMapper">
    <select id="selectById" resultType="com.cmeeting.pojo.WeComUser">
        SELECT id, user_name as userName, user_id as userId, isepeat_name as isRepeatNam
        FROM user_wecom
        WHERE id = #{id}
    </select>

    <insert id="batchInsert" parameterType="list">
        INSERT INTO user_wecom ( user_name, user_id, isrepeat_name,email)
        VALUES
        <foreach collection="list" item="user" separator=",">
            (
            #{user.userName},
            #{user.userId},
            #{user.isrepeatName},
            #{user.email}
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
        user_name = VALUES(user_name)
    </insert>

    <select id="getAlluser" resultType="com.cmeeting.pojo.WeComUser">
        SELECT * FROM user_wecom
    </select>
    <select id="noBindUsers" resultType="com.cmeeting.pojo.WeComUser">
        SELECT t1.*
        FROM user_wecom t1
        left join userid t2 on t1.user_id = t2.Wid
        WHERE t2.id is null
    </select>
</mapper>