package cn.newfeifan.mall.module.system.dal.mysql.config;

import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.module.system.controller.admin.config.vo.ConfigPageReqVO;
import cn.newfeifan.mall.module.system.dal.dataobject.config.SystemConfigDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 系统配置 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface SystemConfigMapper extends BaseMapperX<SystemConfigDO> {

    default PageResult<SystemConfigDO> selectPage(ConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SystemConfigDO>()
                .eqIfPresent(SystemConfigDO::getWechatAppid, reqVO.getWechatAppid())
                .eqIfPresent(SystemConfigDO::getWechatSecretKey, reqVO.getWechatSecretKey())
                .eqIfPresent(SystemConfigDO::getPlatformDomain, reqVO.getPlatformDomain())
                .eqIfPresent(SystemConfigDO::getMerchantDomain, reqVO.getMerchantDomain())
                .eqIfPresent(SystemConfigDO::getMallDomain, reqVO.getMallDomain())
                .betweenIfPresent(SystemConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SystemConfigDO::getId));
    }

}