diff --git a/src/main/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapper.java b/src/main/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapper.java new file mode 100644 index 00000000..7e1fc286 --- /dev/null +++ b/src/main/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapper.java @@ -0,0 +1,40 @@ +package com.cmcc.hy.phoenix.mapper; + +import com.cmcc.hy.phoenix.pojo.entity.DisposeDevice; +import com.cmcc.hy.phoenix.pojo.entity.InfoCollection; +import com.cmcc.hy.phoenix.pojo.po.DeviceCapacityInfo; +import tk.mybatis.mapper.common.IdsMapper; +import tk.mybatis.mapper.common.Mapper; +import com.cmcc.hy.phoenix.pojo.entity.DisposeTask; +import tk.mybatis.mapper.common.MySqlMapper; + +import java.util.List; + +public interface DisposeTaskMapper extends Mapper, + MySqlMapper { + + /** + * 获取所有处置任务 + * + * @return the all + */ + List getAllDisposeTask(); + + /** + * 获取所有处置任务唯一编号 + */ + List getAllTaskId(); + + /** + * 通过处置任务唯一编号获取设备唯一标识符 + */ + Long getDeviceIdByTaskId(); + + /** + * 通过设备唯一标识符获取处置任务唯一编号 + */ + Long getTaskIdByDeviceId(); +} + + + diff --git a/src/main/java/com/cmcc/hy/phoenix/pojo/entity/DisposeTask.java b/src/main/java/com/cmcc/hy/phoenix/pojo/entity/DisposeTask.java new file mode 100644 index 00000000..b69262fb --- /dev/null +++ b/src/main/java/com/cmcc/hy/phoenix/pojo/entity/DisposeTask.java @@ -0,0 +1,70 @@ +package com.cmcc.hy.phoenix.pojo.entity; + +import lombok.*; +import tk.mybatis.mapper.annotation.NameStyle; +import tk.mybatis.mapper.code.Style; + +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; + + +/** + * The type Dispose task. + */ +@Getter +@Setter +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Table(name = "dispose_task") +@NameStyle(Style.normal) +public class DisposeTask implements Serializable { + /** + * 处置任务唯一编号 + */ + @Id + //@KeySql(useGeneratedKeys = true) + private Long id; + + /** + * 设备唯一标识符 + */ + private Integer deviceId; + + /** + * 用户ID + */ + private Long accountId; + + /** + * 设备能力唯一标识符 + */ + private Long capacityId; + + /** + * 处置IP地址,A.B.C.D格式 + */ + private String disposeIp; + + /** + * 任务开始时间. + */ + private String beginTime; + + /** + * 任务计划结束时间 + */ + private String planEndTime; + + /** + * 任务结束时间 + */ + private String endTime; + + /** + * 任务状态 0:成功;其它:失败原因 + */ + private Integer status; +} diff --git a/src/main/resources/mappers/DisposeTaskManager.xml b/src/main/resources/mappers/DisposeTaskManager.xml new file mode 100644 index 00000000..687a4a7a --- /dev/null +++ b/src/main/resources/mappers/DisposeTaskManager.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + diff --git a/src/test/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapperTest.java b/src/test/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapperTest.java new file mode 100644 index 00000000..b882579b --- /dev/null +++ b/src/test/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapperTest.java @@ -0,0 +1,39 @@ +package com.cmcc.hy.phoenix.mapper; + +import com.cmcc.hy.phoenix.pojo.entity.DisposeTask; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.annotation.Resource; +import java.util.List; + +@RunWith(SpringRunner.class) +@SpringBootTest +@EnableTransactionManagement +@Slf4j +public class DisposeTaskMapperTest { + @Autowired + private ObjectMapper objMapper; + + @Resource + private DisposeTaskMapper disposeTaskMapper; + + + @Test + public void getAllDisposeTask() throws JsonProcessingException { + List dp = disposeTaskMapper.getAllDisposeTask(); + + log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dp)); + + Assert.assertNotEquals(dp.size(), 0); + } + +}