Sql语句错误示例:
<select id="getbusinessPermitTotal" resultType="integer">
SELECT IFNULL(SUM(ISNULL(ALLOW_RECORD_NUM,0)),0)
FROM FOODS_DWS.FACT_MANAGE_ALLOW_RECORD AS F1
<if test="pro!=null">
WHERE F1.REGION_KEY IN (SELECT REGION_KEY FROM FOODS_DWS.DIM_REGION WHERE PROVINCE_NAME= #{pro})
</if>
</select>
解决办法:
把pro换成_parameter 就可以了
<select id="getbusinessPermitTotal" resultType="integer">
SELECT IFNULL(SUM(ISNULL(ALLOW_RECORD_NUM,0)),0)
FROM FOODS_DWS.FACT_MANAGE_ALLOW_RECORD AS F1
<if test="_parameter!=null">
WHERE F1.REGION_KEY IN (SELECT REGION_KEY FROM FOODS_DWS.DIM_REGION WHERE PROVINCE_NAME= #{_parameter })
</if>
</select>