package cn.iocoder.yudao.module.bpm.api.oa;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.api.oa.vo.entry.BpmOAEntryDTO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAEntryService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

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

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * Flowable 流程实例 Api 实现类
 */
@RestController
@Validated
public class BpmOAEntryApiImpl implements BpmOAEntryApi{

    @Resource
    private BpmOAEntryService entryService;

    @Override
    public CommonResult<List<BpmOAEntryDTO>> getEntryListByTime(LocalDate entryDate) {

        List<BpmOAEntryDO> entryDOS = entryService.getEntryListByTime(entryDate);

        return success(BeanUtils.toBean(entryDOS, BpmOAEntryDTO.class));
    }
}
