package com.cim.idm.service.Impl;

import com.cim.idm.framework.IDMFrameServiceProxy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

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

@Service
public class RecordServiceImpl {

	private static Log log = LogFactory.getLog(RecordServiceImpl.class);
	
	
	public boolean saveRecord(String user,String name,String description,String img_url)
	{
		StringBuilder sql = new StringBuilder();
		sql.append(" INSERT INTO ERRORMESSAGE_LOG (USERID,ERRORNAME,ERRORDESCRIPTION,IMG_URL,CREATETIME)  ");        
		sql.append(" VALUES (:USER,:ERRORNAME,:ERRORDESCRIPTION,:IMG_URL,SYSDATE) ");    
		Map<String, Object> hashMap = new HashMap<String,Object> ();
		hashMap.put("USER", user);
		hashMap.put("ERRORNAME", name);
		hashMap.put("ERRORDESCRIPTION", description);
		hashMap.put("IMG_URL", img_url);
		int update = IDMFrameServiceProxy.getSqlTemplate().update(sql.toString(), hashMap);
		if (update > 0) {
			return true;
		} else {
			return false;
		}
	}
}
