package cn.cecep.talroad.vo.query;

import cn.cecep.talroad.common.core.domain.query.PageQuery;
import cn.cecep.talroad.common.core.utils.StringUtils;
import cn.cecep.talroad.domain.BMainPollDis;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;


/**
 * 排污许可对象 b_main_poll_dis
 *
 * @author szhpt
 * @date 2023-01-18*/
@ApiModel(value = "排污许可")
@EqualsAndHashCode(callSuper = false)
@Data
public class BMainPollDisQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "企业id")
    private String factoryId;
    @ApiModelProperty(value = "许可证编号")
    private String pollDisLicenseCode;
    @ApiModelProperty(value = "业务类型")
    private String businessType;
    @ApiModelProperty(value = "版本")
    private String editionCode;
    @ApiModelProperty(value = "办结日期")
    private Date completionTime;
    @ApiModelProperty(value = "有效期限")
    private String pollDisLicenseDeadline;
    @ApiModelProperty(value = "许可证正本")
    private String pollDisOriginal;
    @ApiModelProperty(value = "许可证副本")
    private String pollDisEctype;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BMainPollDis> createLambdaQueryWrapper(BMainPollDisQuery query) {
        QueryWrapper<BMainPollDis> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotEmpty(query.getId()), "id", query.getId());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollDisLicenseCode()), "poll_dis_license_code", query.getPollDisLicenseCode());
        wrapper.eq(ObjectUtil.isNotNull(query.getBusinessType()), "business_type", query.getBusinessType());
        wrapper.eq(ObjectUtil.isNotNull(query.getEditionCode()), "edition_code", query.getEditionCode());
        wrapper.eq(ObjectUtil.isNotNull(query.getCompletionTime()), "completion_time", query.getCompletionTime());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollDisLicenseDeadline()), "poll_dis_license_deadline", query.getPollDisLicenseDeadline());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollDisOriginal()), "poll_dis_original", query.getPollDisOriginal());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollDisEctype()), "poll_dis_ectype", query.getPollDisEctype());
        wrapper.orderByDesc("completion_time");
        return wrapper;
        }
}
