OCT
REM: 1. 增加taskinfo mapper测试代码 2. 修正task_info数据库无法插入任务记录问题
This commit is contained in:
parent
c839eaaf25
commit
ba55564739
|
@ -2,21 +2,30 @@ package com.dispose.mapper;
|
|||
|
||||
|
||||
import com.dispose.pojo.vo.common.TaskInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
import tk.mybatis.mapper.common.MySqlMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Task info mapper.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public interface TaskInfoMapper {
|
||||
public interface TaskInfoMapper extends Mapper<TaskInfo>, MySqlMapper<TaskInfo> {
|
||||
/**
|
||||
* Add new task info.
|
||||
*
|
||||
* @param taskId the task id
|
||||
* @param deviceId the device id
|
||||
* @param externId the extern id
|
||||
* @param status the status
|
||||
*/
|
||||
void addNewTaskInfo(Long taskId, Long deviceId, Long externId, Long status);
|
||||
void addNewTaskInfo(@Param("taskId") Long taskId,
|
||||
@Param("deviceId") Long deviceId,
|
||||
@Param("externId") Long externId,
|
||||
@Param("status") Long status);
|
||||
|
||||
/**
|
||||
* Gets task info.
|
||||
|
@ -25,7 +34,7 @@ public interface TaskInfoMapper {
|
|||
* @param deviceId the device id
|
||||
* @return the task info
|
||||
*/
|
||||
TaskInfo getTaskInfo(Long taskId, Long deviceId);
|
||||
List<TaskInfo> getTaskInfo(Long taskId, Long deviceId);
|
||||
|
||||
/**
|
||||
* Gets task info by task id.
|
||||
|
@ -33,7 +42,7 @@ public interface TaskInfoMapper {
|
|||
* @param taskId the task id
|
||||
* @return the task info by task id
|
||||
*/
|
||||
TaskInfo getTaskInfoByTaskId(Long taskId);
|
||||
List<TaskInfo> getTaskInfoByTaskId(Long taskId);
|
||||
|
||||
/**
|
||||
* Change task info status.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?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.dispose.mapper.TaskInfoMapper">
|
||||
<insert id="addNewTaskInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="addNewTaskInfo">
|
||||
INSERT IGNORE INTO task_info(taskId, deviceId, externId, status)
|
||||
VALUES (#{taskId}, #{deviceId}, #{externId}, #{status})
|
||||
</insert>
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.dispose.test.manager;
|
||||
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.mapper.TaskInfoMapper;
|
||||
import com.dispose.test.Global.InitTestEnvironment;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@Slf4j
|
||||
@SpringBootTest
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@Transactional
|
||||
@Rollback
|
||||
public class TaskInfoMapperTest extends InitTestEnvironment {
|
||||
@Resource
|
||||
private TaskInfoMapper taskInfoMapper;
|
||||
|
||||
@Override
|
||||
public void userLogin() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void a1_addNewTaskInfoTest() {
|
||||
taskInfoMapper.addNewTaskInfo(152L, 1L, null, (long) ErrorCode.ERR_OK.getCode());
|
||||
taskInfoMapper.addNewTaskInfo(152L, 2L, 12L, (long) ErrorCode.ERR_OK.getCode());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue