lipenghui 3 月之前
父節點
當前提交
4064858cb9

+ 5 - 6
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/yanfan/DeviceDO.java → yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/yanfan/YfDeviceDO.java

@@ -1,10 +1,9 @@
-package cn.iocoder.yudao.module.iot.dal.dataobject.device;
+package cn.iocoder.yudao.module.pms.dal.dataobject.yanfan;
 
 import lombok.*;
-import java.util.*;
-import java.time.LocalDateTime;
-import java.time.LocalDateTime;
+
 import java.time.LocalDateTime;
+
 import com.baomidou.mybatisplus.annotation.*;
 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
 
@@ -21,7 +20,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
-public class DeviceDO extends BaseDO {
+public class YfDeviceDO extends BaseDO {
 
     /**
      * 设备ID
@@ -145,4 +144,4 @@ public class DeviceDO extends BaseDO {
      */
     private Integer mqttstats;
 
-}
+}

+ 0 - 54
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/yanfan/DeviceMapper.java

@@ -1,54 +0,0 @@
-package cn.iocoder.yudao.module.pms.dal.mysql.yanfan;
-
-import java.util.*;
-
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.module.iot.dal.dataobject.device.DeviceDO;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 设备 Mapper
- *
- * @author 李鹏辉
- */
-@Mapper
-public interface DeviceMapper extends BaseMapperX<DeviceDO> {
-
-    default PageResult<DeviceDO> selectPage(DevicePageReqVO reqVO) {
-        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceDO>()
-                .likeIfPresent(DeviceDO::getDeviceName, reqVO.getDeviceName())
-                .eqIfPresent(DeviceDO::getProductId, reqVO.getProductId())
-                .likeIfPresent(DeviceDO::getProductName, reqVO.getProductName())
-                .likeIfPresent(DeviceDO::getTenantName, reqVO.getTenantName())
-                .eqIfPresent(DeviceDO::getSerialNumber, reqVO.getSerialNumber())
-                .eqIfPresent(DeviceDO::getGwDevCode, reqVO.getGwDevCode())
-                .eqIfPresent(DeviceDO::getFirmwareVersion, reqVO.getFirmwareVersion())
-                .eqIfPresent(DeviceDO::getStatus, reqVO.getStatus())
-                .eqIfPresent(DeviceDO::getRssi, reqVO.getRssi())
-                .eqIfPresent(DeviceDO::getIsShadow, reqVO.getIsShadow())
-                .eqIfPresent(DeviceDO::getLocationWay, reqVO.getLocationWay())
-                .eqIfPresent(DeviceDO::getThingsModelValue, reqVO.getThingsModelValue())
-                .eqIfPresent(DeviceDO::getNetworkAddress, reqVO.getNetworkAddress())
-                .eqIfPresent(DeviceDO::getNetworkIp, reqVO.getNetworkIp())
-                .eqIfPresent(DeviceDO::getLongitude, reqVO.getLongitude())
-                .eqIfPresent(DeviceDO::getLatitude, reqVO.getLatitude())
-                .betweenIfPresent(DeviceDO::getActiveTime, reqVO.getActiveTime())
-                .eqIfPresent(DeviceDO::getSummary, reqVO.getSummary())
-                .eqIfPresent(DeviceDO::getImgUrl, reqVO.getImgUrl())
-                .eqIfPresent(DeviceDO::getDelFlag, reqVO.getDelFlag())
-                .eqIfPresent(DeviceDO::getCreateBy, reqVO.getCreateBy())
-                .betweenIfPresent(DeviceDO::getCreateTime, reqVO.getCreateTime())
-                .eqIfPresent(DeviceDO::getUpdateBy, reqVO.getUpdateBy())
-                .eqIfPresent(DeviceDO::getRemark, reqVO.getRemark())
-                .eqIfPresent(DeviceDO::getIsSimulate, reqVO.getIsSimulate())
-                .eqIfPresent(DeviceDO::getSlaveId, reqVO.getSlaveId())
-                .eqIfPresent(DeviceDO::getClientId, reqVO.getClientId())
-                .eqIfPresent(DeviceDO::getPostDev, reqVO.getPostDev())
-                .eqIfPresent(DeviceDO::getGetDev, reqVO.getGetDev())
-                .eqIfPresent(DeviceDO::getMqttstats, reqVO.getMqttstats())
-                .orderByDesc(DeviceDO::getId));
-    }
-
-}

+ 53 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/yanfan/YfDeviceMapper.java

@@ -0,0 +1,53 @@
+package cn.iocoder.yudao.module.pms.dal.mysql.yanfan;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.pms.controller.admin.yanfan.vo.DevicePageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 设备 Mapper
+ *
+ * @author 李鹏辉
+ */
+@Mapper
+public interface YfDeviceMapper extends BaseMapperX<YfDeviceDO> {
+
+    default PageResult<YfDeviceDO> selectPage(DevicePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<YfDeviceDO>()
+                .likeIfPresent(YfDeviceDO::getDeviceName, reqVO.getDeviceName())
+                .eqIfPresent(YfDeviceDO::getProductId, reqVO.getProductId())
+                .likeIfPresent(YfDeviceDO::getProductName, reqVO.getProductName())
+                .likeIfPresent(YfDeviceDO::getTenantName, reqVO.getTenantName())
+                .eqIfPresent(YfDeviceDO::getSerialNumber, reqVO.getSerialNumber())
+                .eqIfPresent(YfDeviceDO::getGwDevCode, reqVO.getGwDevCode())
+                .eqIfPresent(YfDeviceDO::getFirmwareVersion, reqVO.getFirmwareVersion())
+                .eqIfPresent(YfDeviceDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(YfDeviceDO::getRssi, reqVO.getRssi())
+                .eqIfPresent(YfDeviceDO::getIsShadow, reqVO.getIsShadow())
+                .eqIfPresent(YfDeviceDO::getLocationWay, reqVO.getLocationWay())
+                .eqIfPresent(YfDeviceDO::getThingsModelValue, reqVO.getThingsModelValue())
+                .eqIfPresent(YfDeviceDO::getNetworkAddress, reqVO.getNetworkAddress())
+                .eqIfPresent(YfDeviceDO::getNetworkIp, reqVO.getNetworkIp())
+                .eqIfPresent(YfDeviceDO::getLongitude, reqVO.getLongitude())
+                .eqIfPresent(YfDeviceDO::getLatitude, reqVO.getLatitude())
+                .betweenIfPresent(YfDeviceDO::getActiveTime, reqVO.getActiveTime())
+                .eqIfPresent(YfDeviceDO::getSummary, reqVO.getSummary())
+                .eqIfPresent(YfDeviceDO::getImgUrl, reqVO.getImgUrl())
+                .eqIfPresent(YfDeviceDO::getDelFlag, reqVO.getDelFlag())
+                .eqIfPresent(YfDeviceDO::getCreateBy, reqVO.getCreateBy())
+                .betweenIfPresent(YfDeviceDO::getCreateTime, reqVO.getCreateTime())
+                .eqIfPresent(YfDeviceDO::getUpdateBy, reqVO.getUpdateBy())
+                .eqIfPresent(YfDeviceDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(YfDeviceDO::getIsSimulate, reqVO.getIsSimulate())
+                .eqIfPresent(YfDeviceDO::getSlaveId, reqVO.getSlaveId())
+                .eqIfPresent(YfDeviceDO::getClientId, reqVO.getClientId())
+                .eqIfPresent(YfDeviceDO::getPostDev, reqVO.getPostDev())
+                .eqIfPresent(YfDeviceDO::getGetDev, reqVO.getGetDev())
+                .eqIfPresent(YfDeviceDO::getMqttstats, reqVO.getMqttstats())
+                .orderByDesc(YfDeviceDO::getCreateTime));
+    }
+
+}

+ 0 - 54
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/DeviceService.java

@@ -1,54 +0,0 @@
-package cn.iocoder.yudao.module.pms.service.yanfan;
-
-import java.util.*;
-import javax.validation.*;
-import cn.iocoder.yudao.module.iot.dal.dataobject.device.DeviceDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-
-/**
- * 设备 Service 接口
- *
- * @author 李鹏辉
- */
-public interface DeviceService {
-
-    /**
-     * 创建设备
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    Long createDevice(@Valid DeviceSaveReqVO createReqVO);
-
-    /**
-     * 更新设备
-     *
-     * @param updateReqVO 更新信息
-     */
-    void updateDevice(@Valid DeviceSaveReqVO updateReqVO);
-
-    /**
-     * 删除设备
-     *
-     * @param id 编号
-     */
-    void deleteDevice(Long id);
-
-    /**
-     * 获得设备
-     *
-     * @param id 编号
-     * @return 设备
-     */
-    DeviceDO getDevice(Long id);
-
-    /**
-     * 获得设备分页
-     *
-     * @param pageReqVO 分页查询
-     * @return 设备分页
-     */
-    PageResult<DeviceDO> getDevicePage(DevicePageReqVO pageReqVO);
-
-}

+ 0 - 73
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/DeviceServiceImpl.java

@@ -1,73 +0,0 @@
-package cn.iocoder.yudao.module.iot.service.device;
-
-import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.DeviceMapper;
-import cn.iocoder.yudao.module.pms.service.yanfan.DeviceService;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import cn.iocoder.yudao.module.iot.dal.dataobject.device.DeviceDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-
-
-import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-
-/**
- * 设备 Service 实现类
- *
- * @author 李鹏辉
- */
-@Service
-@Validated
-public class DeviceServiceImpl implements DeviceService {
-
-    @Resource
-    private DeviceMapper deviceMapper;
-
-    @Override
-    public Long createDevice(cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceSaveReqVO createReqVO) {
-        // 插入
-        DeviceDO device = BeanUtils.toBean(createReqVO, DeviceDO.class);
-        deviceMapper.insert(device);
-        // 返回
-        return device.getId();
-    }
-
-    @Override
-    public void updateDevice(cn.iocoder.yudao.module.iot.controller.admin.device.vo.DeviceSaveReqVO updateReqVO) {
-        // 校验存在
-        validateDeviceExists(updateReqVO.getId());
-        // 更新
-        DeviceDO updateObj = BeanUtils.toBean(updateReqVO, DeviceDO.class);
-        deviceMapper.updateById(updateObj);
-    }
-
-    @Override
-    public void deleteDevice(Long id) {
-        // 校验存在
-        validateDeviceExists(id);
-        // 删除
-        deviceMapper.deleteById(id);
-    }
-
-    private void validateDeviceExists(Long id) {
-        if (deviceMapper.selectById(id) == null) {
-            throw exception(DEVICE_NOT_EXISTS);
-        }
-    }
-
-    @Override
-    public DeviceDO getDevice(Long id) {
-        return deviceMapper.selectById(id);
-    }
-
-    @Override
-    public PageResult<DeviceDO> getDevicePage(cn.iocoder.yudao.module.iot.controller.admin.device.vo.DevicePageReqVO pageReqVO) {
-        return deviceMapper.selectPage(pageReqVO);
-    }
-
-}

+ 30 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/YfDeviceService.java

@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.pms.service.yanfan;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.yanfan.vo.DevicePageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
+
+/**
+ * 设备 Service 接口
+ *
+ * @author 李鹏辉
+ */
+public interface YfDeviceService {
+
+    /**
+     * 获得设备
+     *
+     * @param id 编号
+     * @return 设备
+     */
+    YfDeviceDO getDevice(Long id);
+
+    /**
+     * 获得设备分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 设备分页
+     */
+    PageResult<YfDeviceDO> getDevicePage(DevicePageReqVO pageReqVO);
+
+}

+ 34 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/yanfan/YfDeviceServiceImpl.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.pms.service.yanfan;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.pms.controller.admin.yanfan.vo.DevicePageReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.yanfan.YfDeviceMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+/**
+ * 设备 Service 实现类
+ *
+ * @author 李鹏辉
+ */
+@Service
+@Validated
+public class YfDeviceServiceImpl implements YfDeviceService {
+
+    @Resource
+    private YfDeviceMapper deviceMapper;
+
+    @Override
+    public YfDeviceDO getDevice(Long id) {
+        return deviceMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<YfDeviceDO> getDevicePage(DevicePageReqVO pageReqVO) {
+        return deviceMapper.selectPage(pageReqVO);
+    }
+
+}