package cn.com.ty.lift.ud.payment.controller.query;

import cn.com.ty.lift.ud.payment.mapper.entity.ApplyInvoiceEntity;

import cn.com.ty.lift.ud.common.BasePageQuery;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 申请发票 查询条件
 * 
 * @author Xson
 * @date 2020-04-22
 */
@Data
@ApiModel(description = "申请发票 查询条件")
public final class ApplyInvoiceQuery extends BasePageQuery {

	/**
     * 名称
     */
    @ApiModelProperty("名称")
     private String gmfMc;
    
    /**
     * 关联用户
     */
    @ApiModelProperty("关联用户")
    private Long userId;

    /**
     * 状态
     */
    @ApiModelProperty("状态")
    private Integer statuz;

    /**
     * 审核状态1通过0未通过2待审核
     */
    @ApiModelProperty("状态")
    private Integer checkFlag;

    /**
     * 查询条件
     * 
     * @return
     */
    @Override
    public Wrapper condition() {
        LambdaQueryWrapper<ApplyInvoiceEntity> query = new LambdaQueryWrapper<>();
        if (null != gmfMc) {
            query.like(ApplyInvoiceEntity::getGmfMc, gmfMc);
        }
        if (null != checkFlag) {
            query.eq(ApplyInvoiceEntity::getCheckFlag, checkFlag);
        }
        if (null != userId) {
            query.eq(ApplyInvoiceEntity::getUserId, userId);
        }
        if (null != statuz) {
            query.eq(ApplyInvoiceEntity::getStatuz, statuz);
        }
        query.orderByDesc(ApplyInvoiceEntity::getCreateTime);
        return query;
    }

    /**
     * 分页条件
     * 
     * @return
     */
    @Override
    public IPage page() {
        Page<ApplyInvoiceEntity> page = new Page<>(getPageNum(), getPageSize());
        return page;
    }

}
