--- src/main/resources/mybatis/mapper/cntnStats/cntnStats-SQL.xml
+++ src/main/resources/mybatis/mapper/cntnStats/cntnStats-SQL.xml
... | ... | @@ -237,7 +237,7 @@ |
237 | 237 |
SELECT ai.dates |
238 | 238 |
, array_agg(authrt_nm) AS authrt_nm |
239 | 239 |
, array_agg(COALESCE(ucs.cntn_nope, 0)) AS cntn_nope |
240 |
- FROM (SELECT generate_series(to_date(#{startDt}, 'YYYY-MM-DD'), to_date(#{endDt}, 'YYYY-MM-DD'), '1 day'::interval)::date AS dates , authrt_cd , authrt_nm FROM authrt_info) AS ai |
|
240 |
+ FROM (SELECT generate_series(to_date(#{startDt}, 'YYYY-MM-DD'), to_date(#{endDt}, 'YYYY-MM-DD'), '1 day'::interval)::date AS dates , authrt_cd , authrt_nm FROM authrt_info WHERE use_yn = 'Y') AS ai |
|
241 | 241 |
LEFT JOIN (SELECT authrt_cd, to_date(concat(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD') AS cntn_date, cntn_nope FROM user_cntn_stats) AS ucs |
242 | 242 |
ON dates = ucs.cntn_date |
243 | 243 |
AND ai.authrt_cd = ucs.authrt_cd |
... | ... | @@ -280,17 +280,20 @@ |
280 | 280 |
AND mi.menu_nm != '메인' |
281 | 281 |
) |
282 | 282 |
select (SELECT menu_name FROM menu_tree WHERE menu_tree.menu_id = menus.menu_id) AS menu_name |
283 |
- , array_agg((SELECT authrt_nm FROM authrt_info WHERE authrt_info.authrt_cd = menus.authrt_cd)) AS authrt_nm |
|
283 |
+ , array_agg((SELECT authrt_nm FROM authrt_info WHERE authrt_info.authrt_cd = menus.authrt_cd AND authrt_info.use_yn = 'Y')) AS authrt_nm |
|
284 | 284 |
, array_agg(cntn_nope) AS cntn_nope |
285 | 285 |
from (select mt.menu_id, mai.authrt_cd, SUM(COALESCE(mcs.cntn_nope, 0)) AS cntn_nope |
286 | 286 |
from menu_tree AS mt |
287 | 287 |
LEFT JOIN menu_authrt_info AS mai |
288 | 288 |
ON mt.menu_id = mai.menu_id |
289 |
+ LEFT JOIN authrt_info AS ai |
|
290 |
+ ON mai.authrt_cd = ai.authrt_cd |
|
289 | 291 |
LEFT JOIN menu_cntn_stats AS mcs |
290 | 292 |
ON mt.menu_id = mcs.menu_id |
291 | 293 |
AND mai.authrt_cd = mcs.authrt_cd |
292 | 294 |
AND TO_DATE(CONCAT(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD') >= TO_DATE(#{startDt}, 'YYYY-MM-DD') |
293 | 295 |
AND TO_DATE(#{endDt}, 'YYYY-MM-DD') >= TO_DATE(CONCAT(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD') |
296 |
+ WHERE ai.use_yn='Y' |
|
294 | 297 |
group by mt.menu_id, mai.authrt_cd) as menus |
295 | 298 |
group by menu_id |
296 | 299 |
order by menu_name |
... | ... | @@ -314,8 +317,8 @@ |
314 | 317 |
INNER JOIN menu_info mi |
315 | 318 |
ON mt.menu_id = mi.up_menu_id |
316 | 319 |
) |
317 |
- select sum(menu.cntn_nope) |
|
318 |
- from menu_tree |
|
320 |
+ SELECT sum(menu.cntn_nope) |
|
321 |
+ FROM menu_tree |
|
319 | 322 |
LEFT JOIN ( |
320 | 323 |
SELECT menu_id, cntn_nope |
321 | 324 |
FROM menu_cntn_stats |
... | ... | @@ -334,20 +337,23 @@ |
334 | 337 |
내 용 : 게시판 접속 통계 목록 조회 |
335 | 338 |
--> |
336 | 339 |
<select id="selectBbsCntnStats" parameterType="HashMap" resultType="HashMap"> |
337 |
- select (select bbs_nm from bbs_mng where bbs_mng_id = bbs.bbs_mng_id) AS bbs_nm |
|
338 |
- , array_agg((SELECT authrt_nm FROM authrt_info WHERE authrt_info.authrt_cd = bbs.authrt_cd)) AS authrt_nm |
|
340 |
+ SELECT (SELECT bbs_nm from bbs_mng where bbs_mng_id = bbs.bbs_mng_id) AS bbs_nm |
|
341 |
+ , array_agg((SELECT authrt_nm FROM authrt_info WHERE authrt_info.authrt_cd = bbs.authrt_cd AND authrt_info.use_yn = 'Y')) AS authrt_nm |
|
339 | 342 |
, array_agg(coalesce(cntn_nope, 0)) AS cntn_nope |
340 | 343 |
from ( |
341 |
- select bm.bbs_mng_id |
|
344 |
+ SELECT bm.bbs_mng_id |
|
342 | 345 |
, ad.authrt_cd |
343 | 346 |
from bbs_mng as bm |
344 | 347 |
left join ( |
345 |
- select mai.authrt_cd |
|
348 |
+ SELECT mai.authrt_cd |
|
346 | 349 |
, menu_type_ctgry |
347 | 350 |
from menu_info as mi |
348 |
- left join menu_authrt_info as mai |
|
351 |
+ LEFT JOIN menu_authrt_info as mai |
|
349 | 352 |
on mi.menu_id = mai.menu_id |
350 |
- where use_yn = 'Y' |
|
353 |
+ LEFT JOIN authrt_info AS ai |
|
354 |
+ ON mai.authrt_cd = ai.authrt_cd |
|
355 |
+ WHERE mi.use_yn = 'Y' |
|
356 |
+ AND ai.use_yn='Y' |
|
351 | 357 |
order by mi.menu_id |
352 | 358 |
) as ad |
353 | 359 |
on bm.bbs_mng_id = ad.menu_type_ctgry |
... | ... | @@ -382,9 +388,12 @@ |
382 | 388 |
select mai.authrt_cd |
383 | 389 |
, menu_type_ctgry |
384 | 390 |
from menu_info as mi |
385 |
- left join menu_authrt_info as mai |
|
391 |
+ LEFT JOIN menu_authrt_info as mai |
|
386 | 392 |
on mi.menu_id = mai.menu_id |
387 |
- where use_yn = 'Y' |
|
393 |
+ LEFT JOIN authrt_info AS ai |
|
394 |
+ ON mai.authrt_cd = ai.authrt_cd |
|
395 |
+ WHERE mi.use_yn = 'Y' |
|
396 |
+ AND ai.use_yn='Y' |
|
388 | 397 |
order by mi.menu_id |
389 | 398 |
) as ad |
390 | 399 |
on bm.bbs_mng_id = ad.menu_type_ctgry |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?