
package com.tmerclub.cloud.supplier.feign;

import com.tmerclub.cloud.api.supplier.feign.SupplierUserFeignClient;
import com.tmerclub.cloud.api.supplier.vo.SupplierApiUserVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.supplier.service.SupplierUserService;
import com.tmerclub.cloud.supplier.vo.SupplierUserVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author chiley
 * @date 2022/7/13 15:38
 */
@DubboService
public class SupplierUserFeignController implements SupplierUserFeignClient {

    @Autowired
    private SupplierUserService supplierUserService;

    @Override
    public ServerResponseEntity<Integer> countAccoutByMobile(String mobile) {
        return ServerResponseEntity.success(supplierUserService.countAccoutByMobile(mobile));

    }

    @Override
    public ServerResponseEntity<SupplierApiUserVO> getByUserId(Long userId) {
        SupplierApiUserVO supplierApiUserVO = BeanUtil.map(supplierUserService.getByUserId(userId), SupplierApiUserVO.class);
        return ServerResponseEntity.success(supplierApiUserVO);
    }
}
