瀏覽代碼

优化 设备

java110 5 年之前
父節點
當前提交
4dc73b22d4
共有 1 個文件被更改,包括 10 次插入21 次删除
  1. 10 21
      java110-db/src/main/resources/mapper/common/MachineServiceDaoImplMapper.xml

+ 10 - 21
java110-db/src/main/resources/mapper/common/MachineServiceDaoImplMapper.xml

@@ -147,18 +147,12 @@
         t.state,c.location_type locationTypeCd, c.location_name locationTypeName, t.location_obj_id locationObjId,
         t.location_type_cd,t.location_obj_id,
         td1.name stateName,t.create_time createTime,t.direction,td3.name directionName
-        from machine t,t_dict td,t_dict td1,t_dict td3, community_location c
+        from machine t
+        left join t_dict td on t.machine_type_cd=td.status_cd and td.table_name='machine' and td.table_columns='machine_type_cd'
+        left join t_dict td1 on t.state = td1.status_cd and td1.table_name='machine' and td1.table_columns='state'
+        left join t_dict td3 on t.direction = td3.status_cd and td3.table_name='machine' and td3.table_columns='direction'
+        left join community_location c on t.location_type_cd = c.location_id and t.status_cd = '0'
         where 1 =1
-        and t.machine_type_cd=td.status_cd
-        and td.table_name='machine'
-        and td.table_columns='machine_type_cd'
-        and t.state = td1.status_cd
-        and td1.table_name='machine'
-        and td1.table_columns='state'
-        and t.direction = td3.status_cd
-        and td3.table_name='machine'
-        and td3.table_columns='direction'
-        and t.location_type_cd = c.location_id
         <if test="machineMac !=null and machineMac != ''">
             and t.machine_mac= #{machineMac}
         </if>
@@ -273,17 +267,12 @@
     <!-- 查询设备数量 add by wuxw 2018-07-03 -->
     <select id="queryMachinesCount" parameterType="Map" resultType="Map">
         select count(1) count
-        from machine t,t_dict td,t_dict td1,t_dict td3
+        from machine t
+        left join t_dict td on t.machine_type_cd=td.status_cd and td.table_name='machine' and td.table_columns='machine_type_cd'
+        left join t_dict td1 on t.state = td1.status_cd and td1.table_name='machine' and td1.table_columns='state'
+        left join t_dict td3 on t.direction = td3.status_cd and td3.table_name='machine' and td3.table_columns='direction'
+        left join community_location c on t.location_type_cd = c.location_id and t.status_cd = '0'
         where 1 =1
-        and t.machine_type_cd=td.status_cd
-        and td.table_name='machine'
-        and td.table_columns='machine_type_cd'
-        and t.state = td1.status_cd
-        and td1.table_name='machine'
-        and td1.table_columns='state'
-        and t.direction = td3.status_cd
-        and td3.table_name='machine'
-        and td3.table_columns='direction'
         <if test="machineMac !=null and machineMac != ''">
             and t.machine_mac= #{machineMac}
         </if>