package com.hys.app.mapper.erp;

import com.hys.app.framework.context.user.AdminUserContext;
import com.hys.app.framework.database.WebPage;
import com.hys.app.framework.database.mybatisplus.base.BaseDO;
import com.hys.app.framework.database.mybatisplus.base.BaseMapperX;
import com.hys.app.model.erp.dos.CustomerDO;
import com.hys.app.model.erp.dos.GoodsLabelDO;
import com.hys.app.model.erp.dto.CustomerQueryParams;
import com.hys.app.model.erp.dto.GoodsLabelQueryParams;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商品标签 Mapper
 *
 * @author 张崧
 * 2024-03-20 16:23:19
 */
@Mapper
public interface CustomerMapper extends BaseMapperX<CustomerDO> {

    default WebPage<CustomerDO> selectPage(CustomerQueryParams params) {
        return lambdaQuery()
                .likeIfPresent(CustomerDO::getName, params.getName())
                .likeIfPresent(CustomerDO::getContact, params.getContact())
                .eqIfPresent(CustomerDO::getCompanyId, AdminUserContext.getCompanyId())
                .likeIfPresent(CustomerDO::getType, params.getType())
                .orderByDesc(CustomerDO::getId)
                .page(params);
    }

}

