package com.crm.ucard.controller;

import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.entity.country.SysCountryEntity;
import com.crm.ucard.service.SysCountryFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/country")
public class SysCountryController {

    @Autowired
    private SysCountryFeignService sysCountryFeignService;

    /**
     * 根据pid获取列表
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/get")
    public BaseResultDto getAllCountry(@RequestBody SysCountryEntity entity) throws Exception {

        if (entity.getPid() == null) {
            entity.setPid(0L);
        }
        BaseResultDto resultDto = sysCountryFeignService.getAllCountry(entity);

        return resultDto;
    }

}
