标签:个人见解 mapper DynamicSQLMapper result Integer Mybatis new
@Test
public void testDeleteMoreByArray(){
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
DynamicSQLMapper mapper = sqlSession.getMapper(DynamicSQLMapper.class);
int result = mapper.deleteMoreByArray(new Integer[]{6,7,8});
System.out.println(result);
}
对于有人提出为什么会这样写new Integer[]{6,7,8},这里解释下,不对之处还请高人指出.我是只在Mybatis中有过这样的写法,这里的Integer[]数组是Mybatis要求的,因为使用的数据不止一个,所以用数组,{6,7,8}则是对*Mapper.xml中#{}占位符的填充,为什么用{}呢?因为有new关键字,大括号则为初始化该对象,用的也是Integer包装类.
标签:个人见解,
mapper,
DynamicSQLMapper,
result,
Integer,
Mybatis,
new
From: https://www.cnblogs.com/DuWenjie/p/16723543.html