SpringMVC和Mybatis整合中出现“Available parameters are [arg1, arg0, param1, param2]”解决方案

原因:接口中传入了多个参数如:

接口:fusePlanCaseEntities=planInter.selectPlanCaseInfoByPlanId(planId,sSearch);//获取用例返回结果集

映射:@RequestParam(value="planId",required=false) int planId,HttpServletRequest request)

mybatis映射xml: <resultMap id="PlanCaseResultMap" type="**.FusePlanCaseEntity">
           <id column="id" property="id" jdbcType="INTEGER" />
           <result column="planId" property="planId" jdbcType="INTEGER"/>
           <result column="projectName" property="projectName" jdbcType="VARCHAR"/>
           <result column="planCaseDec" property="planCaseDec" jdbcType="VARCHAR"/>
           <result column="sfSendMail" property="sfSendMail" jdbcType="VARCHAR"/>
           <result column="creater" property="creater" jdbcType="VARCHAR"/>
           <result column="planCase" property="planCase" jdbcType="VARCHAR"/>
      </resultMap>
      <sql id="PlanCase_List">
           id,planId,projectName,planCaseDec,sfSendMail,creater,planCase
      </sql>
      <select id="selectPlanCaseInfoByPlanId" parameterType="java.lang.Integer" resultMap="PlanCaseResultMap">
           select <include refid="PlanCase_List"/>
           from tfci_fuseplan_case where planId= #{planId}
      </select>

解决方案:

方法一:使用#{arg0}和#{arg1}确认使用哪个参数的值

  <select id="selectPlanCaseInfoByPlanId" parameterType="java.lang.Integer" resultMap="PlanCaseResultMap">
           select <include refid="PlanCase_List"/>
           from tfci_fuseplan_case where planId= #{arg0}
      </select>

补充说明:接口存在多个参数,但是业务需求只需映射一个planId,这时只需要通过尝试使用#{arg0}、或者#{arg1}代替#{planId},最终成功获取期望值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值