|
@@ -105,26 +105,41 @@
|
105
|
105
|
-->
|
106
|
106
|
<select id="selectStoreItemUnitInfo" resultType="com.oqpo.api.entity.stinfo.StoreItemUnitEntity">
|
107
|
107
|
select /*selectStoreItemUnitInfo*/
|
108
|
|
- case when unit.store_unit_unq_no is null then 'C' else 'R' end view_cd,
|
109
|
|
- unit.store_unit_unq_no, item.brand_id, item.item_id, item.item_nm,
|
110
|
|
- case when unit.cont_stt_dt is null or unit.cont_stt_dt = '' then date_format(#{contSttDt},'%Y.%m.%d') else date_format(unit.cont_stt_dt,'%Y.%m.%d') end as cont_stt_dt,
|
111
|
|
- case when unit.cont_end_dt is null or unit.cont_end_dt = '' then date_format(#{contEndDt},'%Y.%m.%d') else date_format(unit.cont_end_dt,'%Y.%m.%d') end as cont_end_dt,
|
112
|
|
- case when unit.unit is null or unit.unit = '' or store.loan_dvsn = 'LD03' then item.unit else unit.unit end as unit ,
|
113
|
|
- case when unit.unit is null or unit.unit = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT',item.unit) else fn_code_nm('DSTRBT_COST_UNIT',unit.unit) end as unit_nm ,
|
114
|
|
- case when nvl(unit.stdd_qty,0) = 0 or store.loan_dvsn = 'LD03' then item.store_sale_stdd_qty else unit.stdd_qty end as stdd_qty ,
|
115
|
|
- case when unit.curr is null or unit.curr = '' or store.loan_dvsn = 'LD03' then item.curr else unit.curr end as curr,
|
116
|
|
- case when unit.curr is null or unit.curr = '' or store.loan_dvsn = 'LD03' then fn_code_nm('CURR',item.curr) else fn_code_nm('CURR',unit.curr) end as curr_nm,
|
117
|
|
- case when unit.unit_amt is null or unit.unit_amt = 0 or store.loan_dvsn = 'LD03' then item.store_sale_unit_amt else unit.unit_amt end as unit_amt,
|
118
|
|
- case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then 'Y' else unit.unit_target_cd end as unit_target_cd,
|
119
|
|
- case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT','Y') else fn_code_nm('DSTRBT_COST_UNIT',unit.unit_target_cd) end as unit_target_nm,
|
120
|
|
- nvl(item.unit_amt,0) as spply_unit_amt
|
121
|
|
- ,item.brand_unit_unq_no,item.spply_id,fn_spply_nm(item.spply_id) as spply_nm
|
122
|
|
- from brand_item_unit_info item
|
123
|
|
- left outer join store_item_unit_info unit on item.brand_unit_unq_no = unit.brand_unit_unq_no and item.brand_id = unit.brand_id and item.item_id = unit.item_id and unit.store_id = #{storeId}
|
124
|
|
- and unit.cont_stt_dt = #{contSttDt} and unit.cont_end_dt = #{contEndDt}
|
125
|
|
- left outer join store_base_info store on unit.store_id = store.store_id and store.store_id = #{storeId}
|
126
|
|
- where item.brand_id = #{brandId}
|
127
|
|
- order by view_cd, item.item_id, item.unit_amt
|
|
108
|
+ case when unit.store_unit_unq_no is null then 'C' else 'R' end view_cd,
|
|
109
|
+ unit.store_unit_unq_no, item.brand_id, item.item_id, item.item_nm,
|
|
110
|
+ case when unit.cont_stt_dt is null or unit.cont_stt_dt = '' then date_format(#{contSttDt},'%Y.%m.%d') else date_format(unit.cont_stt_dt,'%Y.%m.%d') end as cont_stt_dt,
|
|
111
|
+ case when unit.cont_end_dt is null or unit.cont_end_dt = '' then date_format(#{contEndDt},'%Y.%m.%d') else date_format(unit.cont_end_dt,'%Y.%m.%d') end as cont_end_dt,
|
|
112
|
+ case when unit.unit is null or unit.unit = '' or store.loan_dvsn = 'LD03' then item.unit else unit.unit end as unit ,
|
|
113
|
+ case when unit.unit is null or unit.unit = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT',item.unit) else fn_code_nm('DSTRBT_COST_UNIT',unit.unit) end as unit_nm ,
|
|
114
|
+ case when nvl(unit.stdd_qty,0) = 0 or store.loan_dvsn = 'LD03' then item.store_sale_stdd_qty else unit.stdd_qty end as stdd_qty ,
|
|
115
|
+ case when unit.curr is null or unit.curr = '' or store.loan_dvsn = 'LD03' then item.curr else unit.curr end as curr,
|
|
116
|
+ case when unit.curr is null or unit.curr = '' or store.loan_dvsn = 'LD03' then fn_code_nm('CURR',item.curr) else fn_code_nm('CURR',unit.curr) end as curr_nm,
|
|
117
|
+ case when unit.unit_amt is null or unit.unit_amt = 0 or store.loan_dvsn = 'LD03' then item.store_sale_unit_amt else unit.unit_amt end as unit_amt,
|
|
118
|
+ case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then 'Y' else unit.unit_target_cd end as unit_target_cd,
|
|
119
|
+ case when unit.unit_target_cd is null or unit.unit_target_cd = '' or store.loan_dvsn = 'LD03' then fn_code_nm('DSTRBT_COST_UNIT','Y') else fn_code_nm('DSTRBT_COST_UNIT',unit.unit_target_cd) end as unit_target_nm,
|
|
120
|
+ nvl(item.unit_amt,0) as spply_unit_amt
|
|
121
|
+ , item.brand_unit_unq_no,item.spply_id,fn_spply_nm(item.spply_id) as spply_nm
|
|
122
|
+ , spply.spply_amt
|
|
123
|
+ from brand_item_unit_info item
|
|
124
|
+ left outer join store_item_unit_info unit
|
|
125
|
+ on item.brand_unit_unq_no = unit.brand_unit_unq_no
|
|
126
|
+ and item.brand_id = unit.brand_id
|
|
127
|
+ and item.item_id = unit.item_id
|
|
128
|
+ and unit.store_id = #{storeId}
|
|
129
|
+ and unit.cont_stt_dt = #{contSttDt} and unit.cont_end_dt = #{contEndDt}
|
|
130
|
+ left outer join store_base_info store
|
|
131
|
+ on unit.store_id = store.store_id
|
|
132
|
+ and store.store_id = #{storeId}
|
|
133
|
+ LEFT join (
|
|
134
|
+ SELECT brand_id, item_id, MAX(unit_amt) AS spply_amt
|
|
135
|
+ FROM brand_item_unit_info
|
|
136
|
+ GROUP BY brand_id, item_id
|
|
137
|
+ ) spply
|
|
138
|
+ ON item.brand_id=spply.brand_id
|
|
139
|
+ AND item.ITEM_ID = spply.item_id
|
|
140
|
+ where
|
|
141
|
+ item.brand_id = #{brandId}
|
|
142
|
+ order by view_cd, item.item_id, item.unit_amt
|
128
|
143
|
</select>
|
129
|
144
|
|
130
|
145
|
<select id="selectStoreItemUnitContDateInfo" resultType="String">
|