-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
Current SelectProvider support use paramObject as arg and return String as result.
String sql(paramObject)
I hope it can support :
[String|SqlNode] sql([paramObject, [mappedStatement]])
Basicly, I want to implement a "common crud" mapper. I hope i can dynamic build sql and control return type for the mapped statement.
The current @SelectProvider is useless to me, I didn't see any advantage to xml defined sql.
But if we can get mappedStatement in the sql build process, we can dynamic change the whole statement, like ReturnType.
Code I want to implement:
public interface CrudMapper<T> {
@SelectProvider(type=CrudMapperImpl.class, method="select")
List<T> select(T example);
}
public interface SomeMapper extends CrudMapper<Some> {
}
public interface Some2Mapper extends CrudMapper<Some2> {
}
public class CrudMapperImpl {
public SqlNode(Object param, MappedStatement ms) {
getEntityClass(ms);
ms.setReturnType(getEntityClass(ms));
BEGIN();
SELECT("xxxxx");
FROM(tableName);
//...............
//..........
}
}
Metadata
Metadata
Assignees
Labels
No labels