package com.hssx.pcbms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hssx.pcbms.entity.TaskDynamic;
import com.hssx.pcbms.entity.vo.TaskDTO;
import com.hssx.pcbms.entity.vo.TaskVO;
import com.hssx.pcbms.mapper.TaskDynamicMapper;
import com.hssx.pcbms.service.TaskDynamicService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hssx.pcbms.util.HttpRespMsg;
import com.hssx.pcbms.util.PageUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 吴涛涛
 * @since 2019-11-12
 */
@Service
public class TaskDynamicServiceImpl extends ServiceImpl<TaskDynamicMapper, TaskDynamic> implements TaskDynamicService {
    @Resource
    private TaskDynamicMapper taskDynamicMapper;
    @Override
    public HttpRespMsg getListByCondition(TaskVO taskVO, PageUtil page) {
        HttpRespMsg msg = new HttpRespMsg();
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        List<TaskDynamic> taskDynamics = taskDynamicMapper.selectList(new QueryWrapper<TaskDynamic>().eq("task_id", taskVO.getId()).orderByDesc("indate"));
        PageInfo<TaskDynamic> pageInfo = new PageInfo<>(taskDynamics);
        msg.data = pageInfo;
        return msg;
    }
}
