mybatisPlus实现倒序拼接字符串

倒序拼接字符串

    @ApiOperation("分页查询")
    @GetMapping(value = "/list")
    public ActionResult> list(@RequestParam Map params) {
        List list = Arrays.asList(new String[]{"create_time"});
        return new ActionResult(StatusCode.SUCCESS, iUmsMemberService.selectPage(new Query<>(params),
                new EntityWrapper().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);
 

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

你可能感兴趣的:(mybatisPlus实现倒序拼接字符串)