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


/**
 * 移动执法信息对象 b_main_mobile_enforcement
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "移动执法信息")
@EqualsAndHashCode(callSuper = false)
@Data
public class BMainMobileEnforcementQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "企业id")
    private String factoryId;
    @ApiModelProperty(value = "任务类型")
    private String taskType;
    @ApiModelProperty(value = "检查人")
    private String enforcementPersion;
    @ApiModelProperty(value = "检查时间")
    private String enforcementStartTime;
    @ApiModelProperty(value = "检查时间")
    private String enforcementEndTime;
    @ApiModelProperty(value = "执法小结")
    private String enforcementNodulus;
    @ApiModelProperty(value = "处理意见及相关要求")
    private String enforcementOpinion;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BMainMobileEnforcement> createLambdaQueryWrapper(BMainMobileEnforcementQuery query) {
        QueryWrapper<BMainMobileEnforcement> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotEmpty(query.getId()), "id", query.getId());
        wrapper.eq(StringUtils.isNotEmpty(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(StringUtils.isNotEmpty(query.getTaskType()), "task_type", query.getTaskType());
        wrapper.eq(StringUtils.isNotEmpty(query.getEnforcementPersion()), "enforcement_persion", query.getEnforcementPersion());
        wrapper.between(StringUtils.isNotEmpty(query.getEnforcementStartTime()) && StringUtils.isNotEmpty(query.getEnforcementEndTime()), "enforcement_time", query.getEnforcementStartTime(), query.getEnforcementEndTime());
        wrapper.eq(StringUtils.isNotEmpty(query.getEnforcementNodulus()), "enforcement_nodulus", query.getEnforcementNodulus());
        wrapper.eq(StringUtils.isNotEmpty(query.getEnforcementOpinion()), "enforcement_opinion", query.getEnforcementOpinion());

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