今天写统计查询的时候出现了Springboot项目启动失败没有报错

关于Caused by: org.xml.sax.SAXParseException;必须为元素类型 "select" 声明属性 "parmeterType"

在main函数上捕捉异常

try {
    SpringApplication.run(TiangongSpringBootDemoApplication.class, args);
} catch (Exception e) {
    e.printStackTrace();
    log.error("the exception is {}", e);
}

原来代码是这么写的

List<String> selectIds(@Param(value="dateVo")DateVo dateVo);
<select id="selectIds" resultType="java.lang.String" parameterType="com.api.entity.DateVo"> 
select distinct ajlcid 
from ebd_fh_ajlc where sorttime >= to_date(#{startDate},'YYYY-MM-DD') 
and created_date=updated_date
and keyvalue in (select distinct companyname from ebd_fh_company_list where isupdate='0') 
</select>

看起来比较疑惑明明有parameterType这个参数,提示我没有参数

删除parameterType就可以了

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐