package com.consum.base.service;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import com.walker.jdbc.service.BaseServiceImpl;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @ClassName LOrgSupplierServiceImpl
|
*
|
* @Date 2023/11/1
|
* @Description
|
* @Version 1.0
|
**/
|
@Service
|
@Slf4j
|
public class LOrgSupplierServiceImpl extends BaseServiceImpl {
|
private static String SUPPLIER_IS_CONTAIN = "SELECT*FROM L_ORG_SUPPLIER WHERE 1=1";
|
|
/**
|
* 判断供应商是否存在
|
*
|
* @param agencyId
|
* @param supplier
|
* @return
|
*/
|
|
public List<Map<String, Object>> selectSupplier(String agencyId, String supplier) {
|
StringBuilder sql = new StringBuilder(SUPPLIER_IS_CONTAIN);
|
Map<String, Object> paramts = new HashMap<>();
|
if (agencyId != null) {
|
sql.append(" and AGENCY_ID=:agencyId");
|
paramts.put("agencyId", agencyId);
|
}
|
if (StringUtils.isNotEmpty(supplier)) {
|
sql.append(" and supplier=:supplier");
|
paramts.put("supplier", supplier);
|
}
|
return select(sql.append(" limit 1").toString(), paramts);
|
}
|
|
public boolean supplierIsContain(String agencyId, String supplier) {
|
List<Map<String, Object>> selectSupplier = selectSupplier(agencyId, supplier);
|
return !CollectionUtils.isEmpty(selectSupplier);
|
}
|
}
|