揽峰moc 2015-08-27 12:49 采纳率: 50%
浏览 8812
已结题

Mybatis操作Oracle数据库:批量修改成功后返回的值是-1?

Mapper.xml


<update id="updateByMultiConditions" parameterType="java.util.List">   
    <foreach collection="list" item="item" index="index" open="begin" close="; end;" separator=";"> 
     update TB_DUTY 
     <set>
      <if test="item.morningPeopleIds != null and item.morningPeopleIds != '' " >
     MORNING_PEOPLE_IDS=#{item.morningPeopleIds,jdbcType=VARCHAR},
      </if>
      <if test="item.morningPeopleNames != null and item.morningPeopleNames != '' " >
     MORNING_PEOPLE_NAMES=#{item.morningPeopleNames,jdbcType=VARCHAR}, 
      </if> 
      <if test="item.afternoonPeopleIds != null and item.afternoonPeopleIds != '' " >
     AFTERNOON_PEOPLE_IDS=#{item.afternoonPeopleIds,jdbcType=VARCHAR},  
      </if>
      <if test="item.afternoonPeopleNames != null and item.afternoonPeopleNames != '' " >
     AFTERNOON_PEOPLE_NAMES=#{item.afternoonPeopleNames,jdbcType=VARCHAR}, 
      </if> 
      <if test="item.eveningPeopleIds != null and item.eveningPeopleIds != '' " >
     EVENING_PEOPLE_IDS=#{item.eveningPeopleIds,jdbcType=VARCHAR},  
      </if>
      <if test="item.eveningPeopleNames != null and item.eveningPeopleNames != '' " >
     EVENING_PEOPLE_NAMES=#{item.eveningPeopleNames,jdbcType=VARCHAR},
      </if>
      <if test="item.leaderIds != null and item.leaderIds != '' " >  
     LEADER_IDS=#{item.leaderIds,jdbcType=VARCHAR},  
      </if>
     <if test="item.leaderNames != null and item.leaderNames != '' " >
     LEADER_NAMES=#{item.leaderNames,jdbcType=VARCHAR},
     </if>
     </set> 
     where DUTY_ID=#{item.dutyId,jdbcType=INTEGER}
    </foreach>
</update>

Controller:

 int resultFlag=dutyService.updateByMultiConditions(dutyList2);

问题:

批量修改成功后返回的值是resultFlag=-1,作何解释?如何才能获得修改的行数?

  • 写回答

4条回答 默认 最新

  • -小龙人 全栈领域优质创作者 2021-02-26 14:16
    关注

    遇到了同样的问题,返回-1好像就代表执行SQL成功

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试