@ResponseBody注解是怎么把返回值转化为json格式的字符串的
Posted 杀手不太冷!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了@ResponseBody注解是怎么把返回值转化为json格式的字符串的相关的知识,希望对你有一定的参考价值。
@ResponseBody注解是怎么把返回值转化为json格式的字符串的
package com.shunwang.back.pojo.personal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.shunwang.back.annotation.EditLogs;
import com.shunwang.back.context.EditLogContext;
import com.shunwang.back.pojo.BaseObject;
import com.shunwang.back.util.SensitiveInfoUtil;
import com.shunwang.encrypt.core.annotation.EncryptEnabled;
import com.shunwang.encrypt.core.annotation.EncryptField;
import lombok.Data;
import lombok.Getter;
import java.util.Date;
@Data
@EncryptEnabled
public class WxIdCardBind extends BaseObject
private static final long serialVersionUID = -2709858817981670846L;
private Integer id;
private String unionId;
@EncryptField(ref = "idCardNoCoded")
private String idCardNo;
private String idCardNoCoded;
private String idCardNoSend;
private Integer state;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updTime;
private String updUser;
private String tailNo;
public String getIdCardNoShow()
return SensitiveInfoUtil.idCardNoStarReplace(idCardNo);
public void setId(Integer id)
EditLogContext.addItemId(id);
EditLogContext.addLog("id", id);
this.id = id;
public void setUnionId(String unionId)
EditLogContext.addLog("unionId", unionId);
this.unionId = unionId;
public void setIdCardNo(String idCardNo)
EditLogContext.addLog("idCardNo", idCardNo, true);
this.idCardNo = idCardNo;
public void setIdCardNoSend(String idCardNoSend)
EditLogContext.addLog("idCardNoSend", idCardNoSend, true);
this.idCardNoSend = idCardNoSend;
public void setState(Integer state)
EditLogContext.addLog("state", state);
this.state = state;
public void setCreateTime(Date createTime)
EditLogContext.addLog("createTime", createTime);
this.createTime = createTime;
public void setUpdTime(Date updTime)
EditLogContext.addLog("updTime", updTime);
this.updTime = updTime;
public void setUpdUser(String updUser)
EditLogContext.addLog("updUser", updUser);
this.updUser = updUser;
public void setTailNo(String tailNo)
EditLogContext.addLog("tailNo", tailNo);
this.tailNo = tailNo;
WxIdCardBind的构造如下图:
返回给前端json字符串的属性如下图:
以上是关于@ResponseBody注解是怎么把返回值转化为json格式的字符串的的主要内容,如果未能解决你的问题,请参考以下文章