package com.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import com.model.Notice;

import java.util.HashMap;
import java.util.Map;

public class BookValidator extends Validator {

	@Override
	protected void validate(Controller controller) {
//		validateRequiredString("bean.isbn", "isbnMsg", "请输入isbn!");
//		validateRequiredString("bean.title", "titleMsg", "请输入正题名!");
//		validateRequiredString("bean.author", "authorMsg", "请输入著者!");
//		validateRequiredString("bean.publisher", "publisherMsg", "请输入出版社!");
//		validateRequiredString("bean.publishaddress", "publishaddressMsg", "请输入出版地!");
//		validateRequiredString("bean.publishdate", "publishdateMsg", "请输入出版日期!");
//		validateRequiredString("bean.price", "priceMsg", "请输入定价!");
//		validateRequiredString("bean.typecode", "typecodeMsg", "请输入分类号!");
//		validateRequiredString("bean.shucihao", "shucihaoMsg", "请输入书次号!");
//		validateRequiredString("bookDetailJsonStr", "bookInfoMsg", "请输入书籍条码!");
	}

	@Override
	protected void handleError(Controller controller) {
		controller.keepModel(Notice.class);
		String actionKey = getActionKey();
		Map result = new HashMap();
		result.put("code","101");
		result.put("msg","参数不完整");
		controller.renderJson(result);

	}
}
