mybatis中mapper命名问题

mapper文件中id命名最好首字母小写,避免让mybatis认为是一个类

    
    <resultMap id="ProviderList" type="Provider">
        <result property="id" column="id"/>
        <result property="proCode" column="proCode"/>
        <result property="proName" column="proName"/>
        <result property="proDesc" column="proDesc"/>
        <result property="proContact" column="proContact"/>
        <result property="proPhone" column="proPhone"/>
        <result property="proAddress" column="proAddress"/>
        <result property="creationDate" column="creationDate"/>
    resultMap>
    <select id="getProviderList" parameterType="Provider" resultMap="ProviderList">
        select * from smbms_provider provider
        where proName like CONCAT('%', #{proName}, '%')
    select>

其中resultMap的id名称为ProviderList ,会将ProviderList理解为一个类,映射不到

    id="ProviderList" type="Provider">
        <result property="id" column="id"/>
        <result property="proCode" column="proCode"/>
        <result property="proName" column="proName"/>
        <result property="proDesc" column="proDesc"/>
        <result property="proContact" column="proContact"/>
        <result property="proPhone" column="proPhone"/>
        <result property="proAddress" column="proAddress"/>
        <result property="creationDate" column="creationDate"/>
    

会发生异常,正确写法为将ProviderList的首字母小写,即为避免问题mapper文件中id值小写

你可能感兴趣的:(Java,spring,Mybatis)