controller
public void getData() {
try {
Object obj=userMapper.getInfo("tableName");
} catch (IOException e) {
e.printStackTrace();
}
}
mapper
Object getInfo(@Param("tableName")String tableName);
- 注解一定要加 @Param("tableName")
xml
<select id="getInfo" resultType="java.util.Map">
SELECT * FROM ${tableName};
</select>