|
@@ -0,0 +1,60 @@
|
|
|
+package in.ocsf.report.app.controller;/* kpmy 05.03.2017 */
|
|
|
+
|
|
|
+import com.querydsl.collections.CollQueryFactory;
|
|
|
+import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
+import in.ocsf.report.api.ReportPrototype;
|
|
|
+import in.ocsf.report.api.StagePrototype;
|
|
|
+import in.ocsf.report.api.TablePrototype;
|
|
|
+import in.ocsf.report.app.object.Address;
|
|
|
+import in.ocsf.report.app.repo.AddressRepository;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static in.ocsf.report.app.object.QAddress.address;
|
|
|
+import static in.ocsf.report.app.spec.AddressSpecifications.hasParent;
|
|
|
+import static in.ocsf.report.app.spec.AddressSpecifications.isActual;
|
|
|
+import static org.springframework.data.jpa.domain.Specifications.where;
|
|
|
+
|
|
|
+@RestController
|
|
|
+public class TestController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private JPAQueryFactory jpaQueryFactory;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AddressRepository addrRepo;
|
|
|
+
|
|
|
+ @RequestMapping("test/init")
|
|
|
+ public Object init(@RequestParam("name") String name){
|
|
|
+ ReportPrototype report = new ReportPrototype();
|
|
|
+
|
|
|
+ TablePrototype table0 = new TablePrototype();
|
|
|
+
|
|
|
+ StagePrototype stage0 = new StagePrototype();
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("test/repo/address")
|
|
|
+ public List<Address> addr() {
|
|
|
+ List<Address> top = addrRepo.findActualTop();
|
|
|
+ for (Address address : top) {
|
|
|
+ List<Address> next = addrRepo.findAll(where(hasParent(address.getGuid())).and(isActual()));
|
|
|
+ }
|
|
|
+
|
|
|
+ Address yar = jpaQueryFactory.selectFrom(address)
|
|
|
+ .where(address.region.like("76").and(address.parentGuid.isNull()))
|
|
|
+ .fetchFirst();
|
|
|
+
|
|
|
+ String yarName0 = jpaQueryFactory.select(address.name).from(address).where(address.region.like("76").and(address.parentGuid.isNull())).fetchFirst();
|
|
|
+
|
|
|
+ String yarName1 = CollQueryFactory.from(address, top).select(address.name).where(address.region.like("76").and(address.parentGuid.isNull())).fetchFirst();
|
|
|
+
|
|
|
+ Iterable<Address> yars = addrRepo.findAll(address.region.like("76").and(address.parentGuid.isNull()));
|
|
|
+ return top;
|
|
|
+ }
|
|
|
+}
|