在写springboot接口的mapper层时把sql复制到xml文件内并改写如下
<select id="getSatisfactionCXPJ" resultType="com.yunque.report.model.ServiceOrderList">
select a.*
from sch_dm.dm_service_order_list a
inner join sch_dw.dw_service_order_list_ex b
on a.service_order_id=b.service_order_id
where a.service_type in ('720200003')
and a.accept_date>=TO_CHAR(to_date(#{complaintMonthStart},'yyyymm'),'yyyy-mm-dd hh24:mi:ss')
and a.accept_date <![CDATA[<TO_CHAR]]> (to_date(#{complaintMonthEnd},'yyyymm')+interval '1month','yyyy-mm-dd hh24:mi:ss')
and b.ex_col_07 in ('182','284','285','286','287','288','289','290','291','292','293','294','97')
and a.ts_deal_result_name in ('非常满意','满意','一般','不满意','很不满意','未解决')
<if test="orgName!=null and orgName !=''and orgName !='全省' ">
and b.ex_col_08 = #{orgName} -- 处理单位
</if>
<if test="dealStaffId!=null and dealStaffId !='' ">
and a.ck_deal_staff_id = #{dealStaffId} -- 处理员工
</if>
</select>
调试接口时报错Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #4 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: The column index is out of range: 4, number of columns: 3.
经发现是由于xml文件不支持 ‘--’ 形式下的注释
解决办法
将注释删除或者运用<!-- 注释的内容 -->格式添加注释即可