package com.elephant.framework.galaxy.aroad.module.attendance.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.elephant.framework.galaxy.aroad.module.attendance.dto.AttendanceTemplateDto;
import com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates;
import com.elephant.framework.galaxy.aroad.module.attendance.mapper.AttendanceTemplatesMapper;
import com.elephant.framework.galaxy.aroad.module.attendance.service.AttendanceTemplatesService;
import com.elephant.framework.galaxy.aroad.module.attendance.vo.AttendanceTemplateVo;
import com.elephant.framework.galaxy.aroad.util.JsonUtil;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 班次表
 *
 * @author songwenjie
 * @date 2019-04-11 10:09:35
 */
@Service
public class AttendanceTemplatesServiceImpl extends ServiceImpl<AttendanceTemplatesMapper, AttendanceTemplates> implements AttendanceTemplatesService {

    /**
     * @Description: 查询值班班次信息（用于下拉列表）
     * @Param: []
     * @return: java.util.List<com.elephant.framework.galaxy.aroad.module.attendance.entity.AttendanceTemplates>
     * @Author: songwenjie
     * @Date: 2019/4/15
     */
    public List<AttendanceTemplates> getShiftSelection(int unitId){
        return baseMapper.getShiftSelection(unitId);
    }

    /**
     * @Description: 分页查询值班班次信息
     * @Param: [page]
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.elephant.framework.galaxy.aroad.module.attendance.dto.AttendanceTemplateDto>
     * @Author: songwenjie
     * @Date: 2019/4/23
     */
    public IPage<AttendanceTemplateDto> getShiftPage(Page page,Integer unitId){
        IPage<AttendanceTemplateDto> templates = baseMapper.getShiftPage(page,unitId);
        return templates;
    }

    /**
     * @Description: 删除排班模板
     * @param: [shiftId]
     * @return: java.lang.Boolean
     * @Author: songwenjie
     * @Date: 2019/5/21
     */
    public Boolean delTemplate(Integer shiftId){
        return baseMapper.delTemplate(shiftId);
    }
}
