mapper 文件如下:
实体类中字段定义如下:
mysql中createtime字段是timestamp类型,但是查询后,实体类中的createtime的值只有年月日,时分秒全部是0,原因是
<result column="createtime" property="createtime" jdbcType="DATE"/>
中jdbcType="DATE" 造成的,可以直接将此配置删掉或者改为jdbcType="TIMESTAMP", 即
或者
改成这样查询就有时分秒了,
<resultMap type="xx" id="xxx">
<result column="createtime" property="createtime" jdbcType="DATE"/>
</resultMap>
实体类中字段定义如下:
public class xx{
private Date createtime;
}
mysql中createtime字段是timestamp类型,但是查询后,实体类中的createtime的值只有年月日,时分秒全部是0,原因是
<result column="createtime" property="createtime" jdbcType="DATE"/>
中jdbcType="DATE" 造成的,可以直接将此配置删掉或者改为jdbcType="TIMESTAMP", 即
<result column="createtime" property="createtime"/>
或者
<result column="createtime" property="createtime" jdbcType="TIMESTAMP"/>
改成这样查询就有时分秒了,