Forráskód Böngészése

获取机构下面的 化验室/连续监测设备统计调整 水厂的不变

王苗苗 5 napja
szülő
commit
ec16a66676

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/business/mapper/BizDeviceMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.ruoyi.business.domain.BizDevice;
 import com.ruoyi.business.req.DeviceReq;
 import com.ruoyi.business.res.DeviceRes;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 设备Mapper接口
@@ -68,4 +69,6 @@ public interface BizDeviceMapper
      * @return 结果
      */
     List<DeviceRes> devicePageList(DeviceReq deviceReq);
+
+    int selectChildDeviceCountsByType(@Param("id") Long id, @Param("type") String type);
 }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/business/service/impl/TOrganizationServiceImpl.java

@@ -60,8 +60,8 @@ public class TOrganizationServiceImpl implements ITOrganizationService
     private void addExtra(TOrganization organization) {
         Long id = organization.getId();
         //处理连续检测设备总数  实验室设备总数
-        organization.setLxjcCounts(bizDeviceMapper.selectBizDeviceList(BizDevice.builder().deviceWorks(id).type("2").build()).size());
-        organization.setRobotCounts(bizDeviceMapper.selectBizDeviceList(BizDevice.builder().deviceWorks(id).type("1").build()).size());
+        organization.setLxjcCounts(bizDeviceMapper.selectChildDeviceCountsByType(id, "2"));
+        organization.setRobotCounts(bizDeviceMapper.selectChildDeviceCountsByType(id, "1"));
         //处理省市区名字
         organization.setProvinceName(this.sysRegionMapper.selectNameByCode(organization.getProvinceCode()));
         organization.setCityName(this.sysRegionMapper.selectNameByCode(organization.getCityCode()));

+ 17 - 0
ruoyi-system/src/main/resources/mapper/business/BizDeviceMapper.xml

@@ -236,4 +236,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="type != null  and type != ''"> and bd.type = #{type}</if>
         order by bd.device_id desc
     </select>
+
+
+    <select id="selectChildDeviceCountsByType" resultType="int">
+        SELECT
+            COUNT(*)
+        FROM
+            biz_device
+        WHERE
+            device_works IN (
+                SELECT DISTINCT
+                    id
+                FROM
+                    t_organization
+                WHERE
+                    parent_id = #{id})
+          AND type = #{type}
+    </select>
 </mapper>