时间:2021-07-01 10:21:17 帮助过:27人阅读
public interface UserMapper
{
@SelectProvider(type="UserSqlProvider.class" method="selectWithParam")
List<User> selectWithParam(Map<String,Object> param);
}
public classUserSqpProvider
{
public String selectWithParam(Map<String,Object> param)
{
return new SQL(){
{
SELECT("*")
FROM("User")
if(param.get("id") != null)
{
WHERE(" id=#{id}")
}
...
}.toString();
};
}
}
MyBatis动态SQL
标签:suse select tostring new ring ace method mybatis app