|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getAverageByAll" resultType="map"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | <if test="macKey == 'all'"> | 
|---|
|  |  |  | h.mac_key, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="macKey != null and macKey != 'all'"> | 
|---|
|  |  |  | e.name, | 
|---|
|  |  |  | e.name, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="macKey == 'all'"> | 
|---|
|  |  |  | h.mac_key, | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | AVG(h.mac_value) avg | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | 
|---|
|  |  |  | #{listItem} | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="macKey == 'all'"> | 
|---|
|  |  |  | GROUP BY | 
|---|
|  |  |  | h.mac_key | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="macKey != null and macKey != 'all'"> | 
|---|
|  |  |  | AND    h.mac_key = #{macKey} | 
|---|
|  |  |  | AND    h.mac_key = #{macKey} | 
|---|
|  |  |  | GROUP BY e.id | 
|---|
|  |  |  | ORDER BY avg | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="macKey == 'all'"> | 
|---|
|  |  |  | GROUP BY h.mac_key | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | #{listItem} | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | GROUP BY | 
|---|
|  |  |  | state | 
|---|
|  |  |  | GROUP BY state | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getMacLogByLast" resultType="string"> | 
|---|