Mybatis批量添加:报错信息:ORA-00933: SQL 命令未正确结束

Mybatis里面:

  insert into USER_ROLE_AUT
    (RU_ID, RU_ROLE_ID, RU_AUT_ID, RU_TIME_INS, RU_USER_INS, RU_TIME_LST, RU_USER_LST, RU_STATUS) 
        select U.* from USER_ROLE_AUT
     ( <foreach collection="maps" item="item" index="index" separator="union all" >  
         select
                RU_ID_SEQ.Nextval,
                #{item.ruRoleId,jdbcType=DECIMAL}, 
                #{item.ruAutId,jdbcType=DECIMAL}, 
                #{item.ruTimeIns,jdbcType=TIMESTAMP}, 
                #{item.ruUserIns,jdbcType=VARCHAR}, 
                #{item.ruTimeLst,jdbcType=TIMESTAMP}, 
                 #{item.ruUserLst,jdbcType=VARCHAR},
                  #{item.ruStatus,jdbcType=CHAR}
        from USER_ROLE_AUT
    </foreach>
    )U

action里面:
@RequestMapping("roleAutSave")
@ResponseBody
public Map roleAutSave(HttpServletRequest request, HttpSession session)
        throws SystemException {
    Map<String, Object> rtnmap = null;
    Map<String, Object> map = new HashMap<String, Object>();
    try {
        String ruAutId = request.getParameter("ruAutId");// 获取到树形菜单选中的节点
        System.out.println(ruAutId);
        String[] adeArrs = ruAutId.split(",");
        System.out.println(adeArrs);
        String ruRoleId = request.getParameter("ruRoleId");// 获取选中的角色id
        String ruUserIns = request.getParameter("ruUserIns");// 获取登录的账号
        List<UserRoleAut> ls = new ArrayList<UserRoleAut>();
        UserRoleAut ur = null;
        for (String ade : adeArrs) {
            ur = new UserRoleAut();
            ur.setRuRoleId(new Long(ruRoleId));
            ur.setRuAutId(new Long(ade));
            ur.setRuUserIns(ruUserIns);
            ls.add(ur);
        }
        map.put("maps", ls);
        userRoleAutMapper.insert(map);// 保存
        userRoleAutMapper.deleteByPrimaryKey();
        rtnmap = okMap("roleAut");
    } catch (Exception e) {
        rtnmap = failMap("roleAut");
        e.printStackTrace();
    }
    return rtnmap;
}

1个回答

http://blog.csdn.net/strutce/article/details/47755845 from USER_ROLE_AUT 这个 表改成 dual这是oracle数据库默认的,建议吧序列查询提出来

qq_22948413
qq_22948413 谢谢了
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐