mybatisPlus实现倒序拼接字符串
程序员文章站
2022-06-10 12:14:28
目录倒序拼接字符串把sql用字符串拼接好后直接取出使用倒序拼接字符串 @apioperation("分页查询") @getmapping(value = "/list") publi...
倒序拼接字符串
@apioperation("分页查询") @getmapping(value = "/list") public actionresult<map<string, object>> list(@requestparam map<string, object> params) { list<string> list = arrays.aslist(new string[]{"create_time"}); return new actionresult(statuscode.success, iumsmemberservice.selectpage(new query<>(params), new entitywrapper<umsmember>().eq("deleted", 0).orderdesc(list))); }
等同于
select id as id,member_level_id as memberlevelid,username, from ums_member where (deleted = 0) order by create_time desc limit 0,5
把sql用字符串拼接好后直接取出使用
/** * 查询sql * @param sql * @return */ object aa(@param(value = "sql") string sql);
<select id="aa" resulttype="object"> ${sql} </select>
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。