package com.ssm.model.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.ssm.model.system.SysPosition;

/**
 * 职位验证
 * */
public class PositionValidator implements Validator {
	@Override
	public boolean supports(Class<?> arg0) {
		return SysPosition.class.equals(arg0);
	}

	@Override
	public void validate(Object arg0, Errors errors) {
		ValidationUtils.rejectIfEmpty(errors, "positionname", null, "职位名称不能为空");
		ValidationUtils.rejectIfEmpty(errors, "positioncode", null, "职位编码不能为空");
	}
}
