Changeset 333c40d


Ignore:
Timestamp:
02/28/23 13:42:50 (21 months ago)
Author:
DarkoSasanski <darko.sasanski@…>
Branches:
main
Children:
708a5bc
Parents:
3b4e204
Message:

Minor fixes

Location:
FullyStocked/src/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • FullyStocked/src/main/java/com/bazi/fullystocked/Services/Implementations/WorkersServiceImpl.java

    r3b4e204 r333c40d  
    4646    public List<TopUsersDTO> findAllTopUsers() {
    4747        List<TopUsersDTO> results = entityManager.createNativeQuery("""
    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)
    52            limit 1) 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)
    56            limit 1) 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)
    60            limit 1) 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
     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
    7676""")
    7777                .unwrap(NativeQuery.class)
  • FullyStocked/src/main/resources/templates/noLocWorkers.html

    r3b4e204 r333c40d  
    5757</nav>
    5858<div class="d-flex justify-content-center">
    59   <h2 class="m-2">Избери артикл</h2>
     59  <h2 class="m-2">Избери магационер</h2>
    6060</div>
    6161<table class="table">
Note: See TracChangeset for help on using the changeset viewer.