mybatisplus中数据库中Date类型的字段为什么能和字符串类型的相比较
//作比较的相关代码
@Override
public void patientRemind() {
QueryWrapper<OrderInfo> queryWrapper=new QueryWrapper<>();
//在下面这段代码中,reserve_date字段和调用toString方法后的字符串类型相比较,
// 能得到正确结果
queryWrapper.eq("reserve_date", new DateTime().toString("yyyy-MM-dd"));
queryWrapper.ne("order_status",-1);
List<OrderInfo> orderInfos = baseMapper.selectList(queryWrapper);
for (OrderInfo orderInfo : orderInfos) {
MsmVo msmVo = new MsmVo();
msmVo.setPhone(orderInfo.getPatientPhone());
String reserveDate = new DateTime(orderInfo.getReserveDate()).toString("yyyy-MM-dd") + (orderInfo.getReserveTime()==0 ? "上午": "下午");
Map<String,Object> param = new HashMap<String,Object>(){{
put("title", orderInfo.getHosname()+"|"+orderInfo.getDepname()+"|"+orderInfo.getTitle());
put("reserveDate", reserveDate);
put("name", orderInfo.getPatientName());
}};
msmVo.setParam(param);
rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_MSM,MqConst.ROUTING_MSM_ITEM,msmVo);
}
}
//实体类相关代码
//orderInfo类
package com.atguigu.yygh.model.order;
import com.atguigu.yygh.model.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* Order
*
*
* @author qy
*/
@Data
@ApiModel(description = "Order")
@TableName("order_info")
public class OrderInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "userId")
@TableField("user_id")
private Long userId;
@ApiModelProperty(value = "订单交易号")
@TableField("out_trade_no")
private String outTradeNo;
@ApiModelProperty(value = "医院编号")
@TableField("hoscode")
private String hoscode;
@ApiModelProperty(value = "医院名称")
@TableField("hosname")
private String hosname;
@ApiModelProperty(value = "科室编号")
@TableField("depcode")
private String depcode;
@ApiModelProperty(value = "科室名称")
@TableField("depname")
private String depname;
@ApiModelProperty(value = "排班id")
@TableField("hos_schedule_id")
private String scheduleId;
@ApiModelProperty(value = "医生职称")
@TableField("title")
private String title;
@ApiModelProperty(value = "安排日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField("reserve_date")
private Date reserveDate;
@ApiModelProperty(value = "安排时间(0:上午 1:下午)")
@TableField("reserve_time")
private Integer reserveTime;
@ApiModelProperty(value = "就诊人id")
@TableField("patient_id")
private Long patientId;
@ApiModelProperty(value = "就诊人名称")
@TableField("patient_name")
private String patientName;
@ApiModelProperty(value = "就诊人手机")
@TableField("patient_phone")
private String patientPhone;
@ApiModelProperty(value = "预约记录唯一标识(医院预约记录主键)")
@TableField("hos_record_id")
private String hosRecordId;
@ApiModelProperty(value = "预约号序")
@TableField("number")
private Integer number;
@ApiModelProperty(value = "建议取号时间")
@TableField("fetch_time")
private String fetchTime;
@ApiModelProperty(value = "取号地点")
@TableField("fetch_address")
private String fetchAddress;
@ApiModelProperty(value = "医事服务费")
@TableField("amount")
private BigDecimal amount;
@ApiModelProperty(value = "退号时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
@TableField("quit_time")
private Date quitTime;
@ApiModelProperty(value = "订单状态")
@TableField("order_status")
private Integer orderStatus;
}
//BaseEntity 类
package com.atguigu.yygh.model.base;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Data
public class BaseEntity implements Serializable {
@ApiModelProperty(value = "id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "逻辑删除(1:已删除,0:未删除)")
@TableLogic
@TableField("is_deleted")
private Integer isDeleted;
@ApiModelProperty(value = "其他参数")
@TableField(exist = false)
private Map<String,Object> param = new HashMap<>();
}
//数据库内容