package com.jojubanking.boot.module.system.dal.mysql.mzdm;

import java.util.*;

import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jojubanking.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.jojubanking.boot.module.system.dal.dataobject.mzdm.MzdmDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.mzdm.vo.*;

/**
 * 民族代码 Mapper
 *
 * @author admin
 */
@Mapper
public interface MzdmMapper extends BaseMapperX<MzdmDO> {

    default PageResult<MzdmDO> selectPage(MzdmPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MzdmDO>()
                .eqIfPresent(MzdmDO::getMzdm, reqVO.getMzdm())
                .likeIfPresent(MzdmDO::getName, reqVO.getName())
                .eqIfPresent(MzdmDO::getPy, reqVO.getPy())
                .eqIfPresent(MzdmDO::getWb, reqVO.getWb())
                .eqIfPresent(MzdmDO::getMemo, reqVO.getMemo())
                .eqIfPresent(MzdmDO::getGjbzbbh, reqVO.getGjbzbbh())
                .eqIfPresent(MzdmDO::getJlzt, reqVO.getJlzt())
                .betweenIfPresent(MzdmDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MzdmDO::getId));
    }

    default List<MzdmDO> selectList(MzdmExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MzdmDO>()
                .eqIfPresent(MzdmDO::getMzdm, reqVO.getMzdm())
                .likeIfPresent(MzdmDO::getName, reqVO.getName())
                .eqIfPresent(MzdmDO::getPy, reqVO.getPy())
                .eqIfPresent(MzdmDO::getWb, reqVO.getWb())
                .eqIfPresent(MzdmDO::getMemo, reqVO.getMemo())
                .eqIfPresent(MzdmDO::getGjbzbbh, reqVO.getGjbzbbh())
                .eqIfPresent(MzdmDO::getJlzt, reqVO.getJlzt())
                .betweenIfPresent(MzdmDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MzdmDO::getId));
    }

    default List<MzdmDO> selectList01(MzdmExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MzdmDO>()
                .eqIfPresent(MzdmDO::getMzdm, reqVO.getMzdm())
                .likeIfPresent(MzdmDO::getName, reqVO.getName())
                .eqIfPresent(MzdmDO::getPy, reqVO.getPy())
                .eqIfPresent(MzdmDO::getWb, reqVO.getWb())
                .eqIfPresent(MzdmDO::getMemo, reqVO.getMemo())
                .eqIfPresent(MzdmDO::getGjbzbbh, reqVO.getGjbzbbh())
                .eqIfPresent(MzdmDO::getJlzt, reqVO.getJlzt())
                .betweenIfPresent(MzdmDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MzdmDO::getId));
    }

}
