mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
机台模板是否发布,是否可用字段更新
This commit is contained in:
+49
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user