<select id="findEmployeesByLocation" resultType="Employee"> SELECT * FROM Employee WHERE status = 'ACTIVE' <choose> <when test="locationType == 'local'"> AND local_loc_code = #{loc_code} </when> <when test="locationType == 'remote'"> AND local_loc_code = #{loc_code} </when> <otherwise> AND loc_code = #{loc_code} </otherwise> </choose> </select>