/**
 * Copyright © 2021-2025 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.test.activiti.service;

import com.jeeplus.common.constant.CommonConstants;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeeplus.test.activiti.service.dto.TestActivitiLeaveDTO;
import com.jeeplus.test.activiti.service.mapstruct.TestActivitiLeaveWrapper;
import com.jeeplus.test.activiti.domain.TestActivitiLeave;
import com.jeeplus.test.activiti.mapper.TestActivitiLeaveMapper;

/**
 * 请假Service
 * @author 刘高峰
 * @version 2023-03-08
 */
@Service
@Transactional
public class TestActivitiLeaveService extends ServiceImpl<TestActivitiLeaveMapper, TestActivitiLeave> {

	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	public TestActivitiLeaveDTO findById(String id) {
		TestActivitiLeaveDTO testActivitiLeaveDTO = TestActivitiLeaveWrapper.INSTANCE.toDTO ( super.getById ( id ) );
		return testActivitiLeaveDTO;
	}

	/**
	 * 保存或者更新
	 * @param  testActivitiLeaveDTO
	 * @return
	 */
	public void saveOrUpdate(TestActivitiLeaveDTO testActivitiLeaveDTO) {
		TestActivitiLeave testActivitiLeave =  TestActivitiLeaveWrapper.INSTANCE.toEntity ( testActivitiLeaveDTO );
		super.saveOrUpdate (testActivitiLeave);
		testActivitiLeaveDTO.setId ( testActivitiLeave.getId () );
	}

	/**
	 * 删除
	 * @param  id
	 * @return
	 */
	public void removeById(String id) {
		super.removeById ( id );
	}

}
