From 606c896c1b7c9d986cfb13d8464f3482160a1389 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Tue, 08 May 2018 09:47:40 +0800
Subject: [PATCH] 手机 设备 保存 api

---
 src/main/resources/mapper/DeviceMapper.xml |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index c13c908..36ce410 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -62,6 +62,18 @@
     id, name, address, longitude, latitude, mac, operate_user_id, state, is_delete, create_time, 
     install_time, monitor_point_id, device_version_id
   </sql>
+	<select id="countByTimes"   resultType="java.util.Map">
+		select DATE_FORMAT(create_time,#{format}) as time, COUNT(*) as count from device
+		where create_time >= #{start}
+		and create_time
+		<![CDATA[
+		<=
+		]]> #{end}
+		and is_delete <![CDATA[
+		<>
+		]]> 1
+		GROUP BY DATE_FORMAT(create_time,#{format}) ;
+	</select>
   <select id="selectWithRelationData" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap">
     select
 	dev.*,
@@ -198,9 +210,11 @@
 	</select>
 	<select id="selectWithOrgIdsByMac" parameterType="java.lang.String" resultMap="BaseResultWithOrgIdsMap">
 		select
-		id,device_version_id,mac,monitor_point_id
-		from device
-		where mac = #{mac,jdbcType=VARCHAR}
+		dev.*,
+		mpt.name as monitor_point_name
+		from device dev
+        left join monitor_point  mpt on dev.monitor_point_id = mpt.id
+		where dev.mac = #{mac,jdbcType=VARCHAR}
 	</select>
 
 	<select id="getDeviceCountByRegion" resultType="java.lang.Integer">

--
Gitblit v1.8.0