public void assignResource(Long roleId, List<Long> resourceIds) {
Map<String,Object> map = new HashMap<String, Object>();
map.put("roleId", roleId);
map.put("resourceIds", resourceIds);
roleResourceDao.assignResource(map);
}
insert all
<foreach collection= "resourceIds" item= "item" index= "index" >
when ( not exists (select 1 from app_role_resource where
role_id=#{roleId,jdbcType=BIGINT} and resource_id=#{item,jdbcType=BIGINT})) then into
app_role_resource
(role_id,resource_id) values(#{roleId,jdbcType=BIGINT},#{item,jdbcType=BIGINT})
</foreach>
select * from dual <