package io.renren.modules.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.business.dao.BusinessWorkerSalaryDao;
import io.renren.modules.business.entity.BusinessWorkerSalaryEntity;
import io.renren.modules.business.service.BusinessWorkerSalaryService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("businessWorkerSalaryService")
public class BusinessWorkerSalaryServiceImpl extends ServiceImpl<BusinessWorkerSalaryDao, BusinessWorkerSalaryEntity> implements BusinessWorkerSalaryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BusinessWorkerSalaryEntity> page = this.page(
                new Query<BusinessWorkerSalaryEntity>().getPage(params),
                new QueryWrapper<BusinessWorkerSalaryEntity>().eq("user_id",params.get("userId"))
                .orderByDesc("year").orderByDesc("start_time")
        );

        return new PageUtils(page);
    }

}