package co.yixiang.yshop.module.member.dal.mysql.usertag;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.member.dal.dataobject.usertag.UserTagDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.member.controller.admin.usertag.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 会员标签 Mapper
 *
 * @author admin
 */
@Mapper
public interface UserTagMapper extends BaseMapperX<UserTagDO> {

    default PageResult<UserTagDO> selectPage(UserTagPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserTagDO>()
                .likeIfPresent(UserTagDO::getTagName, reqVO.getTagName())
                .eqIfPresent(UserTagDO::getGroupId, reqVO.getGroupId())
                .betweenIfPresent(UserTagDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTagDO::getId));
    }

    default List<UserTagDO> selectList(UserTagExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserTagDO>()
                .likeIfPresent(UserTagDO::getTagName, reqVO.getTagName())
                .eqIfPresent(UserTagDO::getGroupId, reqVO.getGroupId())
                .betweenIfPresent(UserTagDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTagDO::getId));
    }

    List<UserTagDO> selectList2(@Param("param") UserTagPageReqVO pageVO);
}
