REM:
1. 添加查询所有清洗任务接口
This commit is contained in:
chenlinghy 2020-04-15 11:19:21 +08:00
parent 693536fd0e
commit a217dad8ec
4 changed files with 179 additions and 0 deletions

View File

@ -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<DisposeTask>,
MySqlMapper<DisposeTask> {
/**
* 获取所有处置任务
*
* @return the all
*/
List<DisposeTask> getAllDisposeTask();
/**
* 获取所有处置任务唯一编号
*/
List<Long> getAllTaskId();
/**
* 通过处置任务唯一编号获取设备唯一标识符
*/
Long getDeviceIdByTaskId();
/**
* 通过设备唯一标识符获取处置任务唯一编号
*/
Long getTaskIdByDeviceId();
}

View File

@ -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;
}

View File

@ -0,0 +1,30 @@
<?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.cmcc.hy.phoenix.mapper.DisposeTaskMapper">
<!-- mapper xml文件中只编写复杂逻辑的SQL SQL单独拿出来写与代码解耦SQL的熟练编写是每个研发必备的技能 -->
<resultMap id="getAllDisposeTaskMap" type="com.cmcc.hy.phoenix.pojo.entity.DisposeTask">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="deviceId" property="deviceId" jdbcType="INTEGER"/>
<result column="accountId" property="accountId" jdbcType="INTEGER"/>
<result column="capacityId" property="capacityId" jdbcType="INTEGER"/>
<result column="disposeIp" property="disposeIp" jdbcType="VARCHAR"/>
<result column="beginTime" property="beginTime" jdbcType="VARCHAR"/>
<result column="planEndTime" property="planEndTime" jdbcType="VARCHAR"/>
<result column="endTime" property="endTime" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/>
</resultMap>
<select id="getAllDisposeTask" resultMap="getAllDisposeTaskMap">
SELECT
id,
deviceId,
accountId,
capacityId,
disposeIp,
beginTime,
planEndTime,
endTime,
status
FROM
dispose_task
</select>
</mapper>

View File

@ -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<DisposeTask> dp = disposeTaskMapper.getAllDisposeTask();
log.info(objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dp));
Assert.assertNotEquals(dp.size(), 0);
}
}