mybatis查询报错Parameter index out of range (3 > number of parameters, which is 2).

<select id="getDistinctCompanyBusiness"
        parameterType="java.util.Map"
        resultType="com.qy.insurance.ls.adjust.dto.company.CompanyStatisticsResponse">

    SELECT
    e.client_name as companyName,
    d.class_name as termName,
    COUNT(a.flow_Id) as caseAmount,
    COUNT(c.id) as businessAmount,
    COUNT(b.id) as queryAmount
    FROM
    t_amount_case a
    LEFT JOIN
    t_calc_billinfo b
    ON
    a.flow_Id=b.flowId
    LEFT JOIN
    t_amount_business c
    ON
    a.flow_Id=c.flow_Id
    LEFT JOIN
    t_class d
    ON
    c.class_code=d.class_code
    LEFT JOIN
    t_client e
    ON
    a.client_code=e.client_code
    GROUP BY
    a.client_code

    <where>
        <if test="startDate != null">
            AND a.statistical_time >= #{startDate}
        </if>
        <if test="endDate != null">
            AND a.statistical_time &lt;= #{endDate}
        </if>
        <if test="client_code != '' and client_code != null">
            AND a.client_code = #{clientCode,jdbcType=VARCHAR}
        </if>
        <if test="classCode != '' and classCode != null">
            AND c.class_code = #{classCode,jdbcType=VARCHAR}
        </if>
        <if test="businessType != '' and businessType != null">
            AND a.bill_type = #{businessType,jdbcType=VARCHAR}
        </if>
    </where>

</select>

 GROUP BY

a.client_code

应该写在where后面!!!!

猜你喜欢

转载自blog.csdn.net/huangcsdnjava/article/details/79933434