package com.yeejoin.equipmanage.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.mapper.DutyDetailsMapper;
import com.yeejoin.equipmanage.service.DutyDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

@Service
public class DutyDetailsImpl implements DutyDetailsService {

    @Autowired
    private DutyDetailsMapper dutyDetailsMapper;
    @Autowired
    RedisUtils redisUtils;
    @Override
    public IPage<Map<String, Object>> dutyPersonPageList(int current, int size,String bizOrgCode) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String dutyDate = sdf.format(new Date());
        Page page = new Page();
        if (current > 0){
            page.setCurrent((long) (current - 1) *size);
            page.setSize(size);
        }
        return dutyDetailsMapper.selectDutyPersonList(page, dutyDate, bizOrgCode);
    }



}
