Package ru.bgcrm.dao
Class CustomerDAO
java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.CustomerDAO
-
Nested Class Summary
Nested classes/interfaces inherited from class ru.bgcrm.dao.CommonDAO
CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T extends Id> -
Field Summary
Fields inherited from class ru.bgcrm.dao.CommonDAO
con, dateFormat_DDMMYYYY, dateFormat_DDMMYYYY_HHMM, log, SQL_AND, SQL_DELETE, SQL_DESC, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT, SQL_INSERT_IGNORE, SQL_LEFT_JOIN, SQL_LEFT_OUTER_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_OR, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UPDATE, SQL_WHERE -
Constructor Summary
ConstructorsConstructorDescriptionCustomerDAO(Connection con) CustomerDAO(Connection con, boolean history, int userId) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCustomer(int id) Удаляет контрагента из БД по коду.extractCustomerWithRef(int customerId) getCustomerById(int customerId) Выбирает контрагента по его коду.@Nullable CustomergetCustomerByLinkedContract(Contract contract) Deprecated.@Nullable CustomergetCustomerByLinkedObject(int id, String title) getCustomerByTitle(String customerTitle) Deprecated.static CustomergetCustomerFromRs(ResultSet rs, String prefix) getCustomers(Connection connection, Collection<Integer> customerIds) Получение набора контрагентов по их IDgetCustomers(Collection<Integer> customerIds) Получение набора контрагентов по их IDgetCustomersByLinkedContractsTitle(String contractTitle) getCustomersByParamGroupId(int paramGroupId) getCustomersByPhone(@NotNull String phone, int paramId) voidgetCustomersByPhoneByTuu(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) voidgetCustomersByPhoneFromDailyAppeal(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) getCustomerTitles(String title, int count) Возвращает названия контрагенов с подстрокой.getGroupIds(int customerId) getLinkedCustomerToObject(int objectId) getLinkedCustomerToObjectList(int objectId) searchByParamText(int paramId, String value) searchByParamText(String text1, int paramId1, String text2, int paramId2) Поиск контрагента по параметру типа "текст"voidsearchCustomerByLink(@NotNull SearchResult<CustomerDTO> searchResult, @NotNull String linkedObjectTitle, @Nullable String linkedObjectType) searchCustomerByLinkedObjectId(int linkedObjectId, String linkedObjectTypeLike) Deprecated.voidsearchCustomerByLinkedObjectTitle(SearchResult<Customer> searchResult, String linkedObjectTypeLike, String linkedObjectTitle) voidsearchCustomerList(SearchResult<Customer> searchResult, String title) Выбирает контрагентов по названию.voidsearchCustomerList(SearchResult<Customer> searchResult, Set<Integer> groupIds) Выбирает контрагентов по группам.voidsearchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int houseId, String houseFlat, String houseRoom) Выбирает контрагентов по адресному параметру.voidsearchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int streetId, String house, String houseFlat, String houseRoom) Выбирает контрагентов по адресному параметру.voidsearchCustomerListByEmail(SearchResult<ParameterSearchedObject<Customer>> searchResult, List<Integer> emailParamIdList, String email) Выбирает контрагентов по параметру типа E-Mail.voidsearchCustomerListByNumber(SearchResult<Customer> searchResult, List<Integer> numberParamIds, int value) Выбирает контрагентов по числовому параметру.voidsearchCustomerListByPhone(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) voidsearchCustomerListByText(SearchResult<Customer> searchResult, List<Integer> textParamIdList, String value) Выбирает контрагентов по строковому параметру.voidupdateCustomer(Customer customer) Deprecated.voidupdateCustomerTitle(String titleBefore, Customer customer, int changedParamId, Response response) Обновляет название контрагента,генерируя его из параметров.voidupdateGroupIds(int customerId, Set<Integer> groupIds) Methods inherited from class ru.bgcrm.dao.CommonDAO
buildPlaceholders, deleteById, execute, execute, execute, executeBatch, executeInsert, executeUpdate, getById, getFoundRows, getFoundRows, getGroupedIds, getGroupedIds, getIds, getIds, getLikePattern, getLikePatternEnd, getLikePatternStart, getLikePatternSub, getMySQLLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, sqlToBgException, update, updateColumn, updateIds, updateIds
-
Constructor Details
-
CustomerDAO
-
CustomerDAO
-
-
Method Details
-
searchCustomerList
public void searchCustomerList(SearchResult<Customer> searchResult, String title) throws BGException Выбирает контрагентов по названию.- Parameters:
searchResult-title-- Throws:
SQLExceptionBGException
-
searchCustomerList
public void searchCustomerList(SearchResult<Customer> searchResult, Set<Integer> groupIds) throws BGException Выбирает контрагентов по группам.- Parameters:
searchResult-groupIds- - группы.- Throws:
SQLExceptionBGException
-
extractCustomerWithRef
- Throws:
BGException
-
searchCustomerListByEmail
public void searchCustomerListByEmail(SearchResult<ParameterSearchedObject<Customer>> searchResult, List<Integer> emailParamIdList, String email) throws BGException Выбирает контрагентов по параметру типа E-Mail.- Parameters:
searchResult-emailParamIdList-email-- Throws:
SQLExceptionBGException
-
searchCustomerListByText
public void searchCustomerListByText(SearchResult<Customer> searchResult, List<Integer> textParamIdList, String value) throws SQLException Выбирает контрагентов по строковому параметру.- Parameters:
searchResult-textParamIdList-value-- Throws:
SQLException
-
searchCustomerListByNumber
public void searchCustomerListByNumber(SearchResult<Customer> searchResult, List<Integer> numberParamIds, int value) throws BGException Выбирает контрагентов по числовому параметру.- Parameters:
searchResult-numberParamIds-value-- Throws:
SQLExceptionBGException
-
searchCustomerListByAddress
public void searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int streetId, String house, String houseFlat, String houseRoom) throws SQLException Выбирает контрагентов по адресному параметру.- Parameters:
searchResult-addressParamIdList-streetId-house-houseFlat-houseRoom-- Throws:
SQLException
-
searchCustomerListByAddress
public void searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int houseId, String houseFlat, String houseRoom) throws BGException Выбирает контрагентов по адресному параметру.- Parameters:
searchResult-addressParamIdList-houseId- код домаhouseFlat- квартираhouseRoom- комната- Throws:
SQLExceptionBGException
-
searchCustomerListByPhone
public void searchCustomerListByPhone(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) throws BGException - Throws:
BGException
-
getCustomersByPhone
@NotNull public @NotNull ArrayList<Customer> getCustomersByPhone(@NotNull @NotNull String phone, int paramId) throws BGException - Throws:
BGException
-
getCustomersByPhoneFromDailyAppeal
public void getCustomersByPhoneFromDailyAppeal(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) throws BGException - Throws:
BGException
-
getCustomersByPhoneByTuu
public void getCustomersByPhoneByTuu(SearchResult<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) throws BGException - Throws:
BGException
-
getCustomersByLinkedContractsTitle
- Throws:
BGException
-
getCustomerByLinkedObject
@Nullable public @Nullable Customer getCustomerByLinkedObject(int id, String title) throws BGException - Throws:
BGException
-
getCustomerByLinkedContract
@Nullable @Deprecated public @Nullable Customer getCustomerByLinkedContract(Contract contract) throws BGException Deprecated.- Throws:
BGException
-
searchCustomerByLinkedObjectTitle
public void searchCustomerByLinkedObjectTitle(SearchResult<Customer> searchResult, String linkedObjectTypeLike, String linkedObjectTitle) throws BGException - Throws:
BGException
-
searchCustomerByLink
public void searchCustomerByLink(@NotNull @NotNull SearchResult<CustomerDTO> searchResult, @NotNull @NotNull String linkedObjectTitle, @Nullable @Nullable String linkedObjectType) -
searchCustomerByLinkedObjectId
@Deprecated public List<Customer> searchCustomerByLinkedObjectId(int linkedObjectId, String linkedObjectTypeLike) throws BGException Deprecated.Выбирает контрагентов по id привязанного объекта. В данный момент является deprecated, ибо метод не используется в продакшене- Parameters:
linkedObjectId-linkedObjectTypeLike-- Returns:
- List
- Throws:
BGException
-
getLinkedCustomerToObject
- Throws:
BGException
-
getLinkedCustomerToObjectList
- Throws:
BGException
-
getCustomerById
Выбирает контрагента по его коду.- Parameters:
customerId-- Returns:
- Throws:
BGException
-
getCustomers
public static Set<Customer> getCustomers(Connection connection, Collection<Integer> customerIds) throws BGException Получение набора контрагентов по их ID- Parameters:
customerIds- идентификаторы контрагентов- Returns:
- Throws:
BGException
-
getCustomers
Получение набора контрагентов по их ID- Parameters:
customerIds- идентификаторы контрагентов- Returns:
- Throws:
BGException
-
getCustomerByTitle
Deprecated.Выбирает контрагента по названию. Deprecated, потому что функция возвращает только последнего попавшегося контрагента (title - не уникальное поле). Приближенный аналог:searchCustomerList- Parameters:
customerTitle- название- Returns:
- Throws:
SQLException
-
updateCustomer
Deprecated.Useupdate(Customer)instead.Обновляет информацию о контрагенте в БД.- Parameters:
customer-- Throws:
SQLException
-
update
-
deleteCustomer
Удаляет контрагента из БД по коду.- Parameters:
id-- Throws:
SQLException
-
updateCustomerTitle
public void updateCustomerTitle(String titleBefore, Customer customer, int changedParamId, Response response) throws BGException Обновляет название контрагента,генерируя его из параметров.- Parameters:
titleBefore- исходное название.customer- контрагент.changedParamId- код изменённого параметра.response- если параметр передан, туда будет добавлено событие о изменении названия договора.- Throws:
BGException
-
getCustomerTitles
Возвращает названия контрагенов с подстрокой.- Parameters:
title- подстрока, поиск идёт с помощью LIKE выражения.count- количество первых названий.- Returns:
- Throws:
BGException
-
getGroupIds
- Throws:
BGException
-
updateGroupIds
- Throws:
BGException
-
getCustomerFromRs
- Parameters:
rs-prefix-- Throws:
SQLException
-
searchByParamText
public Set<Integer> searchByParamText(String text1, int paramId1, String text2, int paramId2) throws BGException Поиск контрагента по параметру типа "текст"- Parameters:
text2-paramId2-- Returns:
- Throws:
BGException
-
searchByParamText
- Throws:
BGException
-
getCustomersByParamGroupId
-
update(Customer)instead.