写mybatis的时候,遇见了这么一种情况,不知道为什么
stockDao.reducestock(og);//这里是封装一个bean stockDao.reducestock(g.getGid(),g.getCount());//这里直接传俩参数
接口是这么写的
void reducestock(order_goods og); void reducestock(Integer gid,Integer count);
这里我没有用注解,用的是配置
<update id="reducestock" parameterType="com.Utils.order_goods"> UPDATE goods SET stock1 =stock1 - #{count} WHERE gid= #{oggid} </update> <update id="reducestock" parameterType="Integer"> UPDATE goods SET stock1 =stock1 - #{count} WHERE gid= #{oggid} </update>
结果是第一种情况可以,第二种就报错,说我count找不到。
我是初次接触ssm框架的,希望大佬能指点一下,之前就遇见过这种情况,不过写的是注解,也是直接传参不行,但是传bean就可以