NutzCN Logo
问答 $me.now() el表达式变了吗
发布于 1834天前 作者 Hamming 1450 次浏览 复制 上一个帖子 下一个帖子
标签:
[DEBUG] 10:00:38.956 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - // NOT SQL // ElFieldMacro=uuid()
[DEBUG] 10:00:38.964 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - // NOT SQL // ElFieldMacro=$me.uid()
[DEBUG] 10:00:38.964 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - // NOT SQL // ElFieldMacro=$me.now()
[DEBUG] 10:00:38.964 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - // NOT SQL // ElFieldMacro=$me.uid()
[DEBUG] 10:00:38.965 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - // NOT SQL // ElFieldMacro=$me.now()
public abstract class BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;

    @Column("create_by")
    @Comment("创建者")
    @Prev(els = @EL("$me.uid()"))
    @ColDefine(type = ColType.VARCHAR, width = 32)
    protected String createBy;

    @Column("create_time")
    @Prev(els = {@EL("$me.now()")})
    protected Date createTime;

    @Column("update_by")
    @Comment("更新者")
    @Prev(els = @EL("$me.uid()"))
    @ColDefine(type = ColType.VARCHAR, width = 32)
    protected String updateBy;

    @Prev(els=@EL("$me.now()"))
    @Column("update_time")
    protected Date updateTime;

    public String uuid() {
        return R.UU32().toLowerCase();
    }

    public String uid() {
        try {
            Subject subject = SecurityUtils.getSubject();
            User user = (User) subject.getPrincipal();
            return user == null ? "" : user.getId();
        } catch (Exception e) {
            return "";
        }
    }

    public Date now() {
        return new Date();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

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