<?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.account.app.db.mapper.UserAccountRoleMapper">
    <insert id="save">
        insert into user_account_role
        (`user_id`,`name`)
        values
        (#{userId},#{name})
    </insert>
    <insert id="saveAll" useGeneratedKeys="true" keyProperty="id">
        insert into user_account_role
        (`user_id`,`name`)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.userId},#{item.name})
        </foreach>
    </insert>

    <select id="findByUserId" resultType="cn.reghao.tnb.account.app.model.po.UserAccountRole">
        select *
        from user_account_role
        where user_id=#{userId}
    </select>
</mapper>