石广澎
2023-12-02 e908aead856e1da187a27ae6b5f48eaf106d2acf
consum-base/src/main/java/com/consum/base/service/BaseWarehouseServiceImpl.java
@@ -9,14 +9,18 @@
import com.consum.model.po.FinSysTenantDepartment;
import com.consum.model.po.SDictData;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.CollectionUtils;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.jdbc.service.BaseServiceImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Description 仓库管理
@@ -31,9 +35,7 @@
    @Autowired
    private FinSysTenantServiceImpl finSysTenantService;
    @Autowired
    private FinSysTenantDepartmentServiceImpl departmentService;
    @Autowired
    private FinSysTenantUserServiceImpl userService;
    private FinSysTenantDepartmentService departmentService;
    @Autowired
    private SDictDataServiceImpl sDictDataService;
@@ -208,4 +210,23 @@
        }
        return null;
    }
    public BaseWarehouse getWarehouseByAgencyId(Long agencyId, String warehouseName) {
        StringBuilder sql = new StringBuilder("SELECT * FROM base_warehouse WHERE STATES= 1");
        Map<String, Object> param = new HashMap<>();
        if (agencyId != null) {
            sql.append(" and AGENCY_ID =:agencyId ");
            param.put("agencyId", agencyId);
        }
        if (StringUtils.isNotEmpty(warehouseName)) {
            sql.append(" and WAREHOUSE_NAME =:warehouseName ");
            param.put("warehouseName", warehouseName);
        }
        sql.append(" limit 1");
        List<BaseWarehouse> select = select(sql.toString(), param, new BaseWarehouse());
        if (CollectionUtils.isEmpty(select)) {
            return null;
        }
        return select.get(0);
    }
}