<?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="cn.reghao.tnb.content.app.exam.db.mapper.ExamUserMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert ignore into exam_user
        (`user_id`,`role`)
        values
        (#{userId},#{role})
    </insert>
    <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
        insert ignore into exam_user
        (`user_id`,`role`)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.userId},#{item.role})
        </foreach>
    </insert>

    <select id="findByUserId" resultType="cn.reghao.tnb.content.app.exam.model.po.ExamUser">
        select *
        from exam_user
        where user_id=#{userId}
    </select>
</mapper>
