Невозможно отобразить тип отметки времени --mybatis generator - PullRequest
0 голосов
/ 11 сентября 2018

Когда я использую генератор mybatis, у меня возникает проблема: в базе данных у меня есть два столбца, тип которых - метка времени (mysql), как показано ниже. введите описание изображения здесь

, но в конце он генерирует тип даты для меня в исходном коде. Как я могу сопоставить их с типом временной метки?

xmlconfig:

`<table schema="system-account" tableName="person" domainObjectName="Person" 
mapperName="PersonDao">
<generatedKey column="person_id" sqlStatement="JDBC"/>
<columnOverride column ="name" javaType="java.lang.String"/>
<columnOverride column ="create_time" javaType="java.sql.Timestamp"/>
<columnOverride column ="used" javaType="java.lang.Boolean"/>
<columnOverride column ="update_time" javaType="java.sql.Timestamp"/>
</table>`

исходный код:

public class Person {

/**
 * This field was generated by MyBatis Generator. This field corresponds to 
the database column person.person_id
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
private Long personId;
/**
 * This field was generated by MyBatis Generator. This field corresponds to 
the database column person.name
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
private String name;
/**
 * This field was generated by MyBatis Generator. This field corresponds to 
the database column person.createtime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
private Date createtime;
/**
 * This field was generated by MyBatis Generator. This field corresponds to 
the database column person.used
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
private Boolean used;
/**
 * This field was generated by MyBatis Generator. This field corresponds to 
the database column person.updatetime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
private Date updatetime;

/**
 * This method was generated by MyBatis Generator. This method returns the 
value of the database column person.person_id
 * @return  the value of person.person_id
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public Long getPersonId() {
    return personId;
}

/**
 * This method was generated by MyBatis Generator. This method sets the 
value of the database column person.person_id
 * @param personId  the value for person.person_id
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public void setPersonId(Long personId) {
    this.personId = personId;
}

/**
 * This method was generated by MyBatis Generator. This method returns the 
value of the database column person.name
 * @return  the value of person.name
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public String getName() {
    return name;
}

/**
 * This method was generated by MyBatis Generator. This method sets the 
value of the database column person.name
 * @param name  the value for person.name
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public void setName(String name) {
    this.name = name;
}

/**
 * This method was generated by MyBatis Generator. This method returns the 
value of the database column person.createtime
 * @return  the value of person.createtime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public Date getCreatetime() {
    return createtime;
}

/**
 * This method was generated by MyBatis Generator. This method sets the 
value of the database column person.createtime
 * @param createtime  the value for person.createtime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public void setCreatetime(Date createtime) {
    this.createtime = createtime;
}

/**
 * This method was generated by MyBatis Generator. This method returns the 
value of the database column person.used
 * @return  the value of person.used
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public Boolean getUsed() {
    return used;
}

/**
 * This method was generated by MyBatis Generator. This method sets the 
value of the database column person.used
 * @param used  the value for person.used
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public void setUsed(Boolean used) {
    this.used = used;
}

/**
 * This method was generated by MyBatis Generator. This method returns the 
value of the database column person.updatetime
 * @return  the value of person.updatetime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public Date getUpdatetime() {
    return updatetime;
}

/**
 * This method was generated by MyBatis Generator. This method sets the 
value of the database column person.updatetime
 * @param updatetime  the value for person.updatetime
 * @mbg.generated  Tue Sep 11 09:09:49 GMT+08:00 2018
 */
public void setUpdatetime(Date updatetime) {
    this.updatetime = updatetime;
}
}
...