package com.yuchen.saas.park.service.controller.property;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.property.EnterpriseUserSyncAddDto;
import com.yuchen.saas.park.api.dto.property.PropertyHousesAutoDeductionDto;
import com.yuchen.saas.park.api.vo.property.PropertyEnterpriseUserSyncVo;
import com.yuchen.saas.park.api.vo.property.PropertyHousesTreeVo;
import com.yuchen.saas.park.service.service.property.IPropertyEnterpriseUserSyncService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 物业同步组织成员记录表 前端控制器
 * </p>
 *
 * @author cxj
 * @since 2024-01-04
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/propertyEnterpriseUserSync")
public class PropertyEnterpriseUserSyncController {

    private final IPropertyEnterpriseUserSyncService baseService;

    @PostMapping("/add")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "物业同步组织成员", notes = "物业同步组织成员")
    public R add(@Valid @RequestBody EnterpriseUserSyncAddDto param) {
        return R.status(baseService.add(param));
    }

    @GetMapping("/getByAddressId")
    @ApiOperationSupport(order = 10)
    @ApiOperation(value = "物业同步组织成员回显", notes = "物业同步组织成员回显")
    public R<List<PropertyEnterpriseUserSyncVo>> getByAddressId(@RequestParam(value = "enterpriseAddressId", required = false) Long enterpriseAddressId) {
        return R.data(baseService.getByAddressId(enterpriseAddressId));
    }
}
