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

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成功

    评论

报告相同问题?