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.SIntegratedRoutineInspection;
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;

/**
 * 日常检查信息对象 s_integrated_routine_inspection
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "日常检查信息")
@EqualsAndHashCode(callSuper = false)
@Data
public class SIntegratedRoutineInspectionQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "企业id")
    private String factoryId;
    @ApiModelProperty(value = "年份")
    private String particularYear;
    @ApiModelProperty(value = "检查轮次")
    private String checkRounds;
    @ApiModelProperty(value = "检查时间")
    private String checkTime;
    @ApiModelProperty(value = "检查开始时间")
    private String checkStartTime;
    @ApiModelProperty(value = "检查结束时间")
    private String checkEndTime;
    @ApiModelProperty(value = "检查人员")
    private String inspector;
    @ApiModelProperty(value = "检查评分")
    private String checkScore;
    @ApiModelProperty(value = "总分")
    private String totalPoints;
    @ApiModelProperty(value = "审查类型")
    private String reviewTypes;
    @ApiModelProperty(value = "审核状态")
    private String reviewStatus;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<SIntegratedRoutineInspection> createLambdaQueryWrapper(SIntegratedRoutineInspectionQuery query) {
        QueryWrapper<SIntegratedRoutineInspection> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getId()), "id", query.getId());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(ObjectUtil.isNotNull(query.getParticularYear()), "particular_year", query.getParticularYear());
        wrapper.eq(ObjectUtil.isNotNull(query.getCheckRounds()), "check_rounds", query.getCheckRounds());
        wrapper.eq(ObjectUtil.isNotNull(query.getCheckTime()), "check_time", query.getCheckTime());
        wrapper.between(StringUtils.isNotEmpty(query.getCheckStartTime()) && StringUtils.isNotEmpty(query.getCheckEndTime()), "check_time", query.getCheckStartTime(), query.getCheckEndTime());
        wrapper.eq(ObjectUtil.isNotNull(query.getInspector()), "inspector", query.getInspector());
        wrapper.eq(ObjectUtil.isNotNull(query.getCheckScore()), "check_score", query.getCheckScore());
        wrapper.eq(ObjectUtil.isNotNull(query.getTotalPoints()), "total_points", query.getTotalPoints());
        wrapper.eq(ObjectUtil.isNotNull(query.getReviewTypes()), "review_types", query.getReviewTypes());
        wrapper.eq(ObjectUtil.isNotNull(query.getReviewStatus()), "review_status", query.getReviewStatus());

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