From b8eaab7a975d5e4fc056a05d3f7be7f31ffdc16f Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 20 Jul 2022 16:38:49 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20=EB=A9=94=EB=AA=A8?= =?UTF-8?q?=EB=A6=AC=20=EC=9D=BC=EA=B0=84=20=EC=9E=90=EC=A0=95=EC=97=90=20?= =?UTF-8?q?=EA=B1=B8=EC=B3=90=EC=9E=88=EB=8A=94=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=20=EC=95=88=EB=90=98=EB=8A=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../memory/com.backoffice.m.memory.memory.xml | 244 +++++++++++++++++- 1 file changed, 240 insertions(+), 4 deletions(-) diff --git a/src/main/resources/sqlmap/m/memory/com.backoffice.m.memory.memory.xml b/src/main/resources/sqlmap/m/memory/com.backoffice.m.memory.memory.xml index 700652e..c65a78f 100644 --- a/src/main/resources/sqlmap/m/memory/com.backoffice.m.memory.memory.xml +++ b/src/main/resources/sqlmap/m/memory/com.backoffice.m.memory.memory.xml @@ -240,10 +240,165 @@ time_val FROM ( SELECT DATE_FORMAT(b.reg_dt, '%H:%i') as hour_min, - (DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25 as start_degree, + CASE + WHEN (b.reg_dt between DATE_SUB(STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day) and STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s')) THEN 0 + ELSE (DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25 + END + as start_degree, (select color_cd from tbl_code_item ts where ts.val_1 = c.cd_no) as category, c.title, - ifnull( + CASE + WHEN (b.reg_dt between DATE_SUB(STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day) and DATE_SUB(STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day)) THEN + ifnull( + CASE + when c.cd_no = 'BF_NU_TP_1' THEN + (select blm + brm + from tbl_bf_daily_nutrition_1 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_2' THEN + (select bm + bs + from tbl_bf_daily_nutrition_2 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_3' THEN + (select bm + bs + from tbl_bf_daily_nutrition_3 tn1 + left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_5' THEN + (select sleep_h * 60 + sleep_m + from tbl_bf_daily_nutrition_5 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_6' THEN + (select 4 + from tbl_bf_daily_nutrition_6 tn1 + inner join tbl_code_item_str tn2 + on tn2.cg_cd = 'BF_FECES_QTY' and tn1.rest_qty = tn2.val_1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_7' THEN + (select 4 + from tbl_bf_daily_nutrition_7 tn1 + inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_9' THEN + (select bm + bs + from tbl_bf_daily_nutrition_9 tn1 + left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_10' THEN + (select bm + bs + from tbl_bf_daily_nutrition_10 tn1 + left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_11' THEN + (select 4 + from tbl_bf_daily_nutrition_11 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_12' THEN + (select disturb_min + disturb_sec + from tbl_bf_daily_nutrition_12 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_13' THEN + (select 4 + from tbl_bf_daily_nutrition_13 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_14' THEN + (select 4 + from tbl_bf_daily_nutrition_14 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_15' THEN + (select 4 + from tbl_bf_daily_nutrition_15 tn1 + where tn1.dn_no = b.dn_no + ) + END, 4) * 0.25 - (360 - ((DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25)) + WHEN (DATE_ADD(b.reg_dt, INTERVAL (ifnull( + CASE + when c.cd_no = 'BF_NU_TP_1' THEN + (select blm + brm + from tbl_bf_daily_nutrition_1 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_2' THEN + (select bm + bs + from tbl_bf_daily_nutrition_2 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_3' THEN + (select bm + bs + from tbl_bf_daily_nutrition_3 tn1 + left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_5' THEN + (select sleep_h * 60 + sleep_m + from tbl_bf_daily_nutrition_5 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_6' THEN + (select 1 + from tbl_bf_daily_nutrition_6 tn1 + inner join tbl_code_item_str tn2 + on tn2.cg_cd = 'BF_FECES_QTY' and tn1.rest_qty = tn2.val_1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_7' THEN + (select 1 + from tbl_bf_daily_nutrition_7 tn1 + inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_9' THEN + (select bm + bs + from tbl_bf_daily_nutrition_9 tn1 + left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_10' THEN + (select bm + bs + from tbl_bf_daily_nutrition_10 tn1 + left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_11' THEN + (select 1 + from tbl_bf_daily_nutrition_11 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_12' THEN + (select disturb_min + disturb_sec + from tbl_bf_daily_nutrition_12 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_13' THEN + (select 1 + from tbl_bf_daily_nutrition_13 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_14' THEN + (select 1 + from tbl_bf_daily_nutrition_14 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_15' THEN + (select 1 + from tbl_bf_daily_nutrition_15 tn1 + where tn1.dn_no = b.dn_no + ) + END, 1)) MINUTE) between STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s') and DATE_ADD(STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 DAY)) THEN + (360 - ((DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25)) + ELSE ifnull( CASE when c.cd_no = 'BF_NU_TP_1' THEN (select blm + brm @@ -316,7 +471,9 @@ from tbl_bf_daily_nutrition_15 tn1 where tn1.dn_no = b.dn_no ) - END, 4) * 0.25 AS add_degree, + END, 4) * 0.25 + END + AS add_degree, CASE WHEN c.cd_no = 'BF_NU_TP_1' THEN ( @@ -440,7 +597,86 @@ INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no INNER JOIN tbl_bf_family_baby d on a.smc_no = d.smc_no WHERE a.smc_no = #smc_no# - and b.reg_dt between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s') + and ( + b.reg_dt between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s') + OR + DATE_ADD(b.reg_dt, INTERVAL ( + ifnull( + CASE + when c.cd_no = 'BF_NU_TP_1' THEN + (select blm + brm + from tbl_bf_daily_nutrition_1 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_2' THEN + (select bm + bs + from tbl_bf_daily_nutrition_2 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_3' THEN + (select bm + bs + from tbl_bf_daily_nutrition_3 tn1 + left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_5' THEN + (select sleep_h * 60 + sleep_m + from tbl_bf_daily_nutrition_5 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_6' THEN + (select 1 + from tbl_bf_daily_nutrition_6 tn1 + inner join tbl_code_item_str tn2 + on tn2.cg_cd = 'BF_FECES_QTY' and tn1.rest_qty = tn2.val_1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_7' THEN + (select 1 + from tbl_bf_daily_nutrition_7 tn1 + inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_9' THEN + (select bm + bs + from tbl_bf_daily_nutrition_9 tn1 + left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_10' THEN + (select bm + bs + from tbl_bf_daily_nutrition_10 tn1 + left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_11' THEN + (select 1 + from tbl_bf_daily_nutrition_11 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_12' THEN + (select disturb_min + disturb_sec + from tbl_bf_daily_nutrition_12 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_13' THEN + (select 1 + from tbl_bf_daily_nutrition_13 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_14' THEN + (select 1 + from tbl_bf_daily_nutrition_14 tn1 + where tn1.dn_no = b.dn_no + ) + when c.cd_no = 'BF_NU_TP_15' THEN + (select 1 + from tbl_bf_daily_nutrition_15 tn1 + where tn1.dn_no = b.dn_no + ) + END, 1) + ) MINUTE) between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s') + ) and b.nutirition_cd_no != '' GROUP BY dn_no ORDER BY add_degree desc