package ${package}.mongo.query;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.query.Criteria;
import static com.ruoyi.common.utils.MongoUtil.*;

/**
 * ${entity.name}的查询条件
${entity.toComment(0)}
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ${entity.toUpperName()}Query {

  //  设置请求日期参数格式
  @org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd")
//  设置使用@RequestBody时日期参数格式
//  @com.fasterxml.jackson.annotation.JsonFormat(pattern = "yyyy-MM-dd")
  private java.util.Date beginDate;

//  @org.springframework.format.annotation.DateTimeFormat(pattern = "yyyy-MM-dd")
//  private java.util.Date endDate;
//
//  private String key;

  public Criteria where() {
    Criteria c = new Criteria();


//    if (ObjUtil.isNotNull(beginDate) && ObjUtil.isNotNull(endDate)) {
//      c = c.and("createTime").gte(beginDate).lte(DateUtil.endOfDay(endDate));
//    }

//    if(StrUtil.isNotBlank(key)){
//      c=c.orOperator(
//        conditions().put("name$like",key).criteria(),
//        conditions().put("name1$like",key).criteria()
//      );
//    }



    return c;
  }
}
