示例代码如下:
@Modifying
@Transactional
@Query("delete from GoodsBindConfigMapping gbc " +
"where gbc.goodsConfigUid = :#{#bean.goodsConfigUid} " +
"and gbc.tenementId = :#{#bean.tenementId} " +
"and gbc.goodConfigFlag = :#{#bean.goodConfigFlag} "+
"and gbc.goodTypeUid in (:#{#bean.goodsList})")
int deleteByConfigUidAndTypeUid(@Param("bean") BindConfigBean bean);
报错:
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'goodsConfigUid' cannot be found on null
解决方法:
是因为在使用@Query写语句的时候,没有使用@Param()标明参数实体