Я пытаюсь выбрать между двумя разами.
Кстати, я использую springdata с какой-то упрощенной структурой mybatis.
И последний sql mybatis генерирует:
reparing: select * from somtable `product` where `product`.create_time>=? and `product`.create_time<=? and `product`.ou_id=? order by `product`.id DESC limit ? offset ?
Parameters: 2016-10-13 00:00:00.0(Timestamp), 2019-10-13 00:00:00.0(Timestamp), 1(Long), 10(Integer), 0(Integer)
И результат равен 0.
Но когда я пробую это в инструментальной среде mysql, он выбирает 3 результата.
Тип Java типа createTime - Date, и это JDBC.тип BigInt.
Я почти уверен, что нет проблем с форматированием.
Интересно, почему?
Вот как я определяю свою сущность.
package com.iot.products.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import org.springframework.data.annotation.*;
import org.springframework.data.mybatis.annotations.*;
import org.springframework.data.mybatis.autoconfiguration.handlers.DateNumericTypeHandler;
import org.springframework.data.mybatis.domains.LongId;
import org.springframework.data.repository.query.parser.Part;
import java.util.Date;
@Data
@MappedSuperclass
@JsonIgnoreProperties({"new"})
public class AbstractAuditable extends LongId {
@CreatedBy
@Column(name = "creator")
@Condition
protected Long creator;
@CreatedDate
@Column(name = "create_time")
@TypeHandler(DateNumericTypeHandler.class)
@org.springframework.data.mybatis.annotations.JdbcType(JdbcType.BIGINT)
@Conditions({
@Condition(type = Part.Type.AFTER, properties = "startTime"),
@Condition(type = Part.Type.BEFORE, properties = "endTime")
})
protected Date createTime;
@LastModifiedBy
@Column(name = "modifier")
protected Long modifier;
@LastModifiedDate
@Column(name = "last_modify_time")
@TypeHandler(DateNumericTypeHandler.class)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@org.springframework.data.mybatis.annotations.JdbcType(JdbcType.BIGINT)
protected Date lastModifyTime;
@Transient
protected Date startTime;
@Transient
protected Date endTime;
}