@ -3,6 +3,7 @@
<sqlMap namespace= "com.backoffice.m.memory" >
<sqlMap namespace= "com.backoffice.m.memory" >
<select id= "select_week" resultClass= "dataMap" parameterClass= "dataMap" >
<select id= "select_week" resultClass= "dataMap" parameterClass= "dataMap" >
SELECT
SELECT
XA.dn_no,
XA.day,
XA.day,
XA.dd,
XA.dd,
XA.hour,
XA.hour,
@ -214,7 +215,8 @@
FROM tbl_bf_daily_nutrition_15 tn1
FROM tbl_bf_daily_nutrition_15 tn1
WHERE tn1.dn_no = b.dn_no
WHERE tn1.dn_no = b.dn_no
)
)
END AS time_val
END AS time_val,
b.dn_no as dn_no
FROM tbl_bf_family_match a
FROM tbl_bf_family_match a
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
@ -222,14 +224,16 @@
a.smc_no = #smc_no#
a.smc_no = #smc_no#
and b.nutirition_cd_no != ''
and b.nutirition_cd_no != ''
and b.reg_dt between STR_TO_DATE(#startDate#,'%Y-%m-%d %H:%i:%s') and ADDDATE( STR_TO_DATE(#endDate#,'%Y-%m-%d %H:%i:%s'), INTERVAL 7 DAY)
and b.reg_dt between STR_TO_DATE(#startDate#,'%Y-%m-%d %H:%i:%s') and ADDDATE( STR_TO_DATE(#endDate#,'%Y-%m-%d %H:%i:%s'), INTERVAL 7 DAY)
group by DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H'), DATE_FORMAT(b.reg_dt, '%H'), DATE_FORMAT(b.reg_dt, '%d'), LPAD(c.val_1, 2, '0')
group by dn_no, DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H'), DATE_FORMAT(b.reg_dt, '%H'), DATE_FORMAT(b.reg_dt, '%d'), LPAD(c.val_1, 2, '0')
order by DATE_FORMAT(b.reg_dt, '%Y-%m-%d') asc, DATE_FORMAT(b.reg_dt, '%H') asc, DATE_FORMAT(b.reg_dt, '%d') asc, LPAD(c.val_1, 2, '0') asc
order by DATE_FORMAT(b.reg_dt, '%Y-%m-%d') asc, DATE_FORMAT(b.reg_dt, '%H') asc, DATE_FORMAT(b.reg_dt, '%d') asc, LPAD(c.val_1, 2, '0') asc
) XA
) XA
where XA.time_val is not null
where XA.time_val is not null
</select>
</select>
<select id= "select_day" resultClass= "dataMap" parameterClass= "dataMap" >
<select id= "select_day" resultClass= "dataMap" parameterClass= "dataMap" >
SELECT start_degree,
SELECT
dn_no,
start_degree,
category,
category,
title,
title,
CASE WHEN add_degree = '0' then '1' else add_degree END as add_degree,
CASE WHEN add_degree = '0' then '1' else add_degree END as add_degree,
@ -263,14 +267,14 @@
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_6' THEN
when c.cd_no = 'BF_NU_TP_6' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_6 tn1
from tbl_bf_daily_nutrition_6 tn1
inner join tbl_code_item_str tn2
inner join tbl_code_item_str tn2
on tn2.cg_cd = 'BF_FECES_QTY' and tn1.rest_qty = tn2.val_1
on tn2.cg_cd = 'BF_FECES_QTY' and tn1.rest_qty = tn2.val_1
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_7' THEN
when c.cd_no = 'BF_NU_TP_7' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_7 tn1
from tbl_bf_daily_nutrition_7 tn1
inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no
inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
@ -288,7 +292,7 @@
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_11' THEN
when c.cd_no = 'BF_NU_TP_11' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_11 tn1
from tbl_bf_daily_nutrition_11 tn1
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
@ -298,17 +302,17 @@
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_13' THEN
when c.cd_no = 'BF_NU_TP_13' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_13 tn1
from tbl_bf_daily_nutrition_13 tn1
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_14' THEN
when c.cd_no = 'BF_NU_TP_14' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_14 tn1
from tbl_bf_daily_nutrition_14 tn1
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
when c.cd_no = 'BF_NU_TP_15' THEN
when c.cd_no = 'BF_NU_TP_15' THEN
(select 1
(select 4
from tbl_bf_daily_nutrition_15 tn1
from tbl_bf_daily_nutrition_15 tn1
where tn1.dn_no = b.dn_no
where tn1.dn_no = b.dn_no
)
)
@ -429,7 +433,8 @@
FROM tbl_bf_daily_nutrition_15 tn1
FROM tbl_bf_daily_nutrition_15 tn1
WHERE tn1.dn_no = b.dn_no
WHERE tn1.dn_no = b.dn_no
)
)
END AS time_val
END AS time_val,
b.dn_no as dn_no
FROM tbl_bf_family_match a
FROM tbl_bf_family_match a
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
@ -437,7 +442,7 @@
WHERE a.smc_no = #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')
and b.nutirition_cd_no != ''
and b.nutirition_cd_no != ''
GROUP BY DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H:%i:')
GROUP BY dn_no
ORDER BY add_degree desc
ORDER BY add_degree desc
) XA
) XA
where XA.time_val is not null
where XA.time_val is not null