package com.repair.common.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;

import java.util.List;

/**
 * @Author: binguo
 * @Date: 2023/7/5 星期三 16:11
 * @Description: com.template.utils
 * @Version: 1.0
 */
@Slf4j
public class paramUtils {
    public static String getParamError(BindingResult bindingResult) {
        //有校验没通过
        List<ObjectError> errorList = bindingResult.getAllErrors();
        StringBuilder st = new StringBuilder();
        for (ObjectError error : errorList) {
            st.append(error.getDefaultMessage() + "! ");//输出具体的错误信息
        }

        return st.toString();
    }
}
