baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.4k stars 4.31k forks source link

[Bug]: 遇到的问题 出现java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," "," at line 1, column 132. #6350

Closed H4CKE3 closed 3 months ago

H4CKE3 commented 3 months ago

确认

当前程序版本

3.5.7

问题描述

使用MybatisPlus分页查询,可以查到数据,返回也没问题,但是会报错日志,使用最新版的JsqP还是不生效,警告的SQL语句可以在Navicat运行,也能查到数据,把业务逻辑都删了,单写个demo 还是警告,详细如下

详细堆栈日志

涉及的版本:
        <lombok.version>1.18.34</lombok.version>
        <mysql.version>8.0.23</mysql.version>
        <mybatis.version>3.5.16</mybatis.version>
        <mybatis.spring.version>2.0.1</mybatis.spring.version>
        <mybatis-plus.version>3.5.7</mybatis-plus.version>

涉及的实体类:
public class Problem implements Serializable {
    private static final long serialVersionUID = -88402642067477203L;
    /**
     * 题目id
     */
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    /**
     * 创建者id,外键关联到user_info表的id
     */
    private Integer userId;
    /**
     * 题解id集合JSON字符串
     */
    private String articleIdList;
    /**
     * 难度,可以是数字范围,如1-10
     */
    private Integer hard;
    /**
     * 此题目可获得商城积分数
     */
    private Integer coin;
    /**
     * 是否可见,0表示不可见,1表示可见
     */
    private Integer status;
    /**
     * 来源,题目的出处或作者
     */
    private String source;
    /**
     * 通过数量
     */
    private Integer acceptCount;
    /**
     * 错误数量
     */
    private Integer wrongCount;
    /**
     * 时间限制,毫秒为单位
     */
    private Integer timeLimit;
    /**
     * 内存限制,Mb为单位
     */
    private Integer memoryLimit;
    /**
     * 标题
     */
    private String title;
    /**
     * 题目描述
     */
    private String description;
    /**
     * 输入描述JSON数组
     */
    private String input;
    /**
     * 输出描述JSON数组
     */
    private String output;
    /**
     * 题目提示
     */
    private String tips;
    /**
     * 允许语言JSON,指明允许使用的编程语言
     */
    private String lang;
    /**
     * 样例输入JSON
     */
    private String exampleInput;
    /**
     * 样例输出JSON
     */
    private String exampleOutput;
    /**
     * 测试点id
     */
    private String testcaseId;

}

涉及的mapper:

@Mapper
public interface ProblemMapper extends BaseMapper<Problem> {
    List<Integer> selectProblemIdsByTags(List<Integer> tags);

}

controller

@RestController
@AllArgsConstructor
@Tag(name = "01.问题相关")
public class ProblemController {
    private final ProblemService problemService;
    private final ProblemMapper problemMapper;
    @Operation(summary = "获取分页问题列表")
    @PostMapping("/getProblemList")
    public Result getProblemList(@RequestBody ProblemListDTO problemListDTO) {
        Page<Problem> pp = new Page<>(2,3);
        problemMapper.selectPage(pp,new QueryWrapper<>());
        //这是写的一个demo↑ 在这里 就已经报警告了
        Result res = problemService.getProblemList(problemListDTO);
        return res;
    }
}

警告如下

2024-07-22T14:32:20.962+08:00  INFO 5572 --- [nio-5502-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-07-22T14:32:20.963+08:00  INFO 5572 --- [nio-5502-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2024-07-22T14:32:20.964+08:00  INFO 5572 --- [nio-5502-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
2024-07-22T14:32:21.222+08:00  WARN 5572 --- [nio-5502-exec-1] c.b.m.e.p.i.PaginationInnerInterceptor   : optimize this sql to a count sql has exception, sql:"SELECT  id,user_id,article_id_list,hard,coin,status,source,accept_count,wrong_count,time_limit,memory_limit,title,description,input,output,tips,lang,example_input,example_output,testcase_id  FROM problem", exception:
java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
    at line 1, column 132.

Was expecting one of:

    "."
    "::"
    "["
    "^"
    <EOF>
    <ST_SEMICOLON>

这时候 前端已经可以拿到数据了

{
  "code": 200,
  "message": "请求成功",
  "data": {
    "records": [
      {
        "id": 1,
        "userId": 4,
        "articleIdList": "   ",
        "hard": 1,
        "coin": 23,
        "status": 1,
        "source": "xxx",
        "acceptCount": 32,
        "wrongCount": 56,
        "timeLimit": 1000,
        "memoryLimit": 256,
        "title": "题目标题---tkANttuJpJ111111111111111111111111111111111111111111111111111111111",
        "description": "题目详情描述---Y7yRE9gZCDo3obz1IM6VVSKqBeq5eVca98FDfD7kMvlNRsRb4nCPeVZ4icqHKEgEjARqzKlbEQ09o8Ni2rDSfrUEykurOVNu5DrB5eFhPOfRX44J8ZiS31kptJZZrQe4W3x8lH3Tc1jRvzRkI2GHtovNaaq7IirnFsTN3wvbYLMqSblVHGNqmqHOM8N3UEzywlrNnFJW3wQh89iQvbTvpStWICahFk25GB9XkrLFRqKRCdHzW2U7cU9PdMrthvrzRifI6krICkIPGUCQzeHsJ4xoJPGvIVNYYKSzBmQiJR251TA9xY2p6b",
        "input": "输入描述---VlCULovn2PlJ2kfuYCnRQdMpDiq5wr02MscW2y4NNQLLn8UQiAQohEDp4heHm0KdPNngZGKLgqc6DSMfngxJXFA9q1Q3gTakDp4K",
        "output": "输出描述---yeqvFk8ludmyYjCbIhYwv3H9SBAPqkKH8awgCH4TLytKgfG3nNJdkjAJkNGcZD3GjtSELIeRJjhNgQmyjKS0BoPlxhQAhkcLIVEg",
        "tips": "提示提示---bOLcfbyQMbxCCkGDZLMhvx6GStzr9vxQe23wioEPDVhw6erHarDbTO9X5Vgp9DM503D0XIEw1IqO8PJ0GM53KRH4krmc4hiDwbFz",
        "lang": "[\"C ( GCC 9.4 )\",\"Java ( OpenJDK 11 )\"]",
        "exampleInput": "[\"样例输入1---euTUVMaNkGYQNZbRJxFX\",\"DJBgwQqddQIrcKQEaYos\",\"样例输入2---INOzvDFRJLakSllogpehFhJtuMfUCk\"]",
        "exampleOutput": "[\"样例输出1---wCKYmkjCQtCBklbmhzlL\",\"JxrgvawcgtGgIAIdTbrj\",\"样例输出2---kGqphhQAZkMbQBpEOiDJtsTqygMODk\"}]",
        "testcaseId": "D4361bf6-62Ae-BdfE-7C0c-a5E51ba15efb",
        "tags": [
          {
            "id": 3,
            "color": null,
            "name": "深度优先搜索",
            "type": "problem_tag"
          }
        ]
      },

这个返回值是后面impl处理的 报警告日志 但是可以正常实现业务
miemieYaho commented 3 months ago

optimize this sql to a count sql has exception

H4CKE3 commented 3 months ago

optimize this sql to a count sql has exception

是的 已解决

wpfalive commented 2 months ago

请问有新版本发布吗