package com.yanzhu.jh.bigscreen.web.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.work.domain.WorkTrain;
import com.yanzhu.jh.work.service.IWorkTrainService;
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;

/**
 * 培训演训Conller
 */
@RestController
@RequestMapping("/bgscreen/workTrain")
public class BgWorkTrainController extends BaseController {

    @Autowired
    IWorkTrainService workTrainService;

    /**
     * 根据类型查询培训演训
     * @param trainType
     * @return
     */
    @GetMapping("/getWorkTrainList")
    public TableDataInfo getWorkTrainList(String trainType,String deptId,String projectId){
        WorkTrain workTrain = new WorkTrain();
        workTrain.setTrainType(trainType);
        if(deptId!=null && !"0".equals(deptId)){
            workTrain.setNowDept(deptId);
        }
        if(projectId!=null && !"0".equals(projectId)){
            workTrain.setProjectId(Convert.toLong(projectId));
        }
        return getDataTable(workTrainService.selectBgscreenWorkTrainListv2(workTrain));
    }
}
