futian.liu
2023-12-22 3e9a4b3480e6508f3c6f7ac8723509d8b1120d20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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);
    }
}