Browse Source

增加单位与设备绑定。

zhengqiang 5 years ago
parent
commit
fd5da1036f
1 changed files with 32 additions and 22 deletions
  1. 32 22
      common/src/main/resources/mapper/base/DeviceInfo.xml

+ 32 - 22
common/src/main/resources/mapper/base/DeviceInfo.xml

@@ -36,25 +36,25 @@
 	    (id_,header_,device_no,alias_name,address_,is_online,company_id,unlock_password,code_address,ip_address,port_,type_,is_auto_update,del_flag,create_by,create_time,update_by,update_time,default_face_library_id)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{header,jdbcType=VARCHAR}
-,#{deviceNo,jdbcType=VARCHAR}
-,#{aliasName,jdbcType=VARCHAR}
-,#{address,jdbcType=VARCHAR}
-,#{isOnline,jdbcType= NUMERIC }
-,#{companyId,jdbcType=VARCHAR}
-,#{unlockPassword,jdbcType=VARCHAR}
-,#{codeAddress,jdbcType=VARCHAR}
-,#{ipAddress,jdbcType=VARCHAR}
-,#{port,jdbcType=VARCHAR}
-,#{type,jdbcType=VARCHAR}
-,#{isAutoUpdate,jdbcType=NUMERIC}
-,#{delFlag,jdbcType= NUMERIC }
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{defaultFaceLibraryId,jdbcType=VARCHAR}
+			#{id,jdbcType=VARCHAR}
+			,#{header,jdbcType=VARCHAR}
+			,#{deviceNo,jdbcType=VARCHAR}
+			,#{aliasName,jdbcType=VARCHAR}
+			,#{address,jdbcType=VARCHAR}
+			,#{isOnline,jdbcType= NUMERIC }
+			,#{companyId,jdbcType=VARCHAR}
+			,#{unlockPassword,jdbcType=VARCHAR}
+			,#{codeAddress,jdbcType=VARCHAR}
+			,#{ipAddress,jdbcType=VARCHAR}
+			,#{port,jdbcType=VARCHAR}
+			,#{type,jdbcType=VARCHAR}
+			,#{isAutoUpdate,jdbcType=NUMERIC}
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{defaultFaceLibraryId,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -178,8 +178,18 @@ id_, header_,device_no,alias_name,address_,is_online,company_id,unlock_password,
 			select * from base_device_info where device_no = #{0} and del_flag=false
 	</select>
 	<select id="findByCompanyId" parameterType="string" resultMap="DeviceInfoMap">
-			select * from base_device_info where company_id = #{0} and del_flag=false
+		<![CDATA[
+			select * from base_device_info a where
+			(
+				a.company_id = #{0}
+				or
+				id_ in(
+					select b.company_id from base_company_device_relation b
+					where b.device_id=a.id_ and b.company_id=#{0}
+				)
+			)
+			and del_flag=0
+			order by create_time asc
+		]]>
 	</select>
-
-
 </mapper>