MyTetra Share
Делитесь знаниями!
Заготовка
Время создания: 28.04.2020 14:09
Раздел: INFO - JOB - rtneo - Работа над задачами - Создание договоров
Запись: wwwlir/Tetra/master/base/15880541970uucztyvdn/text.html на raw.githubusercontent.com

List<Contract> contracts = dataManager.load(Contract.class)
.query(
"select c from rtneo$Contract c where c.contragent.id = :contragent and c.mainContract.id = :mainContract and c.accepted is not null and c.accepted = true and c.from <= :contractFrom and c.id <> :currentContract or c.id = :mainContract order by c.from desc")
.setParameters(ParamsMap.
of("contragent", entity.getContragent().getId(), "mainContract", entity.getMainContract().getId(), "contractFrom", entity.getFrom(), "currentContract", entity.getId()))
.view(
"_local")
.list()
;
//entity


//Без даты

List<Contract> contracts = dataManager.load(Contract.class)
.query(
"select c from rtneo$Contract c where c.contragent.id = :contragent and c.mainContract.id = :mainContract and c.accepted is not null and c.accepted = true and c.id <> :currentContract or c.id = :mainContract order by c.from asc")
.setParameters(ParamsMap.
of("contragent", entity.getContragent().getId(), "mainContract", entity.getMainContract().getId(), "currentContract", entity.getId()))
.view(
"_local")
.list()
;
//entity\


List<Bill> bills = dataManager.load(Bill.class)
.query(
"select b from rtneo$Bill b where b.contract.id in (select c.id from rtneo$Contract c where c.contragent.id = :contragent and c.mainContract.id = :mainContract and c.accepted is not null and c.accepted = true and c.id <> :currentContract or c.id = :mainContract) order by b.contract.from asc")
.setParameters(ParamsMap.
of("contragent", entity.getContragent().getId(), "mainContract", entity.getMainContract().getId(), "currentContract", entity.getId()))
.view(
"_local")
.list()
;

//С датами

List<Bill> bills = dataManager.load(Bill.class)
.query(
"select b from rtneo$Bill b where b.contract.id in (select c.id from rtneo$Contract c where c.contragent.id = :contragent and c.mainContract.id = :mainContract and c.accepted is not null and c.accepted = true and c.id <> :currentContract or c.id = :mainContract) and b.period >= :periodStart and b.period <= :periodEnd order by b.contract.from asc")
.setParameters(ParamsMap.
of("contragent", entity.getContragent().getId(), "mainContract", entity.getMainContract().getId(), "currentContract", entity.getId(), "periodStart", entity.getFrom(), "periodEnd", entity.getBefore()))
.view(
"_local")
.list()

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования