use of build.dream.common.erp.catering.domains.CanNotOperateReason in project erp-catering by liuyandong33.
the class BasicService method validateCanNotOperate.
public void validateCanNotOperate(BigInteger tenantId, BigInteger branchId, String tableName, BigInteger tableId, int operateType) {
SearchModel searchModel = new SearchModel();
searchModel.addSearchCondition("tenant_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, tenantId);
searchModel.addSearchCondition("branch_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, branchId);
searchModel.addSearchCondition("table_name", Constants.SQL_OPERATION_SYMBOL_EQUALS, tableName);
searchModel.addSearchCondition("table_id", Constants.SQL_OPERATION_SYMBOL_EQUALS, tableId);
searchModel.addSearchCondition("operate_type", Constants.SQL_OPERATION_SYMBOL_IN, new int[] { operateType, 3 });
CanNotOperateReason canNotOperateReason = canNotOperateReasonMapper.find(searchModel);
if (canNotOperateReason != null) {
int persistenceOperateType = canNotOperateReason.getOperateType();
String reason = canNotOperateReason.getReason();
if (persistenceOperateType == 1) {
throw new CanNotDeleteException(reason);
} else if (persistenceOperateType == 2) {
throw new CanNotEditException(reason);
} else if (persistenceOperateType == 3) {
throw new CanNotEditAndDeleteException(String.format(reason, operateType == 1 ? "编辑" : "删除"));
}
}
}
use of build.dream.common.erp.catering.domains.CanNotOperateReason in project erp-catering by liuyandong33.
the class CanNotOperateReasonUtils method constructCanNotOperateReason.
public static CanNotOperateReason constructCanNotOperateReason(BigInteger tenantId, String tenantCode, BigInteger branchId, BigInteger tableId, String tableName, BigInteger causeTableId, String causeTableName, Integer operateType, String reason) {
CanNotOperateReason canNotOperateReason = new CanNotOperateReason();
canNotOperateReason.setTenantId(tenantId);
canNotOperateReason.setTenantCode(tenantCode);
canNotOperateReason.setBranchId(branchId);
canNotOperateReason.setTableId(tableId);
canNotOperateReason.setTableName(tableName);
canNotOperateReason.setCauseTableId(causeTableId);
canNotOperateReason.setCauseTableName(causeTableName);
canNotOperateReason.setOperateType(operateType);
canNotOperateReason.setReason(reason);
return canNotOperateReason;
}
Aggregations