package com.ruoyi.web.modules.news.support;

import org.springframework.stereotype.Component;
import com.ruoyi.common.exception.ServiceException;

/**
 * 畜牧资源详情来源 type：1=biz_medical_resource，2=biz_tech_resource。
 */
@Component
public class LivestockResourceSourceTypeValidator
{
    public void assertAllowed(Integer sourceType)
    {
        if (sourceType == null)
        {
            throw new ServiceException(LivestockResourceRules.MSG_SOURCE_TYPE_REQUIRED);
        }
        if (!LivestockResourceRules.isAllowedSourceType(sourceType))
        {
            throw new ServiceException(LivestockResourceRules.MSG_SOURCE_TYPE_INVALID);
        }
    }
}
