/*
 ****************************************************************************
 *
 *  (c) Copyright 2013 BOE IDM. All rights reserved.
 *
 *  This software is proprietary to and embodies the confidential
 *  technology of BOE IDM. Possession, use, or copying of this
 *  software and media is authorized only pursuant to a valid written
 *  license from BOE IDM.
 *
 ****************************************************************************
 */
package com.cim.idm.solution.service.management.impl;

import com.cim.idm.framework.exception.IDMFrameDBErrorSignal;
import com.cim.idm.solution.service.management.ORMService;
import com.cim.idm.solution.service.management.ORMUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import com.cim.idm.framework.data.EventInfo;
import java.util.List;
import com.cim.idm.solution.service.management.LabelService;
import com.cim.idm.solution.service.management.data.Label;

/**
 * @Class impl.com.zi.mwms.solution.service.management.LabelServiceImpl<br/>
 * @Description LabelServiceImpl.
 * @author ZXYGY17
 * @Time 2025-01-21 15:41:24
 */
public class LabelServiceImpl extends ORMService<Label> implements LabelService  {

	public static Log logger = LogFactory.getLog(LabelServiceImpl.class);

	private final String historyEntity = "LabelHistory";

	@Override
	public List<Label> select(String condition, Object[] bindSet) throws IDMFrameDBErrorSignal {
		List<Label> result = super.select(condition, bindSet, Label.class);
		return result;
	}

	@Override
	public Label selectByKey(boolean isLock, Object[] keySet) throws IDMFrameDBErrorSignal {
		return super.selectByKey(Label.class, isLock, keySet);
	}

	@Override
	public Label create(EventInfo eventInfo, Label dataInfo) throws IDMFrameDBErrorSignal {
		super.insert(dataInfo,eventInfo);
		super.addHistory(eventInfo, this.historyEntity, dataInfo, logger);
		return selectByKey(false, ORMUtil.makeKeyParam(dataInfo).toArray());
	}

	@Override
	public void remove(EventInfo eventInfo, Label dataInfo) throws IDMFrameDBErrorSignal {
		super.addHistory(eventInfo, this.historyEntity, dataInfo, logger);
		super.delete(dataInfo);
	}

	@Override
	public Label modify(EventInfo eventInfo, Label dataInfo) throws IDMFrameDBErrorSignal {
		super.update(dataInfo,eventInfo);
		super.addHistory(eventInfo, this.historyEntity, dataInfo, logger);
		return selectByKey(false, ORMUtil.makeKeyParam(dataInfo).toArray());
	}
}
