当前使用版本(必填,否则不予处理)
3.4.3.4
该问题是如何引起的?(确定最新版也有问题再提!!!)
自定义xml加分页
重现步骤(如果有就写完整)
**如上,需要实现该需求,根据apply_at降序查询到不重复的doctor_id。(无法使用distinct或者groupby)
但是我不管加不加这个doctor_id=1(实际不需要加这个条件),都会报下面错误,请问应当如何解决。
不懂就问,请问: 1. 我如何加这个where条件,(select查询必须要加where条件是考虑到数据量很大导致扫描条数很多的问题吗); 2. 关于忽略插件失效的问题,能否支持到单个方法中,不忽略整个mapper呢。
报错信息
`org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: 非法SQL,必须要有where条件
The error may exist in class path resource [mapper/HpAssistantMapper.xml]
The error may involve cn.nocov.hospital.manage.mapper.HpAssistantMapper.selectHpAssistantPage_mpCount
The error occurred while executing a query
Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: 非法SQL,必须要有where条件
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy128.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:121)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:85)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
at com.sun.proxy.$Proxy281.selectHpAssistantPage(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)`
Comment From: xieshenace
SELECT doctor_id
FROM d_hp_assistant
GROUP BY doctor_id
ORDER BY apply_at DESC
怎么样才能过插件的校验呢,,,
Comment From: xieshenace
SELECT doctor_id FROM d_hp_assistant a WHERE NOT EXISTS (SELECT 1 FROM d_hp_assistant b WHERE doctor_id = a.doctor_id AND apply_at > a.apply_at) ORDER BY apply_at DESC
过了过了。。我丢