package com.hzs.system.config.provider;

import cn.hutool.core.bean.BeanUtil;
import com.hzs.common.core.domain.R;
import com.hzs.system.config.ILabelServiceApi;
import com.hzs.system.config.dto.LabelConfigDTO;
import com.hzs.system.config.service.IBdLabelService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 标签配置 dubbo服务
 */
@DubboService
public class LabelServiceProvider implements ILabelServiceApi {

    @Autowired
    private IBdLabelService bdLabelService;

    @Override
    public R<LabelConfigDTO> getByPkId(Integer labelId) {
        return R.ok(BeanUtil.copyProperties(bdLabelService.getByPkId(labelId), LabelConfigDTO.class));
    }

    @Override
    public R<List<LabelConfigDTO>> getLabelByType(Integer labelType, Integer pkCountry) {
        return R.ok(BeanUtil.copyToList(bdLabelService.findLabelByType(labelType, pkCountry), LabelConfigDTO.class));
    }

}
