123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.bizmatics.persistence.mapper.HadSiteStaticMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.bizmatics.model.HadSiteStatic">
- <id column="id" property="id" />
- <result column="site_id" property="siteId" />
- <result column="max_epp" property="maxEpp" />
- <result column="min_epp" property="minEpp" />
- <result column="avg_epp" property="avgEpp" />
- <result column="load_ico" property="loadIco" />
- <result column="his_ico" property="hisIco" />
- <result column="had_time" property="hadTime" />
- </resultMap>
- <select id="selectCount" resultType="java.lang.Double">
- select
- IFNULL(sum(siteSum),0)
- FROM (
- SELECT
- (max(max_epp)-min(min_epp)) as siteSum
- FROM
- had_site_static as hs
- INNER JOIN user_site as us
- on hs.site_id = us.site_id
- <where>
- <if test="userId != null and userId != 0">
- and us.user_id = #{userId}
- </if>
- <if test="siteId != null and siteId != 0">
- and us.site_id = #{siteId}
- </if>
- <if test="startTime != null and endTime != null">
- and hs.had_time between #{startTime} and #{endTime}
- </if>
- </where>
- GROUP BY hs.site_id
- )as t
- </select>
- </mapper>
|