package com.ifish.dto;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * 请求返回json结果
 * @author Administrator
 *
 * @param <T>
 */
public class JsonResult<T> {
	//结果码
	private String result;
	//数据
	private T data;
	
	public JsonResult(String result, T data) {
		this.result = result;
		this.data = data;
	}

	public JsonResult(String result) {
		this.result = result;
		this.data = null;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	@Override
	public String toString() {
		//允许null值
		return JSON.toJSONString(this,SerializerFeature.WriteMapNullValue);
	}
}
