当前位置:主页 > 软件编程 > JAVA代码 >

mybatisPlus实现倒序拼接字符串

时间:2022-07-29 09:24:33 | 栏目:JAVA代码 | 点击:

倒序拼接字符串

    @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>

您可能感兴趣的文章:

相关文章