Explorar el Código

三维建模-设备信息查询

jichaobo hace 2 años
padre
commit
8f47553c07

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java

@@ -71,7 +71,7 @@ public class MybatisGeneratorUtils {
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表
-        strategy.setInclude("base_company_person");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("base_model");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 42 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/BaseModelController.java

@@ -0,0 +1,42 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.fire.service.BaseModelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 三维模型设备信息 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-09-05
+ */
+@RestController
+@RequestMapping("/baseModel")
+public class BaseModelController {
+
+    @Autowired
+    private BaseModelService baseModelService;
+
+    /**
+     * 三维建模-设备信息查询
+     *
+     * @param buildId 建筑ID
+     * @param floorId 楼层
+     * @return
+     */
+    @GetMapping("modelDataList")
+    public ApiResult<List<Object>> modelDataList(@RequestParam(value = "buildId") Integer buildId,
+                                                 @RequestParam(value = "floorId") Integer floorId) {
+        return ApiResult.success(baseModelService.modelDataList(buildId, floorId));
+    }
+}
+

+ 111 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/BaseModel.java

@@ -0,0 +1,111 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 三维模型设备信息
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-09-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseModel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 模型名称
+     */
+    private String modelName;
+
+    /**
+     * 模型类型
+     */
+    private String modelType;
+
+    /**
+     * 模型URL
+     */
+    private String modelUrl;
+
+    /**
+     * 模型坐标
+     */
+    private String modelPosition;
+
+    /**
+     * 模型旋转角度
+     */
+    private String modelAngle;
+
+    /**
+     * 模型大小(默认大小[1,1,1])
+     */
+    private String modelScale;
+
+    /**
+     * 模型设备拖拽
+     */
+    private Boolean modelDragBool;
+
+    /**
+     * 楼层
+     */
+    private Integer floor;
+
+    /**
+     * 建筑ID
+     */
+    private Integer buildId;
+
+    /**
+     * 单位ID
+     */
+    private String companyId;
+
+    /**
+     * 使能标识(1:开通 、2:待定 、3:注销)
+     */
+    private Integer enable;
+
+    /**
+     * 对应设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 更新人
+     */
+    private String updatePerson;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/BaseModelMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.BaseModel;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 三维模型设备信息 Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-09-05
+ */
+public interface BaseModelMapper extends CrudMapper<BaseModel> {
+
+}

+ 26 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/BaseModelService.java

@@ -0,0 +1,26 @@
+package com.usky.fire.service;
+
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.domain.BaseModel;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 三维模型设备信息 服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-09-05
+ */
+public interface BaseModelService extends CrudService<BaseModel> {
+
+    /**
+     * 三维建模-设备信息查询
+     *
+     * @param buildId 建筑ID
+     * @param floorId 楼层
+     * @return
+     */
+    List<Object> modelDataList(Integer buildId, Integer floorId);
+}

+ 57 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BaseModelServiceImpl.java

@@ -0,0 +1,57 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.domain.BaseModel;
+import com.usky.fire.mapper.BaseModelMapper;
+import com.usky.fire.service.BaseModelService;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 三维模型设备信息 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-09-05
+ */
+@Service
+public class BaseModelServiceImpl extends AbstractCrudService<BaseModelMapper, BaseModel> implements BaseModelService {
+
+
+    @Override
+    public List<Object> modelDataList(Integer buildId, Integer floorId) {
+        List<Object> list = new ArrayList<>();
+        LambdaQueryWrapper<BaseModel> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(BaseModel::getId, BaseModel::getDeviceCode, BaseModel::getModelName, BaseModel::getModelType,
+                BaseModel::getModelUrl, BaseModel::getModelPosition, BaseModel::getModelAngle, BaseModel::getModelScale,
+                BaseModel::getModelDragBool)
+                .eq(BaseModel::getEnable, 1)
+                .eq(BaseModel::getBuildId, buildId)
+                .eq(BaseModel::getFloor, floorId);
+        List<BaseModel> list1 = this.list(queryWrapper);
+        if (CollectionUtils.isNotEmpty(list1)) {
+            for (int i = 0; i < list1.size(); i++) {
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("id", list1.get(i).getId());
+                map.put("modelName", list1.get(i).getModelName());
+                map.put("modelType", list1.get(i).getModelType());
+                map.put("modelUrl", list1.get(i).getModelUrl());
+                map.put("modelPosition", list1.get(i).getModelPosition().split(","));
+                map.put("modelAngle", list1.get(i).getModelAngle().split(","));
+                map.put("modelScale", list1.get(i).getModelScale().split(","));
+                map.put("modelDragBool", list1.get(i).getModelDragBool());
+                map.put("deviceCode", list1.get(i).getDeviceCode());
+                list.add(map);
+            }
+        }
+        return list;
+    }
+}

+ 7 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -109,8 +109,13 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         if (personnelIdList.size() > 0) {
             LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
             queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
-                    .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
-                    .groupBy(PatrolInspectionPlanSchedule::getPlanId);
+                    .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList);
+            if (sort.equals("DESC")){
+                queryWrapper.orderByDesc(PatrolInspectionPlanSchedule::getId);
+            }else {
+                queryWrapper.orderByAsc(PatrolInspectionPlanSchedule::getId);
+            }
+            queryWrapper.groupBy(PatrolInspectionPlanSchedule::getPlanId);
             List<PatrolInspectionPlanSchedule> planScheduleList = patrolInspectionPlanScheduleService.list(queryWrapper);
             if (planScheduleList.size() > 0) {
                 List<Integer> planIdList = new ArrayList<>();

+ 26 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/BaseModelMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.fire.mapper.BaseModelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.BaseModel">
+        <id column="id" property="id" />
+        <result column="model_name" property="modelName" />
+        <result column="model_type" property="modelType" />
+        <result column="model_url" property="modelUrl" />
+        <result column="model_position" property="modelPosition" />
+        <result column="model_angle" property="modelAngle" />
+        <result column="model_scale" property="modelScale" />
+        <result column="model_drag_bool" property="modelDragBool" />
+        <result column="floor" property="floor" />
+        <result column="build_id" property="buildId" />
+        <result column="company_id" property="companyId" />
+        <result column="enable" property="enable" />
+        <result column="device_code" property="deviceCode" />
+        <result column="create_time" property="createTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="update_person" property="updatePerson" />
+        <result column="creator" property="creator" />
+    </resultMap>
+
+</mapper>