fastjson 时间注解 @JSONField

 之前ssm项目里面 的时间和和前端交互的时候会变成long类型时间。

我是用的json的alibaba的fastjson。

可以再entity实体类的属性加上@JSONField注解。我是ssm  mybatis框架

 

 

private String md5HexParam;// 关系图md5Hex值
	private String progress; // 关系图执行状态

	private String tablename; // 数据源名字
	private String tableid; // 数据源id
	private String target; // 目标号码
	private String progresstype;// 任务类型
	private String progressrate;// 任务进度百分比

	@JSONField(format = "yyyy-MM-dd HH:mm:ss") // FastJson包使用注解
	private Date createtime;

	public String getMd5HexParam() {
		return md5HexParam;
	}

	public void setMd5HexParam(String md5HexParam) {
		this.md5HexParam = md5HexParam;
	}

	public String getProgress() {
		return progress;
	}

	public void setProgress(String progress) {
		this.progress = progress;
	}

	public String getTablename() {
		return tablename;
	}

	public void setTablename(String tablename) {
		this.tablename = tablename;
	}

	public String getTableid() {
		return tableid;
	}

	public void setTableid(String tableid) {
		this.tableid = tableid;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getProgresstype() {
		return progresstype;
	}

	public void setProgresstype(String progresstype) {
		this.progresstype = progresstype;
	}

	public String getProgressrate() {
		return progressrate;
	}

	public void setProgressrate(String progressrate) {
		this.progressrate = progressrate;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Override
	public String toString() {
		return "HistoryTrackProgress [md5HexParam=" + md5HexParam + ", progress=" + progress + ", tablename="
				+ tablename + ", tableid=" + tableid + ", target=" + target + ", progresstype=" + progresstype
				+ ", progressrate=" + progressrate + ", createtime=" + createtime + "]";
	}

 

你可能感兴趣的:(java)