123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.oqpo.api.mapper.stinfo.ItemUnitMapper">
- <select id="selectItemUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /*selectItemUnitGridList*/
- iunit.brand_unit_unq_no, iunit.brand_id, iunit.item_id, iunit.item_nm, iunit.spply_id,
- iunit.spply_nm, date_format(iunit.cont_stt_dt,'%Y.%m.%d') as cont_stt_dt, date_format(iunit.cont_end_dt,'%Y.%m.%d') as cont_end_dt,
- iunit.curr, fn_code_nm('CURR', iunit.curr) as curr_nm, iunit.unit, fn_code_nm('DSTRBT_COST_UNIT', iunit.unit) as unit_nm,
- iunit.unit_amt, iunit.lead_time, iunit.spply_item_id,
- iunit.unit_st_cd, fn_code_nm('UNIT_ST_CD', iunit.unit_st_cd) as unit_st_nm, iunit.stdd_qty
- from brand_item_unit_info iunit
- join item_base_info item on iunit.brand_id = item.brand_id and iunit.item_id = item.item_id
- left outer join item_class_ptcl iclas on item.item_id = iclas.item_id
- left outer join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
- where iunit.brand_id = #{sBrandId}
- <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
- and iunit.cont_stt_dt between #{fromDt} and #{toDt}
- and #{toDt} between iunit.cont_stt_dt and iunit.cont_end_dt
- </if>
- <if test="sUnitStCd != null and sUnitStCd != ''">
- and iunit.unit_st_cd = #{sUnitStCd}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and iunit.spply_id = #{sSpplyId}
- </if>
- <if test="sClass1 != null and sClass1 != ''">
- and iclas.item_class1 = #{sClass1}
- </if>
- <if test="sClass2 != null and sClass2 != ''">
- and iclas.item_class2 = #{sClass2}
- </if>
- <if test="sClass3 != null and sClass3 != ''">
- and iclas.item_class3 = #{sClass3}
- </if>
- <if test="sClass4 != null and sClass4 != ''">
- and iclas.item_class4 = #{sClass4}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and iunit.item_id like concat('%',#{sItemNm},'%') or iunit.item_nm like concat('%',#{sItemNm},'%')
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iunit.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iunit.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iunit.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectItemUnitGridCnt" resultType="int">
- select /*selectBrandGridCnt*/
- count(*)
- from brand_item_unit_info iunit
- join item_base_info item on iunit.brand_id = item.brand_id and iunit.item_id = item.item_id
- left outer join item_class_ptcl iclas on item.item_id = iclas.item_id
- left outer join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
- where iunit.brand_id = #{sBrandId}
- <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
- and iunit.cont_stt_dt between #{fromDt} and #{toDt}
- and #{toDt} between iunit.cont_stt_dt and iunit.cont_end_dt
- </if>
- <if test="sUnitStCd != null and sUnitStCd != ''">
- and iunit.unit_st_cd = #{sUnitStCd}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and iunit.spply_id = #{sSpplyId}
- </if>
- <if test="sClass1 != null and sClass1 != ''">
- and iclas.item_class1 = #{sClass1}
- </if>
- <if test="sClass2 != null and sClass2 != ''">
- and iclas.item_class2 = #{sClass2}
- </if>
- <if test="sClass3 != null and sClass3 != ''">
- and iclas.item_class3 = #{sClass3}
- </if>
- <if test="sClass4 != null and sClass4 != ''">
- and iclas.item_class4 = #{sClass4}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and iunit.item_id like concat('%',#{sItemNm},'%') or iunit.item_nm like concat('%',#{sItemNm},'%')
- </if>
- </select>
- <select id="selectItemUnitInfo" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /*selectItemUnitInfo*/
- iunit.brand_unit_unq_no, iunit.brand_id, fn_brand_nm(iunit.brand_id) as brand_nm, iunit.item_id, iunit.item_nm, iunit.spply_id,
- iunit.spply_nm, date_format(iunit.cont_stt_dt,'%Y.%m.%d') as cont_stt_dt, date_format(iunit.cont_end_dt,'%Y.%m.%d') as cont_end_dt,
- iunit.curr, fn_code_nm('CURR', iunit.curr) as curr_nm, iunit.unit, fn_code_nm('DSTRBT_COST_UNIT', iunit.unit) as unit,
- iunit.unit_amt, iunit.lead_time, iunit.spply_item_id,
- iunit.dlv_cndt, fn_code_nm('DLV_CNDT', iunit.dlv_cndt) as dlv_cndt_nm,
- iunit.unit_st_cd, fn_code_nm('UNIT_ST_CD', iunit.unit_st_cd) as unit_st_nm, iunit.stdd_qty,
- iunit.store_sale_stdd_qty, iunit.store_sale_unit_amt, iunit.short_cont_file_no,
- date_format(iunit.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') as sys_reg_dttm, iunit.sys_reg_id, date_format(iunit.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') as sys_chg_dttm, iunit.sys_chg_id
- from brand_item_unit_info iunit
- where iunit.brand_unit_unq_no = #{brandUnitUnqNo}
- and iunit.brand_id = #{brandId}
- </select>
- <select id="selectItemUnitDupCnt" resultType="int">
- select /* selectItemUnitDupCnt */
- count(*) as cnt
- from brand_item_unit_info
- where brand_id = #{brandId}
- and spply_id = #{spplyId}
- and item_id = #{itemId}
- and date_format(cont_end_dt,'%Y%m%d') <![CDATA[ >= ]]> date_format(#{contSttDt} ,'%Y%m%d')
- </select>
- <select id="selectItemUnitChaPass" resultType="String">
- select case when cont_stt_dt = #{contSttDt} then 'Y' else 'N' end
- from brand_item_unit_info
- where brand_unit_unq_no =#{brandUnitUnqNo}
- </select>
- <update id="updateItemUnitContEnd" >
- update /* updateItemUnitContEnd */
- brand_item_unit_info
- set cont_end_dt = DATE_SUB(date_format(#{contEndDt},'%Y%m%d'), INTERVAL 1 DAY)
- where brand_id = #{brandId}
- and brand_unit_unq_no = #{brandUnitUnqNo}
- </update>
- <insert id="insertItemUnitInfo" >
- insert into /** insertItemUnitInfo */
- brand_item_unit_info
- (brand_unit_unq_no, brand_id, item_id, item_nm, spply_id,
- spply_nm, cont_stt_dt, cont_end_dt, curr, unit,
- unit_amt, lead_time, dlv_cndt, short_cont_file_no, spply_item_id,
- unit_st_cd, stdd_qty, store_sale_stdd_qty, store_sale_unit_amt,
- sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- ( fn_get_dealno(33,''), #{entity.brandId}, #{entity.itemId}, #{entity.itemNm}, #{entity.spplyId},
- #{entity.spplyNm}, #{entity.contSttDt}, #{entity.contEndDt}, #{entity.curr}, #{entity.unit},
- #{entity.unitAmt}, #{entity.leadTime}, #{entity.dlvCndt}, #{entity.shortContFileNo}, #{entity.spplyItemId},
- #{entity.unitStCd}, #{entity.stddQty}, #{entity.storeSaleStddQty}, #{entity.storeSaleUnitAmt},
- now(), #{userId}, now(), #{userId})
- </insert>
- <update id="updateItemUnitInfo" >
- update brand_item_unit_info
- set sys_chg_dttm = now()
- ,sys_chg_id = #{userId}
- ,cont_stt_dt = #{entity.contSttDt}
- ,cont_end_dt = #{entity.contEndDt}
- ,curr = #{entity.curr}
- ,unit = #{entity.unit}
- ,unit_amt = #{entity.unitAmt}
- ,lead_time = #{entity.leadTime}
- ,dlv_cndt = #{entity.dlvCndt}
- ,short_cont_file_no = #{entity.shortContFileNo}
- ,unit_st_cd = #{entity.unitStCd}
- ,stdd_qty = #{entity.stddQty}
- ,store_sale_stdd_qty = #{entity.storeSaleStddQty}
- ,store_sale_unit_amt = #{entity.storeSaleUnitAmt}
- where brand_unit_unq_no = #{entity.brandUnitUnqNo}
- </update>
- <insert id="insertMergItemUnitInfo" >
- insert into /** Merge insertMergItemUnitInfo */
- brand_item_unit_info
- (brand_unit_unq_no, brand_id, item_id, item_nm, spply_id,
- spply_nm, cont_stt_dt, cont_end_dt, curr, unit,
- unit_amt, lead_time, dlv_cndt, short_cont_file_no, spply_item_id,
- unit_st_cd, stdd_qty, store_sale_stdd_qty, store_sale_unit_amt,
- sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- ( fn_get_dealno(33,''), #{entity.brandId}, #{entity.itemId}, #{entity.itemNm}, #{entity.spplyId},
- #{entity.spplyNm}, #{entity.contSttDt}, #{entity.contEndDt}, #{entity.curr}, #{entity.unit},
- #{entity.unitAmt}, #{entity.leadTime}, #{entity.dlvCndt}, #{entity.shortContFileNo}, #{entity.spplyItemId},
- #{entity.unitStCd}, #{entity.stddQty}, #{entity.storeSaleStddQty}, #{entity.storeSaleUnitAmt},
- now(), #{userId}, now(), #{userId})
- on duplicate key
- update
- sys_chg_dttm = now()
- ,sys_chg_id = #{userId}
- ,cont_stt_dt = VALUES(cont_stt_dt)
- ,cont_end_dt = VALUES(cont_end_dt)
- ,curr = VALUES(curr)
- ,unit = VALUES(unit)
- ,unit_amt = VALUES(unit_amt)
- ,lead_time = VALUES(lead_time)
- ,dlv_cndt = VALUES(dlv_cndt)
- ,short_cont_file_no = VALUES(short_cont_file_no)
- ,unit_st_cd = VALUES(unit_st_cd)
- ,stdd_qty = VALUES(stdd_qty)
- ,store_sale_stdd_qty =VALUES(store_sale_stdd_qty)
- ,store_sale_unit_amt = VALUES(store_sale_unit_amt)
- </insert>
- <select id="selectPopItemBrandUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopItemBrandUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,bInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', bInfo.unit) as unit_nm, bInfo.stdd_qty, bInfo.unit_amt, bInfo.brand_unit_unq_no
- ,'B' as unit_gubun, bInfo.spply_id, fn_spply_nm(bInfo.spply_id) as spplyNm
- <if test="sWhsId == null or sWhsId == '' or sLocation = null or sLocation == ''">
- ,0 as whs_pass_qty
- </if>
- <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
- , nvl((stck.stck_qty - stck.wait_qty),0) as whs_pass_qty
- </if>
- from item_base_info iInfo
- join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
- <if test="sSpplyId != null and sSpplyId != '' ">
- and bInfo.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
- left outer join stck_mgnt_base_info stck on stck.brand_id = iInfo.brand_id and stck.item_id = iInfo.item_id and whs_id = #{sWhsId} and location = #{sLocation}
- </if>
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopItemBrandUnitGridCnt" resultType="int">
- select /* selectPopItemBrandUnitGridCnt */
- count(*)
- from item_base_info iInfo
- join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
- <if test="sSpplyId != null and sSpplyId != '' ">
- and bInfo.spply_id = #{sSpplyId}
- </if>
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectPopNewItemBrandUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopNewItemBrandUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm, bInfo.stdd_qty, bInfo.unit_amt, bInfo.brand_unit_unq_no
- ,'B' as unit_gubun, bInfo.spply_id
- <if test="sWhsId == null or sWhsId == '' or sLocation = null or sLocation == ''">
- ,0 as whs_pass_qty
- </if>
- <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
- , nvl((stck.stck_qty - stck.wait_qty),0) as whs_pass_qty
- </if>
- from item_base_info iInfo
- left outer join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
- <if test="sSpplyId != null and sSpplyId != '' ">
- and bInfo.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != '' and sLocation != null and sLocation != ''">
- left outer join stck_mgnt_base_info stck on stck.brand_id = iInfo.brand_id and stck.item_id = iInfo.item_id and whs_id = #{sWhsId} and location = #{sLocation}
- </if>
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopNewItemBrandUnitGridCnt" resultType="int">
- select /* selectPopNewItemBrandUnitGridCnt */
- count(*)
- from item_base_info iInfo
- left outer join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
- <if test="sSpplyId != null and sSpplyId != '' ">
- and bInfo.spply_id = #{sSpplyId}
- </if>
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectPopItemStoreUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopItemStoreUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,sInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', sInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt, sInfo.store_unit_unq_no
- ,'S' as unit_gubun, sInfo.brand_unit_unq_no
- , 0 as whs_pass_qty, '' as spply_id
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopItemStoreUnitGridCnt" resultType="int">
- select /* selectPopItemStoreUnitGridCnt */
- count(*)
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectPopNewItemStoreUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopNewItemStoreUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt, sInfo.store_unit_unq_no
- ,'S' as unit_gubun, sInfo.brand_unit_unq_no
- , 0 as whs_pass_qty, '' as spply_id
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopNewItemStoreUnitGridCnt" resultType="int">
- select /* selectPopNewItemStoreUnitGridCnt */
- count(*)
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectBarcodeItemBrandUnitInfo" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectBarcodeItemBrandUnitInfo */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,bInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', bInfo.unit) as unit_nm, bInfo.stdd_qty, bInfo.unit_amt, bInfo.brand_unit_unq_no
- ,'B' as unit_gubun, bInfo.spply_id, fn_spply_nm(bInfo.spply_id) as spplyNm
- ,0 as whs_pass_qty
- from item_base_info iInfo
- join brand_item_unit_info bInfo on iInfo.brand_id = bInfo.brand_id and iInfo.item_id = bInfo.item_id and date_format(now(),'%Y%m%d') between bInfo.cont_stt_dt and bInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- and iInfo.barcode = #{sBarcode}
- AND iInfo.item_st_cd = 'IS00'
- and iInfo.podr_pssbl_dvsn = 'PO01'
- </select>
- <select id="selectBarcodeItemStoreUnitInfo" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectBarcodeItemStoreUnitInfo */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,sInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', sInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt, sInfo.store_unit_unq_no
- ,'S' as unit_gubun, sInfo.brand_unit_unq_no
- , 0 as whs_pass_qty, '' as spply_id
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- and iInfo.barcode = #{sBarcode}
- AND iInfo.item_st_cd = 'IS00'
- and iInfo.podr_pssbl_dvsn = 'PO01'
- </select>
- <select id="selectPopWishGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- SELECT mgnt.wish_list_mgnt_no, mgnt.wish_list_nm
- FROM store_wish_list_mgnt mgnt
- WHERE 1 = 1
- AND mgnt.store_id = #{sStoreId}
- AND mgnt.del_yn = 'N'
- </select>
- <select id="selectPopItemStoreUnitWishGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopItemStoreUnitWishGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,sInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', sInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt, sInfo.store_unit_unq_no
- ,'S' as unit_gubun, sInfo.brand_unit_unq_no
- , 0 as whs_pass_qty, '' as spply_id
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- join store_wish_list_mgnt wishmng on sInfo.store_id = wishmng.store_id and wishmng.wish_list_mgnt_no = #{sWishListMgntNo} and wishmng.del_yn = 'N'
- join store_wish_list_ptcl wishptcl on wishmng.wish_list_mgnt_no = wishptcl.wish_list_mgnt_no and iInfo.item_id = wishptcl.item_id
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- and iInfo.podr_pssbl_dvsn = 'PO01'
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopItemStoreUnitWishGridCnt" resultType="int">
- select /* selectPopItemStoreUnitWishGridCnt */
- count(*)
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- join store_wish_list_mgnt wishmng on sInfo.store_id = wishmng.store_id and wishmng.wish_list_mgnt_no = #{sWishListMgntNo} and wishmng.del_yn = 'N'
- join store_wish_list_ptcl wishptcl on wishmng.wish_list_mgnt_no = wishptcl.wish_list_mgnt_no and iInfo.item_id = wishptcl.item_id
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- and iInfo.podr_pssbl_dvsn = 'PO01'
- </select>
- <select id="selectPopStoreItemLackStockGridCnt" resultType="int">
- SELECT count(*) as cnt
- FROM store_base_info store
- INNER JOIN whs_mgnt_base_info whs
- ON store.STORE_ID = whs.STORE_ID AND store.BRAND_ID = whs.BRAND_ID and whs.WHS_ID = #{sWhsId} and whs.WHS_DVSN = 'W02'
- INNER JOIN whs_mgnt_base_loc loc
- ON whs.whs_id = loc.whs_id and whs.brand_id = loc.brand_id
- INNER JOIN stck_mgnt_base_info stck
- ON store.BRAND_ID = stck.BRAND_ID AND whs.WHS_ID = stck.WHS_ID and loc.location = stck.location
- INNER JOIN store_item_unit_info sitem
- ON stck.ITEM_ID = sitem.ITEM_ID AND store.BRAND_ID = sitem.BRAND_ID AND store.STORE_ID = sitem.STORE_ID
- and date_format(now() ,'%Y%m%d') between sitem.cont_stt_dt and sitem.cont_end_dt
- INNER JOIN item_base_info item
- ON sitem.ITEM_ID = item.ITEM_ID AND sitem.BRAND_ID = item.BRAND_ID
- WHERE 1 = 1
- AND store.BRAND_ID = #{sBrandId}
- AND store.STORE_ID = #{sStoreId}
- AND whs.WHS_ID = #{sWhsId}
- AND whs.WHS_DVSN = 'W02'
- AND stck.STCK_QTY <![CDATA[ < ]]> FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT <![CDATA[ / ]]> 100)
- </select>
- <select id="selectPopStoreItemLackStockGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- SELECT item.ITEM_ID
- , item.ITEM_NM
- , item.UNIT
- , FN_CODE_NM('DSTRBT_COST_UNIT', item.UNIT) AS unit_nm
- , item.PODR_PSSBL_DVSN
- , FN_CODE_NM('PODR_PSSBL_DVSN', item.PODR_PSSBL_DVSN) AS PODR_PSSBL_DVSN_NM
- , sitem.UNIT_AMT
- , sitem.STORE_UNIT_UNQ_NO
- , sitem.BRAND_UNIT_UNQ_NO
- , stck.STCK_QTY /* 현 수량 */
- , nvl(stck.PRP_STCK_QTY,0) * #{podrNum} AS podr_qty /* 발주 수량 */
- , FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT / 100) AS cur_qty /* 안전재고 수량 */
- , stck.PRP_STCK_QTY /* 안전재고 기준수량 */
- , stck.SFT_STCK_RT /* 안전재고율 */
- ,'S' as unit_gubun
- , concat( whs.whs_nm , case when loc.location is null then '' else concat('-',loc.LOCATION_NM) end) as whs_nm
- FROM store_base_info store
- INNER JOIN whs_mgnt_base_info whs
- ON store.STORE_ID = whs.STORE_ID AND store.BRAND_ID = whs.BRAND_ID and whs.WHS_ID = #{sWhsId} and whs.WHS_DVSN = 'W02'
- INNER JOIN whs_mgnt_base_loc loc
- ON whs.whs_id = loc.whs_id and whs.brand_id = loc.brand_id
- INNER JOIN stck_mgnt_base_info stck
- ON store.BRAND_ID = stck.BRAND_ID AND whs.WHS_ID = stck.WHS_ID and loc.location = stck.location
- INNER JOIN store_item_unit_info sitem
- ON stck.ITEM_ID = sitem.ITEM_ID AND store.BRAND_ID = sitem.BRAND_ID AND store.STORE_ID = sitem.STORE_ID
- and date_format(now() ,'%Y%m%d') between sitem.cont_stt_dt and sitem.cont_end_dt
- INNER JOIN item_base_info item
- ON sitem.ITEM_ID = item.ITEM_ID AND sitem.BRAND_ID = item.BRAND_ID
- WHERE 1 = 1
- AND store.BRAND_ID = #{sBrandId}
- AND store.STORE_ID = #{sStoreId}
- AND stck.STCK_QTY <![CDATA[ < ]]> FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT <![CDATA[ / ]]> 100)
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by item.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by item.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by item.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopBrandItemLackStockGridCnt" resultType="int">
- SELECT count(*) as cnt
- FROM brand_base_info brand
- INNER JOIN whs_mgnt_base_info whs
- ON brand.BRAND_ID = whs.BRAND_ID and whs.WHS_ID = #{sWhsId} and whs.WHS_DVSN = 'W01'
- INNER JOIN whs_mgnt_base_loc loc
- ON whs.whs_id = loc.whs_id and whs.brand_id = loc.brand_id
- INNER JOIN stck_mgnt_base_info stck
- ON brand.BRAND_ID = stck.BRAND_ID AND whs.WHS_ID = stck.WHS_ID and loc.location = stck.location
- INNER JOIN brand_item_unit_info bitem
- ON stck.ITEM_ID = bitem.ITEM_ID AND brand.BRAND_ID = bitem.BRAND_ID
- and date_format(now() ,'%Y%m%d') between bitem.cont_stt_dt and bitem.cont_end_dt
- INNER JOIN item_base_info item
- ON bitem.ITEM_ID = item.ITEM_ID AND bitem.BRAND_ID = item.BRAND_ID
- WHERE 1 = 1
- AND brand.BRAND_ID = #{sBrandId}
- AND stck.STCK_QTY <![CDATA[ < ]]> FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT <![CDATA[ / ]]> 100)
- </select>
- <select id="selectPopBrandItemLackStockGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- SELECT item.ITEM_ID
- , item.ITEM_NM
- , item.UNIT
- , FN_CODE_NM('DSTRBT_COST_UNIT', item.UNIT) AS unit_nm
- , item.PODR_PSSBL_DVSN
- , FN_CODE_NM('PODR_PSSBL_DVSN', item.PODR_PSSBL_DVSN) AS PODR_PSSBL_DVSN_NM
- , bitem.UNIT_AMT
- , '' AS STORE_UNIT_UNQ_NO
- , bitem.BRAND_UNIT_UNQ_NO
- , stck.STCK_QTY /* 현 수량 */
- , nvl(stck.PRP_STCK_QTY,0) * #{podrNum} AS podr_qty /* 발주 수량 */
- , FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT / 100) AS cur_qty /* 안전재고 수량 */
- , stck.PRP_STCK_QTY /* 안전재고 기준수량 */
- , stck.SFT_STCK_RT /* 안전재고율 */
- , whs.WHS_ID
- ,'B' as unit_gubun
- , concat( whs.whs_nm , case when loc.location is null then '' else concat('-',loc.LOCATION_NM) end) as whs_nm
- FROM brand_base_info brand
- INNER JOIN whs_mgnt_base_info whs
- ON brand.BRAND_ID = whs.BRAND_ID and whs.WHS_ID = #{sWhsId} and whs.WHS_DVSN = 'W01'
- INNER JOIN whs_mgnt_base_loc loc
- ON whs.whs_id = loc.whs_id and whs.brand_id = loc.brand_id
- INNER JOIN stck_mgnt_base_info stck
- ON brand.BRAND_ID = stck.BRAND_ID AND whs.WHS_ID = stck.WHS_ID and loc.location = stck.location
- INNER JOIN brand_item_unit_info bitem
- ON stck.ITEM_ID = bitem.ITEM_ID AND brand.BRAND_ID = bitem.BRAND_ID
- and date_format(now() ,'%Y%m%d') between bitem.cont_stt_dt and bitem.cont_end_dt
- INNER JOIN item_base_info item
- ON bitem.ITEM_ID = item.ITEM_ID AND bitem.BRAND_ID = item.BRAND_ID
- WHERE 1 = 1
- AND brand.BRAND_ID = #{sBrandId}
- AND stck.STCK_QTY <![CDATA[ < ]]> FLOOR(stck.PRP_STCK_QTY * stck.SFT_STCK_RT <![CDATA[ / ]]> 100)
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by item.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by item.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by item.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopWishListItem" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopWishListItem */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,sInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', sInfo.unit) as unit_nm, sInfo.stdd_qty, sInfo.unit_amt
- , sInfo.store_unit_unq_no,'S' as unit_gubun, sInfo.brand_unit_unq_no
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{storeId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- join store_wish_list_mgnt wish on wish_list_mgnt_no = #{wishListMgntNo} and wish.store_id = store.store_id and wish.del_yn = 'N'
- join store_wish_list_ptcl wishptcl on wish.wish_list_mgnt_no = wishptcl.wish_list_mgnt_no and wishptcl.item_id = iInfo.item_id and wishptcl.del_yn = 'N'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{storeId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{brandId}
- AND iInfo.item_st_cd = 'IS00'
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopWishListItemCnt" resultType="int">
- select /* selectPopWishListItemCnt */
- count(*) as cnt
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{storeId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- join store_wish_list_mgnt wish on wish_list_mgnt_no = #{wishListMgntNo} and wish.store_id = store.store_id and wish.del_yn = 'N'
- join store_wish_list_ptcl wishptcl on wish.wish_list_mgnt_no = wishptcl.wish_list_mgnt_no and wishptcl.item_id = iInfo.item_id and wishptcl.del_yn = 'N'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{storeId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{brandId}
- AND iInfo.item_st_cd = 'IS00'
- </select>
- <select id="selectPopItemBrandBaseUnitGridCnt" resultType="int">
- select /* selectPopItemBrandUnitGridCnt */
- count(*)
- from item_base_info iInfo
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectPopItemBrandBaseUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopNewItemBrandUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm
- , iInfo.store_deli_type, fn_code_nm('STORE_DELI_TYPE', iInfo.store_deli_type) as store_deli_type_nm
- from item_base_info iInfo
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopItemStoreUnitBaseGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopItemStoreUnitBaseGridList */
- distinct iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,sInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', sInfo.unit) as unit_nm
- , iInfo.store_deli_type, fn_code_nm('STORE_DELI_TYPE', iInfo.store_deli_type) as store_deli_type_nm
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopItemStoreUnitBaseGridCnt" resultType="int">
- select /* selectPopItemStoreUnitBaseGridCnt */
- count(distinct iInfo.item_id, iInfo.item_nm, iInfo.podr_pssbl_dvsn, sInfo.unit)
- from item_base_info iInfo
- join store_base_info store on iInfo.brand_id = store.brand_id and store.store_id = #{sStoreId}
- join store_item_unit_info sInfo on iInfo.brand_id = sInfo.brand_id and iInfo.item_id = sInfo.item_id and sInfo.unit_target_cd = 'Y'
- and store.store_id = sInfo.store_id and sInfo.store_id = #{sStoreId}
- and date_format(now(),'%Y%m%d') between sInfo.cont_stt_dt and sInfo.cont_end_dt
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- </select>
- <select id="selectPopContItemBrandUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
- select /* selectPopContItemBrandUnitGridList */
- iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
- ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm
- from item_base_info iInfo
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <if test="contYn == 'N'.toString()">
- and iInfo.item_id not in ( select item_id
- from brand_item_unit_info iunit
- where iunit.brand_id = #{sBrandId}
- and date_format(now() , '%Y%m%d') between cont_stt_dt and cont_end_dt )
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by iInfo.item_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by iInfo.item_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by iInfo.item_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopContItemBrandUnitGridCnt" resultType="int">
- select /* selectPopContItemBrandUnitGridCnt */
- count(*)
- from item_base_info iInfo
- where iInfo.brand_id = #{sBrandId}
- AND iInfo.item_st_cd = 'IS00'
- <if test="sItemNm != null and sItemNm != ''">
- and (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
- </if>
- <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
- and iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
- </if>
- <if test="contYn == 'N'.toString()">
- and iInfo.item_id not in ( select item_id
- from brand_item_unit_info iunit
- where iunit.brand_id = #{sBrandId}
- and date_format(now() , '%Y%m%d') between cont_stt_dt and cont_end_dt )
- </if>
- </select>
- </mapper>
|