package org.security.trans.basic.fegin;

import lombok.AllArgsConstructor;
import org.security.ht.entity.basic.Employee;
import org.security.ht.feign.basic.IEmployeeClient;
import org.security.trans.basic.service.IEmployeeService;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：wzf
 * @apiNote ：员工服务Feign实现类
 * @since ：Created in 2022/9/7 11:11
 */
@NonDS
@RestController
@AllArgsConstructor
public class EmployeeClient implements IEmployeeClient {
	private final IEmployeeService employeeService;
	@Override
	@GetMapping(EMPLOYEE_INFO)
	public R<Employee> getEmployeeAndFamiliesAndJobRecords(Long id) {
		return R.data(employeeService.getById(id));
	}

	@Override
	@PostMapping(SYS_EMPLOYEE_DATA)
	public R synData(List<Employee> employees) {
		return R.status(employeeService.synEmployeeData(employees));
	}
}
