package cn.iocoder.yudao.module.member.dal.mysql.userexpand;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.userexpand.vo.UserExpandPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.userexpand.UserExpandDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户拓展属性 Mapper
 *
 * @author 开发账号
 */
@Mapper
public interface UserExpandMapper extends BaseMapperX<UserExpandDO> {

    default PageResult<UserExpandDO> selectPage(UserExpandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserExpandDO>()
                .eqIfPresent(UserExpandDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserExpandDO::getHeight, reqVO.getHeight())
                .eqIfPresent(UserExpandDO::getWeight, reqVO.getWeight())
                .eqIfPresent(UserExpandDO::getHealth, reqVO.getHealth())
                .eqIfPresent(UserExpandDO::getTarget, reqVO.getTarget())
                .eqIfPresent(UserExpandDO::getCard, reqVO.getCard())
                .betweenIfPresent(UserExpandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserExpandDO::getId));
    }

}