REM:
1. 解决数据库测试用例
2. 数据库添加获取当前状态的函数
This commit is contained in:
chenlinghy 2020-06-30 17:23:24 +08:00
parent 887c11a9c8
commit d90f961ea5
3 changed files with 18 additions and 10 deletions

View File

@ -53,4 +53,11 @@ public interface TaskInfoMapper extends Mapper<TaskInfo>, MySqlMapper<TaskInfo>
*/ */
void changeTaskInfoStatus(@Param("id") Long id, void changeTaskInfoStatus(@Param("id") Long id,
@Param("status") Long status); @Param("status") Long status);
/**
* get task info status.
*
* @param id the id
*/
int getTaskInfoCurrentStatus(Long id);
} }

View File

@ -28,4 +28,10 @@
id = #{id, jdbcType=INTEGER} id = #{id, jdbcType=INTEGER}
</update> </update>
<select id="getTaskInfoCurrentStatus" resultType="java.lang.Integer">
SELECT status
FROM task_info
WHERE id = #{id, jdbcType=INTEGER}
</select>
</mapper> </mapper>

View File

@ -162,22 +162,17 @@ public class TaskInfoMapperTest extends InitTestEnvironment {
) { ) {
Assert.assertNotNull(taskInfo.getStatus()); Assert.assertNotNull(taskInfo.getStatus());
Long beforeStatus = taskInfo.getStatus(); Long beforeStatus = taskInfo.getStatus();
long changeStatus; long changeStatus = 0;
if(beforeStatus == 0){ if (beforeStatus == 0) {
changeStatus = 1L; changeStatus = 1L;
}else{
changeStatus = 0L;
} }
log.info("task_info table Id-->{}, before Status-->{}, change Stauts-->{}", log.info("task_info table Id-->{}, before Status-->{}, change Stauts-->{}",
taskInfo.getId(),taskInfo.getStatus(),changeStatus); taskInfo.getId(), taskInfo.getStatus(), changeStatus);
taskInfoMapper.changeTaskInfoStatus(taskInfo.getId(), changeStatus); taskInfoMapper.changeTaskInfoStatus(taskInfo.getId(), changeStatus);
log.info("task_info before Status-->{}, after Stauts-->{}",
beforeStatus, taskInfo.getStatus());
Assert.assertEquals(beforeStatus, taskInfo.getStatus());
log.info("change task info Status-->{}", taskInfo.getStatus()); Assert.assertNotEquals(beforeStatus, new Long((long) taskInfoMapper.getTaskInfoCurrentStatus(taskInfo.getId())));
} }
} }
} }