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

@ApiModel(value = "移动执法信息-异常任务核查query")
@EqualsAndHashCode(callSuper = false)
@Data
public class BMainExceptionTaskCheckQuery extends PageQuery
{
    @ApiModelProperty(value = "任务名称")
    private String taskName;
    @ApiModelProperty(value = "任务来源")
    private String taskSource;
    @ApiModelProperty(value = "企业id")
    private String factoryId;
    @ApiModelProperty(value = "企业名称")
    private String factoryName;
    @ApiModelProperty(value = "企业地址")
    private String factoryAddr;
    @ApiModelProperty(value = "区域")
    private String regionName;

    public static QueryWrapper<BMainExceptionTaskCheck> createLambdaQueryWrapper(BMainExceptionTaskCheckQuery query) {
        QueryWrapper<BMainExceptionTaskCheck> wrapper = new QueryWrapper<>();
        wrapper.like(StringUtils.isNotEmpty(query.getTaskName()), "task_name", query.getTaskName());
        wrapper.eq(StringUtils.isNotEmpty(query.getFactoryId()), "factory_Id", query.getFactoryId());
        wrapper.like(StringUtils.isNotEmpty(query.getFactoryName()), "factory_name", query.getFactoryName());
        wrapper.eq(StringUtils.isNotEmpty(query.getFactoryAddr()), "factory_addr", query.getFactoryAddr());
        wrapper.like(StringUtils.isNotEmpty(query.getRegionName()), "region_name", query.getRegionName());
        wrapper.orderByAsc("task_name", "id");
        return wrapper;
    }
}
