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

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.usertaggroup.UserTagGroupDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.member.controller.admin.usertaggroup.vo.*;

/**
 * 会员标签分组 Mapper
 *
 * @author admin
 */
@Mapper
public interface UserTagGroupMapper extends BaseMapperX<UserTagGroupDO> {

    default PageResult<UserTagGroupDO> selectPage(UserTagGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserTagGroupDO>()
                .likeIfPresent(UserTagGroupDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(UserTagGroupDO::getSorted, reqVO.getSorted())
                .betweenIfPresent(UserTagGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTagGroupDO::getId));
    }

    default List<UserTagGroupDO> selectList(UserTagGroupExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UserTagGroupDO>()
                .likeIfPresent(UserTagGroupDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(UserTagGroupDO::getSorted, reqVO.getSorted())
                .betweenIfPresent(UserTagGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserTagGroupDO::getId));
    }

}
