机台模板是否发布,是否可用字段更新

This commit is contained in:
liuzhaotian
2024-09-13 09:29:52 +08:00
parent 6e3231888d
commit e772e10d6c
20 changed files with 544 additions and 410 deletions
@@ -0,0 +1,49 @@
package com.cf.imes.framework.common.util.Assert;
import com.cf.imes.framework.common.exception.ErrorCode;
import org.springframework.util.ObjectUtils;
import java.util.List;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 断言工具类:用于代码抛出异常,提升代码的简洁度
*
* @author 晨丰科技
*/
public class AssertUtils {
/*
* 判断是否为空,可以不用if语句,简化代码
* */
public static void notEmpty(List<?> array, ErrorCode errorCode) {
if (ObjectUtils.isEmpty(array)) {
throw exception(errorCode);
}
}
public static void empty(List<?> array, ErrorCode errorCode) {
if (!ObjectUtils.isEmpty(array)) {
throw exception(errorCode);
}
}
public static void notEmpty(Object object, ErrorCode errorCode) {
if (object == null) {
throw exception(errorCode);
}
}
public static void notEmpty(List<?> array ,Object object, ErrorCode errorCode) {
if (object == null || ObjectUtils.isEmpty(array)) {
throw exception(errorCode);
}
}
}