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, log, SQL_AND, SQL_DELETE, SQL_DELETE_FROM, SQL_DESC, SQL_DISTINCT, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT_IGNORE, SQL_INSERT_INTO, SQL_LEFT_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UNION_ALL, SQL_UPDATE, SQL_VALUES, SQL_VALUES_1, SQL_VALUES_2, SQL_VALUES_3, SQL_VALUES_4, SQL_VALUES_5, 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) Выбирает контрагента по его коду.getCustomerByTitle(String customerTitle) Выбирает контрагента по названию.static CustomergetCustomerFromRs(ResultSet rs, String prefix) getCustomers(Connection connection, Collection<Integer> customerIds) Deprecated.getCustomers(Collection<Integer> customerIds) Deprecated.getCustomerTitles(String title, int count) Возвращает названия контрагенов с подстрокой.getGroupIds(int customerId) voidsearchCustomerByLinkedObjectTitle(Pageable<Customer> searchResult, String linkedObjectTypeLike, String linkedObjectTitle) Выбирает контрагентов по привязанном объектам.voidsearchCustomerList(Pageable<Customer> searchResult, String title) Выбирает контрагентов по названию.voidsearchCustomerList(Pageable<Customer> searchResult, Set<Integer> groupIds) Выбирает контрагентов по группам.voidsearchCustomerListByAddress(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int houseId, String houseFlat, String houseRoom) Выбирает контрагентов по адресному параметру.voidsearchCustomerListByAddress(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int streetId, String house, String houseFlat, String houseRoom) Выбирает контрагентов по адресному параметру.voidsearchCustomerListByEmail(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> emailParamIdList, String email) Выбирает контрагентов по параметру типа Email.voidsearchCustomerListByPhone(Pageable<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) Выбирает контрагентов по номеру или номерам телефонов.voidsearchCustomerListByText(Pageable<Customer> searchResult, List<Integer> textParamIdList, String value) Выбирает контрагентов по строковому параметру.voidupdateCustomer(Customer customer) Обновляет информацию о контрагенте в БД.voidupdateCustomerTitle(String titleBefore, Customer customer, int changedParamId, Response response) Обновляет название контрагента,генерируя его из параметров.voidupdateGroupIds(int customerId, Set<Integer> groupIds) Methods inherited from class ru.bgcrm.dao.CommonDAO
deleteById, foundRows, getById, getGroupedIds, getGroupedIds, getIds, getIds, getPageLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, update, updateColumn, updateIds, updateIds, updateOrInsert
-
Constructor Details
-
CustomerDAO
-
CustomerDAO
-
-
Method Details
-
searchCustomerList
Выбирает контрагентов по названию.- Parameters:
searchResult-title-- Throws:
SQLException
-
searchCustomerList
Выбирает контрагентов по группам.- Parameters:
searchResult-groupIds- - группы.- Throws:
SQLException
-
extractCustomerWithRef
-
searchCustomerListByEmail
public void searchCustomerListByEmail(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> emailParamIdList, String email) Выбирает контрагентов по параметру типа Email.- Parameters:
searchResult-emailParamIdList-email- Email, поиск идёт по точному совпадению и совпадению домена- Throws:
SQLException
-
searchCustomerListByText
public void searchCustomerListByText(Pageable<Customer> searchResult, List<Integer> textParamIdList, String value) throws SQLException Выбирает контрагентов по строковому параметру.- Parameters:
searchResult-textParamIdList-value-- Throws:
SQLException
-
searchCustomerListByAddress
public void searchCustomerListByAddress(Pageable<ParameterSearchedObject<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(Pageable<ParameterSearchedObject<Customer>> searchResult, List<Integer> addressParamIdList, int houseId, String houseFlat, String houseRoom) Выбирает контрагентов по адресному параметру.- Parameters:
searchResult-addressParamIdList-houseId- код домаhouseFlat- квартираhouseRoom- комната- Throws:
SQLException
-
searchCustomerListByPhone
public void searchCustomerListByPhone(Pageable<Customer> searchResult, Collection<Integer> phoneParamIdList, String... phoneNumbers) Выбирает контрагентов по номеру или номерам телефонов.- Parameters:
searchResult-phoneParamIdList-phoneNumbers-
-
searchCustomerByLinkedObjectTitle
public void searchCustomerByLinkedObjectTitle(Pageable<Customer> searchResult, String linkedObjectTypeLike, String linkedObjectTitle) Выбирает контрагентов по привязанном объектам.- Parameters:
searchResult-linkedObjectTypeLike- LIKE строка типа привязанного объекта.linkedObjectTitle- LIKE строка наименования привязанного объекта.
-
getCustomerById
Выбирает контрагента по его коду.- Parameters:
customerId-- Returns:
-
getCustomerByTitle
Выбирает контрагента по названию.- Parameters:
customerTitle- название- Returns:
- Throws:
SQLException
-
updateCustomer
Обновляет информацию о контрагенте в БД.- Parameters:
customer-- Throws:
SQLException
-
deleteCustomer
Удаляет контрагента из БД по коду.- Parameters:
id-- Throws:
SQLException
-
updateCustomerTitle
public void updateCustomerTitle(String titleBefore, Customer customer, int changedParamId, Response response) throws Exception Обновляет название контрагента,генерируя его из параметров.- Parameters:
titleBefore- исходное название.customer- контрагент.changedParamId- код изменённого параметра.response- если параметр передан, туда будет добавлено событие о изменении названия договора.- Throws:
Exception
-
getCustomerTitles
Возвращает названия контрагенов с подстрокой.- Parameters:
title- подстрока, поиск идёт с помощью LIKE выражения.count- количество первых названий.- Returns:
-
getGroupIds
- Throws:
SQLException
-
updateGroupIds
- Throws:
SQLException
-
getCustomerFromRs
- Parameters:
rs-prefix-- Throws:
SQLException
-
getCustomers
@Deprecated public static Set<Customer> getCustomers(Connection connection, Collection<Integer> customerIds) Deprecated.Получение набора контрагентов по их ID- Parameters:
customerIds- идентификаторы контрагентов- Returns:
-
getCustomers
Deprecated.Получение набора контрагентов по их ID- Parameters:
customerIds- идентификаторы контрагентов- Returns:
-