Ver Fonte

统计信息

wangyangyang há 4 anos atrás
pai
commit
60c5776b00

+ 10 - 0
sms_water/src/main/java/com/huaxu/controller/ThingSettingController.java

@@ -40,6 +40,16 @@ public class ThingSettingController{
         List<ThingSettingEntity> thingSettingEntities = thingSettingService.findList(thingSettingEntity);
         return new AjaxMessage<>(ResultStatus.OK, thingSettingEntities);
     }
+
+    @RequestMapping(value = "/findTotalList",method = RequestMethod.GET)
+    @ResponseBody
+    @ApiOperation(value = "查询物品统计汇总信息")
+    public AjaxMessage<List<ThingSettingEntity>> findTotalList(@ApiParam(value = "物品类型(1管网 2窨井 3阀门 4消防栓)", required = true) @RequestParam Integer thingType) {
+        ThingSettingEntity thingSettingEntity = new ThingSettingEntity();
+        thingSettingEntity.setThingType(thingType);
+        List<ThingSettingEntity> thingSettingEntities = thingSettingService.findTotalList(thingSettingEntity);
+        return new AjaxMessage<>(ResultStatus.OK, thingSettingEntities);
+    }
     /**
      * 新增
      */

+ 3 - 1
sms_water/src/main/java/com/huaxu/dao/ThingSettingMapper.java

@@ -30,5 +30,7 @@ public interface ThingSettingMapper extends BaseMapper<ThingSettingEntity> {
 
      List<ThingSettingEntity> findList( @Param("thingSetting")ThingSettingEntity thingSettingEntity);
 
-     /**删除相关方法  使用mybatis-plus集成的 **/
+    List<ThingSettingEntity> findTotalList( @Param("thingSetting")ThingSettingEntity thingSettingEntity);
+
+    /**删除相关方法  使用mybatis-plus集成的 **/
 }

+ 18 - 0
sms_water/src/main/java/com/huaxu/service/ThingSettingService.java

@@ -114,4 +114,22 @@ public class ThingSettingService extends ServiceImpl<ThingSettingMapper, ThingSe
     public ThingSettingEntity findThingSettingById(Long id) {
         return thingSettingMapper.findThingSettingById(id);
     }
+
+    public List<ThingSettingEntity> findTotalList(ThingSettingEntity thingSettingEntity) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        thingSettingEntity.setTenantId(currentUser.getTenantId());
+        thingSettingEntity.setProgramItems(currentUser.getProgramItemList());
+        thingSettingEntity.setUserType(currentUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        thingSettingEntity.setPermissonType(currentUser.getPermissonType());
+        List<ThingSettingEntity> thingSettingEntities = thingSettingMapper.findTotalList(thingSettingEntity);
+
+//        for (ThingSettingEntity item : thingSettingEntities) {
+//            if (item.getCompanyOrgId() != null)
+//                item.setCompanyOrgName(orgInfoUtil.getOrgName(item.getCompanyOrgId().intValue()));
+//            if (item.getDeptOrgId() != null)
+//                item.setDeptOrgName(orgInfoUtil.getOrgName(item.getDeptOrgId().intValue()));
+//        }
+        return thingSettingEntities;
+    }
 }

+ 39 - 1
sms_water/src/main/resources/mapper/ThingSettingMapper.xml

@@ -91,7 +91,45 @@
             </if>
         </where>
     </select>
-
+    <!--  根据获取实体List   -->
+    <select id="findTotalList" resultType="com.huaxu.entity.ThingSettingEntity">
+        SELECT
+        sum(a.thing_length) as "thingLength" , sum(a.thing_count) as "thingCount"
+        FROM sms_thing_setting a
+        <where>
+            a.status=1
+            <if test="thingSetting.tenantId != null  and thingSetting.tenantId != ''">and a.tenant_id = #{thingSetting.tenantId}</if>
+            <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
+            <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}</if>
+            <if test="thingSetting.userType!=null and thingSetting.userType!=-999 and thingSetting.userType!=-9999 and  thingSetting.programItems != null and thingSetting.programItems.size() > 0">
+                <if test="thingSetting.permissonType == 5 or thingSetting.permissonType == 2">
+                    and ( a.DEPT_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="thingSetting.permissonType == 4 or thingSetting.permissonType == 3">
+                    and a.DEPT_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="thingSetting.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+        </where>
+    </select>
     <!--  根据获取实体 page   -->
     <select id="findPage" resultType="com.huaxu.entity.ThingSettingEntity">
         SELECT