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.BEnterpriseIrLegal;
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_enterprise_ir_legal
 *
 * @author szhpt
 * @date 2023-03-14*/
@ApiModel(value = "知识库-法律法规")
@EqualsAndHashCode(callSuper = false)
@Data
public class BEnterpriseIrLegalQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "法律法规分类")
    private String legalType;
    @ApiModelProperty(value = "法律法规名称")
    private String legalName;
    @ApiModelProperty(value = "法律法规标题")
    private String legalTitle;
    @ApiModelProperty(value = "法律法规内容")
    private String legalDetails;
    @ApiModelProperty(value = "法律法规附件名称")
    private String legalFileName;
    @ApiModelProperty(value = "法律法规附件url")
    private String legalFileUrl;
    @ApiModelProperty(value = "发布时间")
    private String legalTime;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BEnterpriseIrLegal> createLambdaQueryWrapper(BEnterpriseIrLegalQuery query) {
        QueryWrapper<BEnterpriseIrLegal> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotEmpty(query.getId()), "id", query.getId());
        wrapper.eq(StringUtils.isNotEmpty(query.getLegalType()), "legal_type", query.getLegalType());
        wrapper.like(StringUtils.isNotEmpty(query.getLegalName()), "legal_name", query.getLegalName());
        //wrapper.eq(StringUtils.isNotEmpty(query.getLegalTitle()), "legal_title", query.getLegalTitle());
        wrapper.like(StringUtils.isNotEmpty(query.getLegalTitle()), "legal_title", query.getLegalTitle());
        wrapper.eq(StringUtils.isNotEmpty(query.getLegalDetails()), "legal_details", query.getLegalDetails());
        wrapper.eq(StringUtils.isNotEmpty(query.getLegalFileName()), "legal_file_name", query.getLegalFileName());
        wrapper.eq(StringUtils.isNotEmpty(query.getLegalFileUrl()), "legal_file_url", query.getLegalFileUrl());
        wrapper.eq(StringUtils.isNotEmpty(query.getLegalTime()), "legal_time", query.getLegalTime());
        wrapper.orderByDesc("legal_time");
        return wrapper;
        }
}
