这样是对滴,首先参数类型需要时基本数据类型,其次判断中要用_parameter,组成SQL的时候变量名可以随意命名
<select id="selectByParentId" resultMap="BaseResultMap" parameterType="<span style="font-size:24px;color:#006600;"><strong>int</strong></span>" >
select
<include refid="Base_Column_List" />
from tm01_department
<if test="<strong><span style="font-size:18px;color:#990000;">_parameter != null</span></strong>">
where parent_dept_id = #{parentDeptId}
</if>
<if test="<strong><span style="font-size:18px;color:#990000;background-color: rgb(255, 255, 255);">_parameter == null</span></strong>">
where parent_dept_id is null
</if>
</select>