<?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.TecentMeetingMapper">
    <insert id="batchInsertUsers" parameterType="list">
        INSERT INTO user_tencentmeeting (
        user_name,
        user_id,
        isrepeat_name
        ) VALUES
        <foreach collection="userList" item="user" separator=",">
            (
            #{user.userName},
            #{user.userId},
            #{user.isrepeatName}
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
        user_name = VALUES(user_name)
    </insert>

    <select id="getAlluser" resultType="com.cmeeting.pojo.TencentMeetingUser">
        SELECT * FROM user_tencentmeeting
    </select>

    <select id="getAlluser2" resultType="com.cmeeting.pojo.TencentMeetingUser">
        SELECT user_name as userName, tid as userId FROM userid
    </select>

    <select id="getUsernameByUserId" resultType="java.lang.String">
        SELECT user_name FROM user_tencentmeeting where user_id = #{userId} limit 1
    </select>
</mapper>