|
@@ -52,6 +52,7 @@
|
|
|
c.credit_code as creditCode,
|
|
|
f.inception_date as inceptionDate,
|
|
|
n.last_price_date as lastPriceDate,
|
|
|
+ fn.first_price_date as firstPriceDate,
|
|
|
r.nav_frequency as navFrequency,
|
|
|
r.asset_Frequency as assetFrequency,
|
|
|
r.valuation_Frequency as valuationFrequency,
|
|
@@ -60,6 +61,8 @@
|
|
|
left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
|
|
|
left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
|
|
|
on f.fund_id = n .fund_id
|
|
|
+ left join (select fnv.fund_id,min(fnv.price_date) as first_price_date from PPW_EMAIL.nav fnv where fnv.isvalid =1 group by fnv.fund_id) fn
|
|
|
+ on f.fund_id = fn .fund_id
|
|
|
left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
|
|
|
where f.isvalid =1
|
|
|
<if test="fundId != null and fundId !=''">
|
|
@@ -95,6 +98,14 @@
|
|
|
END,
|
|
|
a.lastPriceDate ${order}
|
|
|
</when>
|
|
|
+ <when test="sort != null and sort !='' and sort=='firstPriceDate' and order != null and order !=''">
|
|
|
+ order by
|
|
|
+ CASE
|
|
|
+ WHEN a.firstPriceDate IS NULL THEN 1
|
|
|
+ ELSE 0
|
|
|
+ END,
|
|
|
+ a.firstPriceDate ${order}
|
|
|
+ </when>
|
|
|
<otherwise>
|
|
|
order by a.lastPriceDate desc
|
|
|
</otherwise>
|
|
@@ -144,6 +155,8 @@
|
|
|
left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
|
|
|
left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
|
|
|
on f.fund_id = n .fund_id
|
|
|
+ left join (select fnv.fund_id,min(fnv.price_date) as first_price_date from PPW_EMAIL.nav fnv where fnv.isvalid =1 group by fnv.fund_id) fn
|
|
|
+ on f.fund_id = fn .fund_id
|
|
|
left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
|
|
|
where f.isvalid =1
|
|
|
<if test="fundId != null and fundId !=''">
|