public class CustomerDAO extends CommonDAO
CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T extends Id>
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 and Description |
---|
CustomerDAO(java.sql.Connection con) |
CustomerDAO(java.sql.Connection con,
boolean history,
int userId) |
Modifier and Type | Method and Description |
---|---|
void |
deleteCustomer(int id)
Удаляет контрагента из БД по коду.
|
Customer |
extractCustomerWithRef(int customerId) |
Customer |
getCustomerById(int customerId)
Выбирает контрагента по его коду.
|
Customer |
getCustomerByLinkedContract(Contract contract)
Deprecated.
|
Customer |
getCustomerByLinkedObject(int id,
java.lang.String title) |
Customer |
getCustomerByTitle(java.lang.String customerTitle)
Deprecated.
|
static Customer |
getCustomerFromRs(java.sql.ResultSet rs,
java.lang.String prefix)
Возвращает созданный объект
Customer заполненный из ResultSet . |
java.util.Set<Customer> |
getCustomers(java.util.Collection<java.lang.Integer> customerIds)
Получение набора контрагентов по их ID
|
static java.util.Set<Customer> |
getCustomers(java.sql.Connection connection,
java.util.Collection<java.lang.Integer> customerIds)
Получение набора контрагентов по их ID
|
java.util.List<Customer> |
getCustomersByLinkedContractsTitle(java.lang.String contractTitle) |
java.util.Set<Customer> |
getCustomersByParamGroupId(int paramGroupId) |
java.util.ArrayList<Customer> |
getCustomersByPhone(java.lang.String phone,
int paramId) |
void |
getCustomersByPhoneByTuu(SearchResult<Customer> searchResult,
java.util.Collection<java.lang.Integer> phoneParamIdList,
java.lang.String... phoneNumbers) |
void |
getCustomersByPhoneFromDailyAppeal(SearchResult<Customer> searchResult,
java.util.Collection<java.lang.Integer> phoneParamIdList,
java.lang.String... phoneNumbers) |
java.util.List<java.lang.String> |
getCustomerTitles(java.lang.String title,
int count)
Возвращает названия контрагенов с подстрокой.
|
java.util.Set<java.lang.Integer> |
getGroupIds(int customerId) |
java.util.Optional<Customer> |
getLinkedCustomerToObject(int objectId) |
java.util.List<Customer> |
getLinkedCustomerToObjectList(int objectId) |
java.util.Set<Customer> |
searchByParamText(int paramId,
java.lang.String value) |
java.util.Set<java.lang.Integer> |
searchByParamText(java.lang.String text1,
int paramId1,
java.lang.String text2,
int paramId2)
Поиск контрагента по параметру типа "текст"
|
void |
searchCustomerByLink(SearchResult<CustomerDTO> searchResult,
java.lang.String linkedObjectTitle,
java.lang.String linkedObjectType) |
java.util.List<Customer> |
searchCustomerByLinkedObjectId(int linkedObjectId,
java.lang.String linkedObjectTypeLike)
Deprecated.
|
void |
searchCustomerByLinkedObjectTitle(SearchResult<Customer> searchResult,
java.lang.String linkedObjectTypeLike,
java.lang.String linkedObjectTitle) |
void |
searchCustomerList(SearchResult<Customer> searchResult,
java.util.Set<java.lang.Integer> groupIds)
Выбирает контрагентов по группам.
|
void |
searchCustomerList(SearchResult<Customer> searchResult,
java.lang.String title)
Выбирает контрагентов по названию.
|
void |
searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult,
java.util.List<java.lang.Integer> addressParamIdList,
int houseId,
java.lang.String houseFlat,
java.lang.String houseRoom)
Выбирает контрагентов по адресному параметру.
|
void |
searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult,
java.util.List<java.lang.Integer> addressParamIdList,
int streetId,
java.lang.String house,
java.lang.String houseFlat,
java.lang.String houseRoom)
Выбирает контрагентов по адресному параметру.
|
void |
searchCustomerListByEmail(SearchResult<ParameterSearchedObject<Customer>> searchResult,
java.util.List<java.lang.Integer> emailParamIdList,
java.lang.String email)
Выбирает контрагентов по параметру типа E-Mail.
|
void |
searchCustomerListByPhone(SearchResult<Customer> searchResult,
java.util.Collection<java.lang.Integer> phoneParamIdList,
java.lang.String... phoneNumbers) |
void |
searchCustomerListByText(SearchResult<Customer> searchResult,
java.util.List<java.lang.Integer> textParamIdList,
java.lang.String value)
Выбирает контрагентов по строковому параметру.
|
Customer |
update(Customer customer) |
void |
updateCustomer(Customer customer)
Deprecated.
Use
update(Customer) instead. |
void |
updateCustomerTitle(java.lang.String titleBefore,
Customer customer,
int changedParamId,
Response response)
Обновляет название контрагента,генерируя его из параметров.
|
void |
updateGroupIds(int customerId,
java.util.Set<java.lang.Integer> groupIds) |
deleteById, execute, execute, execute, executeInsert, executeUpdate, getById, getFoundRows, getFoundRows, getGroupedIds, getGroupedIds, getIds, getIds, getLikePattern, getLikePatternEnd, getLikePatternStart, getLikePatternSub, getMySQLLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, sqlToBgException, update, updateColumn, updateIds, updateIds
public CustomerDAO(java.sql.Connection con)
public CustomerDAO(java.sql.Connection con, boolean history, int userId)
public void searchCustomerList(SearchResult<Customer> searchResult, java.lang.String title) throws BGException
searchResult
- title
- java.sql.SQLException
BGException
public void searchCustomerList(SearchResult<Customer> searchResult, java.util.Set<java.lang.Integer> groupIds) throws BGException
searchResult
- groupIds
- - группы.java.sql.SQLException
BGException
public Customer extractCustomerWithRef(int customerId) throws BGException
BGException
public void searchCustomerListByEmail(SearchResult<ParameterSearchedObject<Customer>> searchResult, java.util.List<java.lang.Integer> emailParamIdList, java.lang.String email) throws BGException
searchResult
- emailParamIdList
- email
- java.sql.SQLException
BGException
public void searchCustomerListByText(SearchResult<Customer> searchResult, java.util.List<java.lang.Integer> textParamIdList, java.lang.String value) throws java.sql.SQLException
searchResult
- textParamIdList
- value
- java.sql.SQLException
public void searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, java.util.List<java.lang.Integer> addressParamIdList, int streetId, java.lang.String house, java.lang.String houseFlat, java.lang.String houseRoom) throws java.sql.SQLException
searchResult
- addressParamIdList
- streetId
- house
- houseFlat
- houseRoom
- java.sql.SQLException
public void searchCustomerListByAddress(SearchResult<AddressSearchedObject<Customer>> searchResult, java.util.List<java.lang.Integer> addressParamIdList, int houseId, java.lang.String houseFlat, java.lang.String houseRoom) throws BGException
searchResult
- addressParamIdList
- houseId
- код домаhouseFlat
- квартираhouseRoom
- комнатаjava.sql.SQLException
BGException
public void searchCustomerListByPhone(SearchResult<Customer> searchResult, java.util.Collection<java.lang.Integer> phoneParamIdList, java.lang.String... phoneNumbers) throws BGException
BGException
public java.util.ArrayList<Customer> getCustomersByPhone(java.lang.String phone, int paramId) throws BGException
BGException
public void getCustomersByPhoneFromDailyAppeal(SearchResult<Customer> searchResult, java.util.Collection<java.lang.Integer> phoneParamIdList, java.lang.String... phoneNumbers) throws BGException
BGException
public void getCustomersByPhoneByTuu(SearchResult<Customer> searchResult, java.util.Collection<java.lang.Integer> phoneParamIdList, java.lang.String... phoneNumbers) throws BGException
BGException
public java.util.List<Customer> getCustomersByLinkedContractsTitle(java.lang.String contractTitle) throws BGException
BGException
public Customer getCustomerByLinkedObject(int id, java.lang.String title) throws BGException
BGException
@Deprecated public Customer getCustomerByLinkedContract(Contract contract) throws BGException
BGException
public void searchCustomerByLinkedObjectTitle(SearchResult<Customer> searchResult, java.lang.String linkedObjectTypeLike, java.lang.String linkedObjectTitle) throws BGException
BGException
public void searchCustomerByLink(SearchResult<CustomerDTO> searchResult, java.lang.String linkedObjectTitle, java.lang.String linkedObjectType)
@Deprecated public java.util.List<Customer> searchCustomerByLinkedObjectId(int linkedObjectId, java.lang.String linkedObjectTypeLike) throws BGException
linkedObjectId
- linkedObjectTypeLike
- BGException
public java.util.Optional<Customer> getLinkedCustomerToObject(int objectId) throws BGException
BGException
public java.util.List<Customer> getLinkedCustomerToObjectList(int objectId) throws BGException
BGException
public Customer getCustomerById(int customerId) throws BGException
customerId
- BGException
public static java.util.Set<Customer> getCustomers(java.sql.Connection connection, java.util.Collection<java.lang.Integer> customerIds) throws BGException
customerIds
- идентификаторы контрагентовBGException
public java.util.Set<Customer> getCustomers(java.util.Collection<java.lang.Integer> customerIds) throws BGException
customerIds
- идентификаторы контрагентовBGException
@Deprecated public Customer getCustomerByTitle(java.lang.String customerTitle) throws java.sql.SQLException
searchCustomerList
customerTitle
- названиеjava.sql.SQLException
@Deprecated public void updateCustomer(Customer customer) throws java.sql.SQLException
update(Customer)
instead.customer
- java.sql.SQLException
public void deleteCustomer(int id) throws java.sql.SQLException
id
- java.sql.SQLException
public void updateCustomerTitle(java.lang.String titleBefore, Customer customer, int changedParamId, Response response) throws BGException
titleBefore
- исходное название.customer
- контрагент.changedParamId
- код изменённого параметра.response
- если параметр передан, туда будет добавлено событие о изменении названия договора.BGException
public java.util.List<java.lang.String> getCustomerTitles(java.lang.String title, int count) throws BGException
title
- подстрока, поиск идёт с помощью LIKE выражения.count
- количество первых названий.BGException
public java.util.Set<java.lang.Integer> getGroupIds(int customerId) throws BGException
BGException
public void updateGroupIds(int customerId, java.util.Set<java.lang.Integer> groupIds) throws BGException
BGException
public static Customer getCustomerFromRs(java.sql.ResultSet rs, java.lang.String prefix) throws java.sql.SQLException
Customer
заполненный из ResultSet
.rs
- prefix
- java.sql.SQLException
public java.util.Set<java.lang.Integer> searchByParamText(java.lang.String text1, int paramId1, java.lang.String text2, int paramId2) throws BGException
text2
- paramId2
- BGException
public java.util.Set<Customer> searchByParamText(int paramId, java.lang.String value) throws BGException
BGException
public java.util.Set<Customer> getCustomersByParamGroupId(int paramGroupId)