package cn.hmsoft.skill.data.dao.school;

import java.time.LocalDateTime;

import org.springframework.stereotype.Repository;

import cn.hmsoft.jdbc.core.PlatformDaoSupport;
import cn.hmsoft.skill.data.model.school.SchoolLog;

@Repository
public class SchoolLogDao extends PlatformDaoSupport<SchoolLog> {

	public SchoolLog log(int school_id, String log_type) {
		return log(school_id, log_type, null);
	}

	public SchoolLog log(int school_id, String log_type, String new_value) {
		return log(school_id, log_type, new_value, null, null);
	}

	public SchoolLog log(int school_id, String log_type, String new_value, String old_value, LocalDateTime log_time) {
		SchoolLog log = new SchoolLog();
		if (log_time == null)
			log.setLog_time(LocalDateTime.now());
		else
			log.setLog_time(log_time);
		log.setLog_type(log_type);
		log.setNew_value(new_value);
		log.setOld_value(old_value);
		log.setSchool_id(school_id);
		this.insert(log);
		return log;
	}

	
}
