一、设置paramterType
1.类型为基本类型
a.代码示例
映射文件:
<select id="findShopCartInfoById" parameterType="int" resultType="ShopCart"> select* from shopcart where shopcartid = #{id} </select>
Mapper接口:
ShopCart findShopCartInfoById(int id);
测试代码:
ShopCartMapper scm = sqlSession.getMapper(ShopCartMapper.class); ShopCart shopCart = scm.findShopCartInfoById(14);
2.类型为对象类