package com.gyee.frame.controller.ticket;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gyee.frame.common.dataSources.DataSource;
import com.gyee.frame.common.dataSources.DataSourceType;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.ticket.Wfassignment;
import com.gyee.frame.service.ticket.WfassignmentService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenmh
 * @since 2020-06-02
 */
@RestController
@RequestMapping("/wfassignment")
public class WfassignmentController {

    @Autowired
    WfassignmentService wfassignmentService;

    /**
     * 分页查询待办任务
     * @param page
     * @return
     */
    @DataSource(value = DataSourceType.TICKET)
    @GetMapping(value = "list")
    public AjaxResult getList(@Param("page") Optional<Long> page){
        Long pageNum = page.orElse(1L);

        IPage<Wfassignment> wfassignment = wfassignmentService.selectPage(pageNum);
        if(wfassignment != null)
            return AjaxResult.successData(wfassignment);
        else
            return AjaxResult.error(4004,"数据读取异常");
    }
}

