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

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条)

报告相同问题?

悬赏问题

  • ¥20 unity实习让我做一个程序
  • ¥15 idea tomcat和sql驱动不匹配吗
  • ¥15 如何查看h3c 5130s-28f-si交换机配置 及更改网口
  • ¥15 HFSS仿真喇叭天线阵列方向图出现异常
  • ¥15 blender自发光强度
  • ¥15 FIR滤波器算法设计与实现(利用库函数firdec()
  • ¥15 利用单片机产生正弦信号,来测量差分放大电路放大倍数和共模放大倍数的思路和仿真
  • ¥60 关于mavlink的论文咨询
  • ¥66 定制开发肯德基自动化网站下单软件
  • ¥15 中科院研发的TextMind(文心)