package com.hys.app.service.erp.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hys.app.framework.context.user.AdminUserContext;
import com.hys.app.framework.database.BaseQueryParam;
import com.hys.app.framework.database.mybatisplus.base.BaseServiceImpl;
import com.hys.app.mapper.erp.MessageReceiveMapper;
import com.hys.app.model.erp.dos.MessageReceiveDO;
import com.hys.app.model.erp.entity.MailSmsCountQuery;
import com.hys.app.service.erp.MessageReceiveManager;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 出库单商品明细业务层实现
 *
 * @author 张崧
 * @since 2023-12-07 17:06:32
 */
@Service
@AllArgsConstructor
public class MessageReceiveManagerImpl extends BaseServiceImpl<MessageReceiveMapper, MessageReceiveDO> implements MessageReceiveManager {

    @Override
    public IPage<MessageReceiveDO> getPage(BaseQueryParam query, String type) {
        return page(new Page<>(query.getPageNo(), query.getPageSize()),
                new LambdaQueryWrapper<MessageReceiveDO>().eq(MessageReceiveDO::getType, type)
                        .eq(ObjectUtil.isNotNull(AdminUserContext.getCompanyId()), MessageReceiveDO::getCompanyId, AdminUserContext.getCompanyId()));
    }
}

