Dao层
//设置单独传两个参
List<Main> selectDynamicMain(@Param("columns") String columns, @Param("tableName") String tableName);
Mapper层
<!-- 动态字段 sql进行查询-->
<select id="selectDynamicMain" parameterType="Entity.Main" resultMap="MainResultMap" statementType="STATEMENT">
select ${columns} from ${tableName}
</select>
Controller层
List<Main> mainData = service.selectDynamicMain(mainStr, main);