|
|
@@ -0,0 +1,34 @@
|
|
|
+<?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.template.mapper.DriverStockMapper">
|
|
|
+
|
|
|
+ <resultMap id="Tj" type="com.template.model.tongji.Tj">
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="num" column="num"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="TjF" type="com.template.model.tongji.TjFloat">
|
|
|
+ <result property="name" column="name"/>
|
|
|
+ <result property="num" column="num"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--年级统计-->
|
|
|
+ <select id="getClassTj" resultMap="Tj">
|
|
|
+ select `name`, COUNT(*) as num from ( select IFNULL(b.`name`,'未知') `name` from `smart_user` a
|
|
|
+ left join `smart_grade` b on a.`grade`=b.id ) c group by `name`
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--访客统计-->
|
|
|
+ <select id="getVisitorTj" resultMap="Tj">
|
|
|
+ select case visitor_type when '1' then '家长' when '2' then '其他'
|
|
|
+ end as `name`,COUNT(*) as num from `smart_visitor` group by visitor_type
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--能耗总量统计-->
|
|
|
+ <select id="getEnergyTj" resultMap="TjF">
|
|
|
+ select case meter_type when 1 then '用电量' when 0 then '用水量' end as `name`,
|
|
|
+ SUM(meter_power) as num from `smart_meter_detail`
|
|
|
+ group by meter_type
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|