diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/test/alibaba/WorkOrderSimpleTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/AlibabaWorkOrderMapperTest.java similarity index 91% rename from jeelowcode-admin/src/test/java/com/jeelowcode/test/alibaba/WorkOrderSimpleTest.java rename to jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/AlibabaWorkOrderMapperTest.java index 7f5c5f9..51815e7 100644 --- a/jeelowcode-admin/src/test/java/com/jeelowcode/test/alibaba/WorkOrderSimpleTest.java +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/AlibabaWorkOrderMapperTest.java @@ -1,17 +1,16 @@ -package com.jeelowcode.test.alibaba; +package com.jeelowcode.module.biz.mapper; import cn.hutool.core.util.IdUtil; import cn.hutool.db.sql.SqlUtil; import com.jeelowcode.module.biz.entity.AlibabaWorkOrder; import com.jeelowcode.module.biz.job.AlibabaWorkOrderJob; -import com.jeelowcode.module.biz.mapper.AlibabaWorkOrderMapper; import com.jeelowcode.tool.framework.test.core.ut.BaseDbAndRedisUnitTest; import org.junit.jupiter.api.Test; import javax.annotation.Resource; import java.time.LocalDateTime; -public class WorkOrderSimpleTest extends BaseDbAndRedisUnitTest { +public class AlibabaWorkOrderMapperTest extends BaseDbAndRedisUnitTest { @Resource private AlibabaWorkOrderMapper baseMapper; @@ -47,7 +46,6 @@ public class WorkOrderSimpleTest extends BaseDbAndRedisUnitTest { .setGmtRelateModified(LocalDateTime.now()) .setGmtRelateSubModified(LocalDateTime.now()); baseMapper.insert(workOrder); - } } diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcBuildingMapperTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcBuildingMapperTest.java new file mode 100644 index 0000000..8ab4ad4 --- /dev/null +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcBuildingMapperTest.java @@ -0,0 +1,146 @@ +package com.jeelowcode.module.biz.mapper; + +import cn.hutool.core.util.IdUtil; +import com.jeelowcode.module.biz.entity.LcBuildingEntity; +import com.jeelowcode.tool.framework.test.core.ut.BaseDbUnitTest; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link LcBuildingMapper} 的单元测试类 + */ +@Import(LcBuildingMapper.class) +public class LcBuildingMapperTest extends BaseDbUnitTest { + + @Resource + private LcBuildingMapper lcBuildingMapper; + + @Test + public void testInsert() { + // 准备数据 + LcBuildingEntity entity = new LcBuildingEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + + // 执行插入 + int insertCount = lcBuildingMapper.insert(entity); + assertEquals(1, insertCount); + + // 验证插入结果 + LcBuildingEntity result = lcBuildingMapper.selectById(entity.getId()); + assertNotNull(result); + assertEquals("测试楼宇", result.getBuildingName()); + assertEquals("测试园区", result.getCampusName()); + } + + @Test + public void testSelectList() { + // 准备数据 + LcBuildingEntity entity1 = new LcBuildingEntity(); + entity1.setId(IdUtil.getSnowflakeNextId()); + entity1.setBuildingId("BUILDING_001"); + entity1.setBuildingName("测试楼宇1"); + entity1.setCampusId("CAMPUS_001"); + entity1.setCampusName("测试园区1"); + entity1.setTenantId(1L); + entity1.setCreateUser(1L); + entity1.setCreateTime(LocalDateTime.now()); + entity1.setCreateDept(1L); + entity1.setUpdateUser(1L); + entity1.setUpdateTime(LocalDateTime.now()); + entity1.setIsDeleted(0); + lcBuildingMapper.insert(entity1); + + LcBuildingEntity entity2 = new LcBuildingEntity(); + entity2.setId(IdUtil.getSnowflakeNextId()); + entity2.setBuildingId("BUILDING_002"); + entity2.setBuildingName("测试楼宇2"); + entity2.setCampusId("CAMPUS_001"); + entity2.setCampusName("测试园区1"); + entity2.setTenantId(1L); + entity2.setCreateUser(1L); + entity2.setCreateTime(LocalDateTime.now()); + entity2.setCreateDept(1L); + entity2.setUpdateUser(1L); + entity2.setUpdateTime(LocalDateTime.now()); + entity2.setIsDeleted(0); + lcBuildingMapper.insert(entity2); + + // 执行查询 + List result = lcBuildingMapper.selectList(null); + + // 验证查询结果 + assertNotNull(result); + } + + @Test + public void testUpdate() { + // 准备数据 + LcBuildingEntity entity = new LcBuildingEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcBuildingMapper.insert(entity); + + // 执行更新 + entity.setBuildingName("更新后的楼宇名称"); + int updateCount = lcBuildingMapper.updateById(entity); + assertEquals(1, updateCount); + + // 验证更新结果 + LcBuildingEntity result = lcBuildingMapper.selectById(entity.getId()); + assertEquals("更新后的楼宇名称", result.getBuildingName()); + } + + @Test + public void testDelete() { + // 准备数据 + LcBuildingEntity entity = new LcBuildingEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcBuildingMapper.insert(entity); + + // 执行删除 + int deleteCount = lcBuildingMapper.deleteById(entity.getId()); + assertEquals(1, deleteCount); + + // 验证删除结果 + LcBuildingEntity result = lcBuildingMapper.selectById(entity.getId()); + assertNull(result); + } +} \ No newline at end of file diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java new file mode 100644 index 0000000..97d64df --- /dev/null +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapperTest.java @@ -0,0 +1,153 @@ +package com.jeelowcode.module.biz.mapper; + +import cn.hutool.core.util.IdUtil; +import com.jeelowcode.module.biz.entity.LcPowerEnvDeviceEntity; +import com.jeelowcode.tool.framework.test.core.ut.BaseDbUnitTest; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link LcPowerEnvDeviceMapper} 的单元测试类 + */ +@Import(LcPowerEnvDeviceMapper.class) +public class LcPowerEnvDeviceMapperTest extends BaseDbUnitTest { + + @Resource + private LcPowerEnvDeviceMapper lcPowerEnvDeviceMapper; + + @Test + public void testInsert() { + // 准备数据 + LcPowerEnvDeviceEntity entity = new LcPowerEnvDeviceEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setDeviceCode("DEVICE_CODE_001"); + entity.setDeviceTypeCode("TYPE_001"); + entity.setDeviceTypeName("温度传感器"); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setMonitorData("{\"temperature\": 25.6}"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + + // 执行插入 + int insertCount = lcPowerEnvDeviceMapper.insert(entity); + assertEquals(1, insertCount); + + // 验证插入结果 + LcPowerEnvDeviceEntity result = lcPowerEnvDeviceMapper.selectById(entity.getId()); + assertNotNull(result); + assertEquals("DEVICE_UID_001", result.getDeviceUid()); + assertEquals("温度传感器", result.getDeviceTypeName()); + } + + @Test + public void testSelectById() { + // 准备数据 + LcPowerEnvDeviceEntity entity = new LcPowerEnvDeviceEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setDeviceCode("DEVICE_CODE_001"); + entity.setDeviceTypeCode("TYPE_001"); + entity.setDeviceTypeName("温度传感器"); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setMonitorData("{\"temperature\": 25.6}"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvDeviceMapper.insert(entity); + + // 执行查询 + LcPowerEnvDeviceEntity result = lcPowerEnvDeviceMapper.selectById(entity.getId()); + + // 验证查询结果 + assertNotNull(result); + assertEquals("DEVICE_UID_001", result.getDeviceUid()); + assertEquals("温度传感器", result.getDeviceTypeName()); + assertEquals("测试楼宇", result.getBuildingName()); + } + + @Test + public void testUpdate() { + // 准备数据 + LcPowerEnvDeviceEntity entity = new LcPowerEnvDeviceEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setDeviceCode("DEVICE_CODE_001"); + entity.setDeviceTypeCode("TYPE_001"); + entity.setDeviceTypeName("温度传感器"); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setMonitorData("{\"temperature\": 25.6}"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvDeviceMapper.insert(entity); + + // 执行更新 + entity.setDeviceTypeName("湿度传感器"); + int updateCount = lcPowerEnvDeviceMapper.updateById(entity); + assertEquals(1, updateCount); + + // 验证更新结果 + LcPowerEnvDeviceEntity result = lcPowerEnvDeviceMapper.selectById(entity.getId()); + assertEquals("湿度传感器", result.getDeviceTypeName()); + } + + @Test + public void testDelete() { + // 准备数据 + LcPowerEnvDeviceEntity entity = new LcPowerEnvDeviceEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setDeviceCode("DEVICE_CODE_001"); + entity.setDeviceTypeCode("TYPE_001"); + entity.setDeviceTypeName("温度传感器"); + entity.setBuildingId("BUILDING_001"); + entity.setBuildingName("测试楼宇"); + entity.setCampusId("CAMPUS_001"); + entity.setCampusName("测试园区"); + entity.setMonitorData("{\"temperature\": 25.6}"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvDeviceMapper.insert(entity); + + // 执行删除 + int deleteCount = lcPowerEnvDeviceMapper.deleteById(entity.getId()); + assertEquals(1, deleteCount); + + // 验证删除结果 + LcPowerEnvDeviceEntity result = lcPowerEnvDeviceMapper.selectById(entity.getId()); + assertNull(result); + } +} \ No newline at end of file diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapperTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapperTest.java new file mode 100644 index 0000000..fce7a70 --- /dev/null +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapperTest.java @@ -0,0 +1,166 @@ +package com.jeelowcode.module.biz.mapper; + +import cn.hutool.core.util.IdUtil; +import com.jeelowcode.module.biz.entity.LcPowerEnvMonitorMetricEntity; +import com.jeelowcode.tool.framework.test.core.ut.BaseDbUnitTest; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link LcPowerEnvMonitorMetricMapper} 的单元测试类 + */ +@Import(LcPowerEnvMonitorMetricMapper.class) +public class LcPowerEnvMonitorMetricMapperTest extends BaseDbUnitTest { + + @Resource + private LcPowerEnvMonitorMetricMapper lcPowerEnvMonitorMetricMapper; + + @Test + public void testInsert() { + // 准备数据 + LcPowerEnvMonitorMetricEntity entity = new LcPowerEnvMonitorMetricEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setMetadataUid("METADATA_UID_001"); + entity.setMetadataCode("METADATA_CODE_001"); + entity.setMetadataName("温度"); + entity.setPropertyCode("PROPERTY_TEMP"); + entity.setPropertyName("温度值"); + entity.setUnitCode("℃"); + entity.setValueType(1); + entity.setValueTypeName("数值型"); + entity.setPointType(1); + entity.setPointTypeName("模拟量"); + entity.setMetricValue("26.5"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + + // 执行插入 + int insertCount = lcPowerEnvMonitorMetricMapper.insert(entity); + assertEquals(1, insertCount); + + // 验证插入结果 + LcPowerEnvMonitorMetricEntity result = lcPowerEnvMonitorMetricMapper.selectById(entity.getId()); + assertNotNull(result); + assertEquals("DEVICE_UID_001", result.getDeviceUid()); + assertEquals("26.5", result.getMetricValue()); + assertEquals("℃", result.getUnitCode()); + } + + @Test + public void testSelectById() { + // 准备数据 + LcPowerEnvMonitorMetricEntity entity = new LcPowerEnvMonitorMetricEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setMetadataUid("METADATA_UID_001"); + entity.setMetadataCode("METADATA_CODE_001"); + entity.setMetadataName("温度"); + entity.setPropertyCode("PROPERTY_TEMP"); + entity.setPropertyName("温度值"); + entity.setUnitCode("℃"); + entity.setValueType(1); + entity.setValueTypeName("数值型"); + entity.setPointType(1); + entity.setPointTypeName("模拟量"); + entity.setMetricValue("26.5"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvMonitorMetricMapper.insert(entity); + + // 执行查询 + LcPowerEnvMonitorMetricEntity result = lcPowerEnvMonitorMetricMapper.selectById(entity.getId()); + + // 验证查询结果 + assertNotNull(result); + assertEquals("温度", result.getMetadataName()); + assertEquals("温度值", result.getPropertyName()); + assertEquals(1, result.getValueType()); + } + + @Test + public void testUpdate() { + // 准备数据 + LcPowerEnvMonitorMetricEntity entity = new LcPowerEnvMonitorMetricEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setMetadataUid("METADATA_UID_001"); + entity.setMetadataCode("METADATA_CODE_001"); + entity.setMetadataName("温度"); + entity.setPropertyCode("PROPERTY_TEMP"); + entity.setPropertyName("温度值"); + entity.setUnitCode("℃"); + entity.setValueType(1); + entity.setValueTypeName("数值型"); + entity.setPointType(1); + entity.setPointTypeName("模拟量"); + entity.setMetricValue("26.5"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvMonitorMetricMapper.insert(entity); + + // 执行更新 + entity.setMetricValue("27.8"); + int updateCount = lcPowerEnvMonitorMetricMapper.updateById(entity); + assertEquals(1, updateCount); + + // 验证更新结果 + LcPowerEnvMonitorMetricEntity result = lcPowerEnvMonitorMetricMapper.selectById(entity.getId()); + assertEquals("27.8", result.getMetricValue()); + } + + @Test + public void testDelete() { + // 准备数据 + LcPowerEnvMonitorMetricEntity entity = new LcPowerEnvMonitorMetricEntity(); + entity.setId(IdUtil.getSnowflakeNextId()); + entity.setDeviceUid("DEVICE_UID_001"); + entity.setMetadataUid("METADATA_UID_001"); + entity.setMetadataCode("METADATA_CODE_001"); + entity.setMetadataName("温度"); + entity.setPropertyCode("PROPERTY_TEMP"); + entity.setPropertyName("温度值"); + entity.setUnitCode("℃"); + entity.setValueType(1); + entity.setValueTypeName("数值型"); + entity.setPointType(1); + entity.setPointTypeName("模拟量"); + entity.setMetricValue("26.5"); + entity.setTenantId(1L); + entity.setCreateUser(1L); + entity.setCreateTime(LocalDateTime.now()); + entity.setCreateDept(1L); + entity.setUpdateUser(1L); + entity.setUpdateTime(LocalDateTime.now()); + entity.setIsDeleted(0); + lcPowerEnvMonitorMetricMapper.insert(entity); + + // 执行删除 + int deleteCount = lcPowerEnvMonitorMetricMapper.deleteById(entity.getId()); + assertEquals(1, deleteCount); + + // 验证删除结果 + LcPowerEnvMonitorMetricEntity result = lcPowerEnvMonitorMetricMapper.selectById(entity.getId()); + assertNull(result); + } +} \ No newline at end of file diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/test/json/JsonUtilsTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/test/json/JsonUtilsTest.java deleted file mode 100644 index 01e476d..0000000 --- a/jeelowcode-admin/src/test/java/com/jeelowcode/test/json/JsonUtilsTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.jeelowcode.test.json; - -import cn.hutool.json.JSONUtil; -import com.jeelowcode.service.bpm.config.framework.portal.core.dto.ReceiveRequestInfoDTO; -import com.jeelowcode.tool.framework.common.util.json.JsonUtils; -import com.jeelowcode.tool.framework.test.core.ut.BaseMockitoUnitTest; -import org.junit.Test; - -import java.util.Date; - -/** - * 描述:Json工具类测试 - * - * @author shelly - */ -public class JsonUtilsTest extends BaseMockitoUnitTest { - - @Test - public void testJsonToString() { - ReceiveRequestInfoDTO requestDTO = new ReceiveRequestInfoDTO() - .setCreateDateTime(new Date()) - .setReceiveDateTime(new Date()); - System.out.println(JsonUtils.toJsonString(requestDTO)); - System.out.println(JSONUtil.toJsonStr(requestDTO)); - } - -} diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/test/master/MasterUserSyncTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/test/master/MasterUserSyncTest.java deleted file mode 100644 index 6b4b919..0000000 --- a/jeelowcode-admin/src/test/java/com/jeelowcode/test/master/MasterUserSyncTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.jeelowcode.test.master; - -import cn.hutool.core.util.StrUtil; -import com.jeelowcode.tool.framework.test.core.ut.BaseMockitoUnitTest; -import org.junit.jupiter.api.Test; - -public class MasterUserSyncTest extends BaseMockitoUnitTest { - - @Test - public void testStringFormat() { - String description = "测试"; - System.out.println(StrUtil.format("备注:{}", description)); - } - -} diff --git a/jeelowcode-admin/src/test/java/com/jeelowcode/test/sql/GenerateLastExecuteSQLTest.java b/jeelowcode-admin/src/test/java/com/jeelowcode/tool/framework/common/util/SqlUtilsTest.java similarity index 96% rename from jeelowcode-admin/src/test/java/com/jeelowcode/test/sql/GenerateLastExecuteSQLTest.java rename to jeelowcode-admin/src/test/java/com/jeelowcode/tool/framework/common/util/SqlUtilsTest.java index e179479..daaab79 100644 --- a/jeelowcode-admin/src/test/java/com/jeelowcode/test/sql/GenerateLastExecuteSQLTest.java +++ b/jeelowcode-admin/src/test/java/com/jeelowcode/tool/framework/common/util/SqlUtilsTest.java @@ -1,4 +1,4 @@ -package com.jeelowcode.test.sql; +package com.jeelowcode.tool.framework.common.util; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; @@ -18,7 +18,7 @@ import java.util.stream.Collectors; * * @author shelly */ -public class GenerateLastExecuteSQLTest extends BaseMockitoUnitTest { +public class SqlUtilsTest extends BaseMockitoUnitTest { @Test public void testGenerateLastExecuteSQL() throws Exception { diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcBuildingEntity.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcBuildingEntity.java new file mode 100644 index 0000000..5b27b80 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcBuildingEntity.java @@ -0,0 +1,49 @@ +package com.jeelowcode.module.biz.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.jeelowcode.framework.utils.model.global.BaseTenantEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 楼宇点位信息表 + * + * @author yangchenjj + */ +@Data +@EqualsAndHashCode +@TableName("lc_building") +public class LcBuildingEntity extends BaseTenantEntity { + + /** + * 主键 + */ + @JsonSerialize(using = ToStringSerializer.class) + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 楼宇编号 + */ + private String buildingId; + + /** + * 楼宇名称 + */ + private String buildingName; + + /** + * 园区编号 + */ + private String campusId; + + /** + * 园区名称 + */ + private String campusName; + +} diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java new file mode 100644 index 0000000..b80673b --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvDeviceEntity.java @@ -0,0 +1,74 @@ +package com.jeelowcode.module.biz.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.jeelowcode.framework.utils.model.global.BaseTenantEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动环设备信息表 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode +@TableName("lc_power_env_device") +public class LcPowerEnvDeviceEntity extends BaseTenantEntity { + + /** + * 主键 + */ + @JsonSerialize(using = ToStringSerializer.class) + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 动环编号 + */ + private String deviceUid; + + /** + * 设备编号 + */ + private String deviceCode; + + /** + * 设备类型编号 + */ + private String deviceTypeCode; + + /** + * 设备类型名称 + */ + private String deviceTypeName; + + /** + * 楼宇编号 + */ + private String buildingId; + + /** + * 楼宇名称 + */ + private String buildingName; + + /** + * 园区编号 + */ + private String campusId; + + /** + * 园区名称 + */ + private String campusName; + + /** + * 最新监控数据 + */ + private String monitorData; + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvMonitorMetricEntity.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvMonitorMetricEntity.java new file mode 100644 index 0000000..6145fdd --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/entity/LcPowerEnvMonitorMetricEntity.java @@ -0,0 +1,89 @@ +package com.jeelowcode.module.biz.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.jeelowcode.framework.utils.model.global.BaseTenantEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动环设备监控指标信息 + * + * @author ruoyi + */ +@Data +@EqualsAndHashCode +@TableName("lc_power_env_monitor_metric") +public class LcPowerEnvMonitorMetricEntity extends BaseTenantEntity { + + /** + * 主键 + */ + @JsonSerialize(using = ToStringSerializer.class) + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 设备动环编号 + */ + private String deviceUid; + + /** + * 元数据动环编号 + */ + private String metadataUid; + + /** + * 元数据编码 + */ + private String metadataCode; + + /** + * 元数据名称 + */ + private String metadataName; + + /** + * 属性编码 + */ + private String propertyCode; + + /** + * 属性名称 + */ + private String propertyName; + + /** + * 计量单位 + */ + private String unitCode; + + /** + * 数值类型 + */ + private Integer valueType; + + /** + * 数值类型名称 + */ + private String valueTypeName; + + /** + * 点位类型 + */ + private Integer pointType; + + /** + * 点位类型名称 + */ + private String pointTypeName; + + /** + * 指标值 + */ + private String metricValue; + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcBuildingMapper.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcBuildingMapper.java new file mode 100644 index 0000000..442a200 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcBuildingMapper.java @@ -0,0 +1,15 @@ +package com.jeelowcode.module.biz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jeelowcode.module.biz.entity.LcBuildingEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 楼宇点位信息 Mapper + * + * @author yangchenjj + */ +@Mapper +public interface LcBuildingMapper extends BaseMapper { + +} diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapper.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapper.java new file mode 100644 index 0000000..5737a48 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvDeviceMapper.java @@ -0,0 +1,15 @@ +package com.jeelowcode.module.biz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jeelowcode.module.biz.entity.LcPowerEnvDeviceEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 动环设备信息 Mapper + * + * @author ruoyi + */ +@Mapper +public interface LcPowerEnvDeviceMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapper.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapper.java new file mode 100644 index 0000000..a484e02 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/mapper/LcPowerEnvMonitorMetricMapper.java @@ -0,0 +1,15 @@ +package com.jeelowcode.module.biz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jeelowcode.module.biz.entity.LcPowerEnvMonitorMetricEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 动环设备监控指标信息 Mapper + * + * @author ruoyi + */ +@Mapper +public interface LcPowerEnvMonitorMetricMapper extends BaseMapper { + +} diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcBuildingService.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcBuildingService.java new file mode 100644 index 0000000..e7aa1df --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcBuildingService.java @@ -0,0 +1,10 @@ +package com.jeelowcode.module.biz.service; + +/** + * 楼宇点位信息服务接口 + * + * @author ruoyi + */ +public interface ILcBuildingService { + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvDeviceService.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvDeviceService.java new file mode 100644 index 0000000..2db4bc8 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvDeviceService.java @@ -0,0 +1,10 @@ +package com.jeelowcode.module.biz.service; + +/** + * 动环设备信息服务接口 + * + * @author ruoyi + */ +public interface ILcPowerEnvDeviceService { + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvMonitorMetricService.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvMonitorMetricService.java new file mode 100644 index 0000000..b5150b8 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/ILcPowerEnvMonitorMetricService.java @@ -0,0 +1,10 @@ +package com.jeelowcode.module.biz.service; + +/** + * 动环设备监控指标信息服务接口 + * + * @author ruoyi + */ +public interface ILcPowerEnvMonitorMetricService { + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcBuildingServiceImpl.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcBuildingServiceImpl.java new file mode 100644 index 0000000..9a47bd7 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcBuildingServiceImpl.java @@ -0,0 +1,16 @@ +package com.jeelowcode.module.biz.service.impl; + +import com.jeelowcode.module.biz.service.ILcBuildingService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 楼宇点位信息服务实现类 + * + * @author ruoyi + */ +@Slf4j +@Service +public class LcBuildingServiceImpl implements ILcBuildingService { + +} diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvDeviceServiceImpl.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvDeviceServiceImpl.java new file mode 100644 index 0000000..b59d572 --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvDeviceServiceImpl.java @@ -0,0 +1,16 @@ +package com.jeelowcode.module.biz.service.impl; + +import com.jeelowcode.module.biz.service.ILcPowerEnvDeviceService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 动环设备信息服务实现类 + * + * @author ruoyi + */ +@Slf4j +@Service +public class LcPowerEnvDeviceServiceImpl implements ILcPowerEnvDeviceService { + +} \ No newline at end of file diff --git a/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvMonitorMetricServiceImpl.java b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvMonitorMetricServiceImpl.java new file mode 100644 index 0000000..e4e2d5c --- /dev/null +++ b/jeelowcode-module/jeelowcode-module-biz/src/main/java/com/jeelowcode/module/biz/service/impl/LcPowerEnvMonitorMetricServiceImpl.java @@ -0,0 +1,16 @@ +package com.jeelowcode.module.biz.service.impl; + +import com.jeelowcode.module.biz.service.ILcPowerEnvMonitorMetricService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * 动环设备监控指标信息服务实现类 + * + * @author ruoyi + */ +@Slf4j +@Service +public class LcPowerEnvMonitorMetricServiceImpl implements ILcPowerEnvMonitorMetricService { + +} \ No newline at end of file