记录一下在公司开发中遇到的问题

在使用 mapper.xml 进行编写时 resultMap=“String” String竟然引用不进去,在程序中标红,别的mapper中也映射过但是别的就好使,然后重新启动的时候代码执行报错

<select id="queryAreaBy" parameterType="String" resultType="String">
       select SUM(area) as area from tb_forward_area where
                    server_time = #{serverTime}  and
                    region_code like concat('%',#{regionCode},'%')
                    and del_flag='0'
    </select>

这时需要 在resultType 中引入绝对路径

 <select id="queryAreaBy" parameterType="String" resultType="java.lang.String" >
        select SUM(area) as area from tb_forward_area where
                    server_time = #{serverTime}  and
                    region_code like concat('%',#{regionCode},'%')
                    and del_flag='0'
    </select>

代码也不报错了也可以正常使用了,第二天继续编写项目时,试了下把 java.lang. 这个路径删了他也好使了,但是在同一个mapper中别的SQL想使用String或者Long类型的还需要引入绝对路径

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐