场景:sql由模板配置动态传参进来,并且要支持动态标签的sql
/**
* 报表Mapper
*
* @author Yangqi.Pang
*/
public interface ReportMapper {
/**
* select
*
* @param sql sql
* @param fieldMap fieldMap
* @return List<JSONObject>
*/
@SelectProvider(type = SqlProvider.class, method = "buildSql")
List<JSONObject> query(@Param("sql") String sql, @Param("param") Map<String, Object> fieldMap);
class SqlProvider {
public String buildSql(Map<String, Object> map) {
return "<script>" + map.get("sql") + "</script>";
}
}
}