package com.hzya.frame.sys.testReturn.service.impl;

import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
import org.springframework.stereotype.Service;
import com.hzya.frame.sys.testReturn.entity.TestReturn;
import com.hzya.frame.sys.testReturn.service.ITestReturnService;
import com.hzya.frame.sys.testReturn.dao.ITestReturnMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.hzya.frame.web.entity.JsonResultEntity;

import javax.annotation.Resource;



/**
 * @description: 系统测试返回  service
 * @tableName:   sys_test_return
 * @entityName:  TestReturn
 * @author: 	 gjh
 * @history:	 1.0
 */
@Service(value="testreturnService")
public class  TestReturnServiceImpl implements ITestReturnService{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Resource
	protected ITestReturnMapper  testreturnMapper;

	@Override
	public TestReturn getEntity(TestReturn object) {
		object = testreturnMapper.entity_get_by_type(object.getType());
		return object;
	}

	@Override
	public TestReturn saveEntity(TestReturn object) {
		TestReturn check = new TestReturn();
		check.setType(object.getType());
		check = testreturnMapper.entity_get_by_type(check.getType());
		if(check != null && !"".equals(check.getId())){
			object.setId(check.getId());
			testreturnMapper.entity_update(object);
		}else {
			object.setId(UUIDUtils.getUUID());
			testreturnMapper.entity_insert(object);
		}
		return object;
	}

}
