qq_43010024 2020-12-26 16:52 采纳率: 100%
浏览 646
已采纳

mybatis-plus sql报错 Navicat正常执行

救救孩子吧

报错具体如下

### Error querying database.  Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql : 
 SELECT COUNT(1) FROM ( SELECT twl.id,c.id as 'cid',c.mac_addr,c.`name`,c.remarks,twl.date,twl.state,twl.`port`
        FROM `t_log_wireless` twl
         WHERE  c.`name`=? 
        INNER JOIN `t_client` c ON twl.cid=c.id
        ORDER BY twl.id DESC,twl.date DESC ) TOTAL 

### The error may exist in file [E:\Workspace\IdeaProjects\wrdm\target\classes\mapper\LogWirelessDao.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql : 
 SELECT COUNT(1) FROM ( SELECT twl.id,c.id as 'cid',c.mac_addr,c.`name`,c.remarks,twl.date,twl.state,twl.`port`
        FROM `t_log_wireless` twl
         WHERE  c.`name`=? 
        INNER JOIN `t_client` c ON twl.cid=c.id
        ORDER BY twl.id DESC,twl.date DESC ) TOTAL 
] with root cause

mapper xml

<select id="listFull" resultType="net.zzj6.wrdm.vo.LogWireless">
	SELECT twl.id,c.id as 'cid',c.mac_addr,c.`name`,c.remarks,twl.date,twl.state,twl.`port`
	FROM `t_log_wireless` twl
	<where>
		<if test="cname != null and cname != ''">
			and c.`name`=#{cname}
		</if>
	</where>
	INNER JOIN `t_client` c ON twl.cid=c.id
	ORDER BY twl.id DESC,twl.date DESC
</select>

用的mysql数据库  ER图如下

 

 Navicat正常执行的

 

 

求解答 谢谢。

  • 写回答

2条回答 默认 最新

  • MrBUS 2020-12-26 21:10
    关注


    where条件卸载INNER JOIN后面谢谢,

     


    <select id="listFull" resultType="net.zzj6.wrdm.vo.LogWireless">

     

    SELECT twl.id,c.id as 'cid',c.mac_addr,c.`name`,c.remarks,twl.date,twl.state,twl.`port`

     

    FROM `t_log_wireless` twl

     

    INNER JOIN `t_client` c ON twl.cid=c.id

    <where>

     

    <if test="cname != null and cname != ''">

     

    and c.`name`=#{cname}

     

    </if>

     

    </where>

    ORDER BY twl.id DESC,twl.date DESC

     

    </select>

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 状态机/汽车转向灯/Sateflow
  • ¥15 这个有点复杂 有没有人看看
  • ¥15 用python如何确定子孙元素在父元素中的位置
  • ¥15 obj文件滤除异常高程
  • ¥15 用mathematicas或者matlab计算三重积分
  • ¥15 Loop unrolling的runtime计算
  • ¥100 NVMe-oF的Target端,开启attr_offload后,测试失败。
  • ¥100 有偿照片马赛克去掉,保留原始数据
  • ¥15 c# winform http报错,如何解决?
  • ¥15 统计软件及应用-r软件