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.PcStationBuildingEntranceGu;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;


/**
 * 站房门禁监管信息对象 pc_station_building_entrance_gu
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "站房门禁监管信息")
@EqualsAndHashCode(callSuper = false)
@Data
public class PcStationBuildingEntranceGuQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "站房id")
    private String stationBuildingId;
    @ApiModelProperty(value = "刷卡开始时间")
    private String visitStartTime;
    @ApiModelProperty(value = "刷卡结束时间")
    private String visitEndTime;
    @ApiModelProperty(value = "门禁卡号")
    private String entranceGuardCode;
    @ApiModelProperty(value = "持卡人名称")
    private String entranceGuardSignature;
    @ApiModelProperty(value = "门禁卡类型")
    private String entranceGuardType;
    @ApiModelProperty(value = "图片")
    private String entranceGuardImage;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<PcStationBuildingEntranceGu> createLambdaQueryWrapper(PcStationBuildingEntranceGuQuery query) {
        QueryWrapper<PcStationBuildingEntranceGu> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotEmpty(query.getId()), "id", query.getId());
        wrapper.eq(StringUtils.isNotEmpty(query.getStationBuildingId()), "station_building_id", query.getStationBuildingId());
        wrapper.ge(StringUtils.isNotEmpty(query.getVisitStartTime()) && StringUtils.isNotEmpty(query.getVisitStartTime()), "visit_time", query.getVisitStartTime());
        wrapper.le(StringUtils.isNotEmpty(query.getVisitEndTime()) && StringUtils.isNotEmpty(query.getVisitEndTime()), "visit_time", query.getVisitEndTime());

        wrapper.eq(StringUtils.isNotEmpty(query.getEntranceGuardCode()), "entrance_guard_code", query.getEntranceGuardCode());
        wrapper.eq(StringUtils.isNotEmpty(query.getEntranceGuardSignature()), "entrance_guard_signature", query.getEntranceGuardSignature());
        wrapper.eq(StringUtils.isNotEmpty(query.getEntranceGuardType()), "entrance_guard_type", query.getEntranceGuardType());
        wrapper.eq(StringUtils.isNotEmpty(query.getEntranceGuardImage()), "entrance_guard_image", query.getEntranceGuardImage());

        wrapper.orderByDesc("visit_time");
        return wrapper;
        }
}
