From a217dad8ec330d92523288a873cb6a53dc258713 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 15 Apr 2020 11:19:21 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E6=B7=BB=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=89=80=E6=9C=89=E6=B8=85=E6=B4=97=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hy/phoenix/mapper/DisposeTaskMapper.java | 40 +++++++++++ .../hy/phoenix/pojo/entity/DisposeTask.java | 70 +++++++++++++++++++ .../resources/mappers/DisposeTaskManager.xml | 30 ++++++++ .../phoenix/mapper/DisposeTaskMapperTest.java | 39 +++++++++++ 4 files changed, 179 insertions(+) create mode 100644 src/main/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapper.java create mode 100644 src/main/java/com/cmcc/hy/phoenix/pojo/entity/DisposeTask.java create mode 100644 src/main/resources/mappers/DisposeTaskManager.xml create mode 100644 src/test/java/com/cmcc/hy/phoenix/mapper/DisposeTaskMapperTest.java 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); + } + +}