Changeset 333c40d
- Timestamp:
- 02/28/23 13:42:50 (22 months ago)
- Branches:
- main
- Children:
- 708a5bc
- Parents:
- 3b4e204
- Location:
- FullyStocked/src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations/WorkersServiceImpl.java
r3b4e204 r333c40d 46 46 public List<TopUsersDTO> findAllTopUsers() { 47 47 List<TopUsersDTO> results = entityManager.createNativeQuery(""" 48 49 50 51 where i2.price*i2.quantity=max(ba.totalPrice)52 limit 1) as topArticleName,53 54 55 where i2.price*i2.quantity=max(ba.totalPrice)56 limit 1) as topArticlePrice,57 58 59 where i2.price*i2.quantity=max(ba.totalPrice)60 limit 1) as topArticleQuantity,61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 48 select u.firstname, u.lastname, u.username, u.email, coalesce(max(ti.totalPrice), 0) as topInvoiceSum, 49 (select a.articlename from project.articles a 50 left join project.invoicedarticles i2 on i2.articleid=a.articleid 51 where i2.price*i2.quantity=max(ba.totalPrice) and i2.invoiceid = min(ti.invoiceid) 52 ) as topArticleName, 53 (select i2.price from project.articles a 54 left join project.invoicedarticles i2 on i2.articleid=a.articleid 55 where i2.price*i2.quantity=max(ba.totalPrice) and i2.invoiceid = min(ti.invoiceid) 56 ) as topArticlePrice, 57 (select i2.quantity from project.articles a 58 left join project.invoicedarticles i2 on i2.articleid=a.articleid 59 where i2.price*i2.quantity=max(ba.totalPrice) and i2.invoiceid = min(ti.invoiceid) 60 ) as topArticleQuantity, 61 max(ba.totalPrice) as topArticleTotalPrice from project.workers w 62 left join project.users u on u.userid=w.userid 63 left join 64 ( 65 select i.invoiceid, i.workeruserid , sum(ia.price*ia.quantity) as totalPrice from project.invoices i 66 left join project.invoicedarticles ia on ia.invoiceid=i.invoiceid 67 group by i.invoiceid, i.workeruserid 68 ) ti on ti.workeruserid=u.userid 69 left join 70 ( 71 select ia2.invoiceid, a.articlename, ia2.price as price, ia2.quantity as quantity, ia2.price*ia2.quantity as totalPrice from project.invoicedarticles ia2 72 left join project.articles a on a.articleid=ia2.articleid 73 ) ba on ba.invoiceid=ti.invoiceid 74 group by u.userid 75 order by topInvoiceSum desc 76 76 """) 77 77 .unwrap(NativeQuery.class) -
FullyStocked/src/main/resources/templates/noLocWorkers.html
r3b4e204 r333c40d 57 57 </nav> 58 58 <div class="d-flex justify-content-center"> 59 <h2 class="m-2">Избери артикл</h2>59 <h2 class="m-2">Избери магационер</h2> 60 60 </div> 61 61 <table class="table">
Note:
See TracChangeset
for help on using the changeset viewer.