Administrator
Administrator
发布于 2022-06-17 / 186 阅读
0
0

Mybatis Mapper参数写法注意

mybatis Mapper的入参当有多个时,一定不要忘记显式声明参数名。比如:

public interface EntityMapper extends BaseMapper<Entity> {
	public List<Entity> getEntityByNameAndPhone(@Param("name") String name, @Param("phone") String phone); // 一定要把@Param加上,并且声明名字,否则sql中只能通过arg1,arg2这样去取
}

评论