package com.cim.idm.mwmsextend.enumdef.service.service;

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

import com.cim.idm.framework.IDMFrameServiceProxy;

public class EnumdefServiceImpl {

	
	public void createEnumdefValue(String enumname,String enumvalue,String description,String defaultflag) {
		String insertSQLString=" INSERT INTO enumdefvalue(enumname,enumvalue,description,defaultflag) VALUES(:enumName, :enumValue, :description, :defaultFlag) ";
		Map<String, Object> insertMap = new HashMap<String, Object>();
		insertMap.put("enumName", enumname);
		insertMap.put("enumValue", enumvalue);
		insertMap.put("description", description);
		insertMap.put("defaultFlag", defaultflag);
		IDMFrameServiceProxy.getSqlTemplate().update(insertSQLString, insertMap);
	}
	
	public void modifyEnumdefValue(String enumname,String enumvalue,String description,String defaultflag) {
		String updateSQLString=" UPDATE enumdefvalue SET enumname=:enumName,enumValue=:enumValue,description=:description,defaultflag=:defaultFlag WHERE enumname=:enumName and enumValue=:enumValue ";
		Map<String, Object> insertMap = new HashMap<String, Object>();
		insertMap.put("enumName", enumname);
		insertMap.put("enumValue", enumvalue);
		insertMap.put("description", description);
		insertMap.put("defaultFlag", defaultflag);
		IDMFrameServiceProxy.getSqlTemplate().update(updateSQLString, insertMap);
	}
	
	public void removeEnumdefValue(String enumname,String enumvalue) {
		String deleteSQLString=" DELETE FROM enumdefvalue WHERE enumName=:enumName and enumValue=:enumValue ";
		Map<String, Object> deleteMap = new HashMap<String, Object>();
		deleteMap.put("enumName", enumname);
		deleteMap.put("enumValue", enumvalue);
		IDMFrameServiceProxy.getSqlTemplate().update(deleteSQLString, deleteMap);
	}
	
	
}
