mybatis参数

xiaoxiao2021-02-28  6

对象参数

1. @Param(“object”)注解声明,在xml文件中不需要通过parameterType声明参数类型,调用通过object.attribute

java类中 public List<ResGoodsListAppVO> getGoodsByShop(@Param("reqGoodsShopListAppVO")ReqGoodsShopListAppVO reqGoodsShopListAppVO); xml文件中 <if test="reqGoodsKeyWordVO.sortField!=null and reqGoodsKeyWordVO.sortField!=''"> order by ${reqGoodsKeyWordVO.sortField} ${reqGoodsKeyWordVO.order} </if>

2. 直接对象参数格式,在xml中需要通过parameterType声明参数类型,调用时直接通过属性名称即可

java类中 public int insert_goods_save_draft(ReqInsertGoodsVO reqGoodsVO); xml文件中 <if test="is_top_grade_street != null" > #{is_top_grade_street,jdbcType=INTEGER}, </if>

3. 直接类型参数通过@Param声明

转载请注明原文地址: https://www.6miu.com/read-1650204.html

最新回复(0)