package cn.iocoder.yudao.module.erp.api.purchase;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpSupplierMapper;
|
import jakarta.annotation.Resource;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.Collections;
|
import java.util.List;
|
import java.util.Map;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
/**
|
* ERP 供应商引用查询 API 实现
|
*/
|
@RestController
|
@RequestMapping(ErpSupplierReferenceApi.PREFIX)
|
@Validated
|
public class ErpSupplierReferenceApiImpl implements ErpSupplierReferenceApi {
|
|
@Resource
|
private ErpSupplierMapper supplierMapper;
|
|
@Override
|
public CommonResult<List<String>> getSupplierReferenceSources(Long supplierId) {
|
if (supplierId == null) {
|
return success(Collections.emptyList());
|
}
|
List<Map<String, Object>> rows = supplierMapper.selectSupplierReferenceCount(supplierId);
|
List<String> sources = rows.stream()
|
.map(row -> String.valueOf(row.get("source")))
|
.toList();
|
return success(sources);
|
}
|
|
}
|