工业级运维app手机api
xufenglei
2017-11-03 881e13105ca2d99be13ef6f06137c0e4763e3a78
sql 改进
1 files modified
18 ■■■■ changed files
src/main/resources/mapper/HistoryEntityMapper.xml 18 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/HistoryEntityMapper.xml
@@ -239,11 +239,11 @@
    <select id="getAverageByAll" resultType="map">
        SELECT
            <if test="macKey == 'all'">
            h.mac_key,
            </if>
            <if test="macKey != null and macKey != 'all'">
            e.name,
            </if>
            <if test="macKey == 'all'">
                h.mac_key,
            </if>    
            AVG(h.mac_value) avg
        FROM
@@ -263,12 +263,13 @@
                #{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}
            GROUP BY e.id
            ORDER BY avg
        </if>
        <if test="macKey == 'all'">
            GROUP BY h.mac_key
        </if>    
    </select>
@@ -285,8 +286,7 @@
                #{listItem}
            </foreach>
        </if>
        GROUP BY
            state
        GROUP BY state
    </select>
    <select id="getMacLogByLast" resultType="string">