Przeglądaj źródła

更新文件 DriverStockMapper.xml

陈士柏 2 lat temu
rodzic
commit
756c93a2d8

+ 83 - 0
src/main/resources/mapper/template/DriverStockMapper.xml

@@ -12,6 +12,19 @@
         <result property="num" column="num"/>
         <result property="num" column="num"/>
     </resultMap>
     </resultMap>
 
 
+    <resultMap id="MeterPage" type="com.template.model.tongji.MeterPage">
+        <result property="build" column="build"/>
+        <result property="meterId" column="meter_id"/>
+        <result property="num" column="num"/>
+        <result property="createTime" column="create_time"/>
+    </resultMap>
+
+    <resultMap id="userPage" type="com.template.model.tongji.userPage">
+        <result property="name" column="name"/>
+        <result property="cardNo" column="card_no"/>
+        <result property="departMent" column="depart_ment"/>
+    </resultMap>
+
     <!--年级统计-->
     <!--年级统计-->
     <select id="getClassTj" resultMap="Tj">
     <select id="getClassTj" resultMap="Tj">
         select `name`, COUNT(*) as num from ( select IFNULL(b.`name`,'未知') `name` from `smart_user` a
         select `name`, COUNT(*) as num from ( select IFNULL(b.`name`,'未知') `name` from `smart_user` a
@@ -31,4 +44,74 @@
                    group by meter_type
                    group by meter_type
     </select>
     </select>
 
 
+    <!--每栋楼电费月统计-->
+    <select id="getEnergyMonth" resultMap="TjF">
+        select b.name, IFNULL(a.num,0) num,#{date} as date from (
+            select name,IFNULL(SUM(num),0) as num from `month_meter_detail`
+            where date=#{date} and type=#{type}
+            group by name ) a right join `smart_build` b on a.name=b.name
+    </select>
+
+    <!--总设备数-->
+    <select id="getTotalDevice" resultMap="TjF">
+        select case meter_type when 1 then '电表' when 0 then '水表' end as `name`,
+               COUNT(*) as num
+        from `smart_build_meter` group by meter_type
+    </select>
+
+    <!--在线设备数-->
+    <select id="getOnlineDevice" resultMap="TjF">
+        select case meter_type when 1 then '电表' when 0 then '水表' end as `name`,
+               COUNT(*) as num from (select * from `smart_meter_detail` where create_time
+           like concat(#{date}, '%') group by meter_id ) a group by meter_type
+    </select>
+
+    <!--设备实时记录数据-->
+    <select id="getMeterDetail" resultMap="MeterPage">
+        select c.meter_id,c.meter_power num,d.`name` build,c.create_time from (select a.`meter_id`,a.`meter_power`,a.`create_time`,
+              b.`build_id` from `smart_meter_detail` a left join `smart_build_meter` b
+              on a.`meter_id`=b.`meter_id` where a.meter_type=#{meterType}) c
+              left join `smart_build` d on c.`build_id`=d.`id` order by create_time desc
+    </select>
+
+    <!--设备实时记录数据-->
+    <select id="getUserComp" resultMap="Tj">
+        select iname as name,COUNT(*) as num from (
+             select a.*,b.name as iname from `smart_user` a left join `smart_identity` b
+             on a.`identity_id`=b.id where a.deleted=0 ) c group by iname
+    </select>
+
+    <!--用户汇总学生-->
+    <select id="getUserPage" resultMap="userPage">
+        select a.name,a.`card_no`,b.`name` as depart_ment from `smart_user` a
+             left join `smart_department` b on a.`department_id`=b.id
+             where a.`deleted`=0 and a.identity_id=#{identityId}
+        <if test="key != null and key != ''">
+            and (a.name like '%' #{key} '%' or a.card_no like '%' #{key} '%')
+        </if>
+    </select>
+
+    <!--教学成果-->
+    <select id="getScorePer" resultMap="Tj">
+        select score as name,COUNT(*) as num from (
+        select case when score <![CDATA[ < ]]> 60 then '60分以下'
+        when score <![CDATA[ >= ]]> 60 and score <![CDATA[ <= ]]> 70 then '60-70'
+        when score <![CDATA[ >= ]]> 71 and score <![CDATA[ <= ]]> 80 then '71-80'
+        when score <![CDATA[ >= ]]> 81 and score <![CDATA[ <= ]]> 90 then '81-90'
+        when score <![CDATA[ >= ]]> 91 and score <![CDATA[ <= ]]> 100 then '91-100'
+        end score,CONCAT(semester,b.name) as exam_name,a.deleted=0,a.update_user from `smart_score` a
+        left join `smart_examtype` b on a.exam_type=b.id ) a
+        where a.exam_name=#{examName} and a.update_user=#{updateUser} group by score
+    </select>
+
+    <!--考试名称-->
+    <select id="getExamName" resultMap="Tj">
+        select distinct(CONCAT(semester,b.name)) as name from `smart_score` a
+              left join `smart_examtype` b on a.exam_type=b.id where a.`deleted`=0
+    </select>
+
+    <!--教师评分-->
+    <select id="getTeacherExam" resultMap="Tj">
+        select evaluate_detail as name from `smart_evaluate_teacher` where card_no=#{cardNo} and deleted=0 order by id desc
+    </select>
 </mapper>
 </mapper>