Mybatis批量查询

[Mybatis]

1、批量查询

mapper接口

Long saveRoleOrgId(@Param("roleId") String roleId, @Param("orgIds") List<String> orgIds);

mapper.xml配置文件

<!--根据id列表批量查询职位-->
<select id="listRoleOrgs" resultType="java.lang.String" parameterType="java.util.Set">
    SELECT
      ORG_ID AS orgId
    FROM
      hy_role_org
    WHERE ROLE_ID in
    <foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
        #{roleId}
    </foreach>
</select>

猜你喜欢

转载自blog.csdn.net/han12398766/article/details/86633767