package cn.cecep.talroad.vo.query;

import cn.cecep.talroad.common.core.domain.query.PageQuery;
import cn.cecep.talroad.domain.BasElecDevice;
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;


/**
 * 分表计电设备信息对象 bas_elec_device
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "分表计电设备信息")
@EqualsAndHashCode(callSuper = false)
@Data
public class BasElecDeviceQuery extends PageQuery
{

    @ApiModelProperty(value = "计电设备ID")
    private String elecDeviceId;
    @ApiModelProperty(value = "所属企业")
    private String factoryId;
    @ApiModelProperty(value = "设备名称")
    private String name;
    @ApiModelProperty(value = "所属行业 枚举。钢铁/焦化/水泥...")
    private String industry;
    @ApiModelProperty(value = "备注")
    private String memo;
    @ApiModelProperty(value = "创建时间")
    private String createTime;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BasElecDevice> createLambdaQueryWrapper(BasElecDeviceQuery query) {
        QueryWrapper<BasElecDevice> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getElecDeviceId()), "elec_device_id", query.getElecDeviceId());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(ObjectUtil.isNotNull(query.getName()), "name", query.getName());
        wrapper.eq(ObjectUtil.isNotNull(query.getIndustry()), "industry", query.getIndustry());
        wrapper.eq(ObjectUtil.isNotNull(query.getMemo()), "memo", query.getMemo());
        wrapper.eq(ObjectUtil.isNotNull(query.getCreateTime()), "create_time", query.getCreateTime());
        return wrapper;
        }
}
