package org.springblade.payment.handle.handler;

import org.springblade.core.mp.base.BaseService;
import org.springblade.ldt.bills.entity.Bills;
import org.springblade.ldt.bills.service.IBillsService;
import org.springblade.ldt.user.entity.LoginUser;
import org.springblade.ldt.user.service.ILoginUserService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Objects;

/**
 * @author: lianghanqiang
 * @description: 执行事务插入操作
 * @since: 9/1/21 -- 10:33 AM
 */
@Component
public class DataHandle {

	@Transactional(propagation = Propagation.REQUIRES_NEW)
	public <T> boolean saveOrUpdateEntity(BaseService<T> service,T t) {
		if(Objects.isNull(t)){
			return true;
		}
		return service.saveOrUpdate(t);
	}

}
