mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 增加 jackson 配置 默认序列化时间格式
This commit is contained in:
		@@ -2,14 +2,8 @@ package com.ruoyi.common.core.controller;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.utils.DateUtils;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.web.bind.WebDataBinder;
 | 
			
		||||
import org.springframework.web.bind.annotation.InitBinder;
 | 
			
		||||
 | 
			
		||||
import java.beans.PropertyEditorSupport;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * web层通用数据处理
 | 
			
		||||
@@ -20,23 +14,6 @@ public class BaseController
 | 
			
		||||
{
 | 
			
		||||
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 将前台传递过来的日期格式的字符串,自动转化为Date类型
 | 
			
		||||
     */
 | 
			
		||||
    @InitBinder
 | 
			
		||||
    public void initBinder(WebDataBinder binder)
 | 
			
		||||
    {
 | 
			
		||||
        // Date 类型转换
 | 
			
		||||
        binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
 | 
			
		||||
        {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void setAsText(String text)
 | 
			
		||||
            {
 | 
			
		||||
                setValue(DateUtils.parseDate(text));
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 响应返回结果
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
package com.ruoyi.common.core.domain;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
@@ -12,7 +11,7 @@ import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Entity基类
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
@@ -30,14 +29,12 @@ public class BaseEntity implements Serializable
 | 
			
		||||
    private String createBy;
 | 
			
		||||
 | 
			
		||||
    /** 创建时间 */
 | 
			
		||||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
			
		||||
    private Date createTime;
 | 
			
		||||
 | 
			
		||||
    /** 更新者 */
 | 
			
		||||
    private String updateBy;
 | 
			
		||||
 | 
			
		||||
    /** 更新时间 */
 | 
			
		||||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
			
		||||
    private Date updateTime;
 | 
			
		||||
 | 
			
		||||
    /** 备注 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user