NutzCN Logo
问答 nutz pojo 里 用了 @El $me值注入 查询时结果出错
发布于 2546天前 作者 menglinxi 1821 次浏览 复制 上一个帖子 下一个帖子
标签:
    @Column
    @Comment("创建时间")
    @Prev(els = @EL("$me.getCreatetime()"))
    @ColDefine(type = ColType.TIMESTAMP)
    Date createtime;


    public Date getCreatetime() {
        Date date = new Date();
        Timestamp timeStamp = new Timestamp(date.getTime());

        return timeStamp;
    }

注入了一个 createtime,结果查询出来的数据,所有的createtime 都是当前时间

{
id: 7,
appid: 0,
materialid: 0,
planname: "4555",
status: 0,
plancheck: 0,
createtime: "2017-05-05 15:49:57"
},
{
id: 13,
appid: 0,
materialid: 0,
planname: "qwdqwdw",
status: 0,
plancheck: 0,
createtime: "2017-05-05 15:49:57"
},

时间都一样

4 回复

不应该是 Timestamp createtime 么?

    @Column
    @Comment("创建时间")
    @Prev(els = @EL("$me.now()"))
    @ColDefine(type = ColType.TIMESTAMP)
    Date createtime;

    public Date now() {
        Date date = new Date();
        Timestamp timeStamp = new Timestamp(date.getTime());
        return timeStamp;
    }

明白了,谢谢老大。。。。

添加回复
请先登陆
回到顶部