cy
2023-11-22 8fc8b4788ed8be27ff6aae1cdd3fe9a584972ae3
consum-base/src/main/java/com/consum/base/service/BaseWarehouseServiceImpl.java
@@ -9,6 +9,7 @@
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 org.springframework.beans.BeanUtils;
@@ -208,4 +209,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);
    }
}