/* WhsMngMapper.insertWhsMgntBaseInfo */
INSERT INTO whs_mgnt_base_info
(brand_id, whs_id, whs_nm, whs_dvsn, mgr_nm, mgr_tel_no, zip_no, addr1, addr2, whs_st_cd, store_id,
sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
VALUES
(#{entity.brandId}, #{entity.whsId}, #{entity.whsNm}, #{entity.whsDvsn}, #{entity.mgrNm}, #{entity.mgrTelNo},
#{entity.zipNo}, #{entity.addr1}, #{entity.addr2}, #{entity.whsStCd}, #{entity.storeId},
NOW(), #{userId}, NOW(), #{userId})
/* WhsMngMapper.updateWhsMgntBaseInfo */
UPDATE whs_mgnt_base_info SET
whs_nm = #{entity.whsNm},
whs_dvsn = #{entity.whsDvsn},
mgr_nm = #{entity.mgrNm},
mgr_tel_no = #{entity.mgrTelNo},
zip_no = #{entity.zipNo},
addr1 = #{entity.addr1},
addr2 = #{entity.addr2},
whs_st_cd = #{entity.whsStCd},
store_id = #{entity.storeId},
sys_chg_dttm = NOW(),
sys_chg_id = #{userId}
WHERE brand_id = #{entity.brandId}
AND whs_id = #{entity.whsId}
/* WhsMngMapper.deleteWhsMgntBaseInfo */
DELETE FROM whs_mgnt_base_info
WHERE brand_id = #{entity.brandId}
AND whs_id = #{entity.whsId}
/* WhsMngMapper.deleteWhsMgntBaseLoc4Info */
DELETE FROM whs_mgnt_base_loc
WHERE brand_id = #{entity.brandId}
AND whs_id = #{entity.whsId}
/* WhsMngMapper.insertWhsMgntBaseLoc */
INSERT INTO whs_mgnt_base_loc
(brand_id, whs_id, location, location_nm, stck_dvsn, loc_st_cd,
sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
VALUES
(#{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.locationNm}, #{entity.stckDvsn}, #{entity.locStCd},
NOW(), #{userId}, NOW(), #{userId})
/* WhsMngMapper.updateWhsMgntBaseLoc */
UPDATE whs_mgnt_base_loc SET
location_nm = #{entity.locationNm},
stck_dvsn = #{entity.stckDvsn},
loc_st_cd = #{entity.locStCd},
sys_chg_dttm = NOW(),
sys_chg_id = #{entity.sysChgId}
WHERE brand_id = #{entity.brandId}
AND whs_id = #{entity.whsId}
AND location = #{entity.location}
/* WhsMngMapper.deleteWhsMgntBaseLoc */
DELETE FROM whs_mgnt_base_loc
WHERE brand_id = #{entity.brandId}
AND whs_id = #{entity.whsId}
AND location = #{entity.location}
/* WhsMngMapper.updateStoreWhsStatus */
UPDATE whs_mgnt_base_info SET
whs_st_cd = #{whsStCd},
sys_chg_dttm = NOW(),
sys_chg_id = #{userId}
WHERE 1=1
and brand_id = #{brandId}
AND store_id = #{storeId}
/* WhsMngMapper.updateWhsLocStatus */
UPDATE whs_mgnt_base_loc SET
loc_st_cd = #{locStCd},
sys_chg_dttm = NOW(),
sys_chg_id = #{userId}
WHERE concat(brand_id , whs_id) in (
select concat(brand_id, whs_id)
from whs_mgnt_base_info
WHERE 1=1
and brand_id = #{brandId}
AND store_id = #{storeId}
)
update whs_mgnt_base_info
set sys_chg_dttm = now()
,sys_chg_id = #{userId}
,whs_st_cd = 'W003'
where 1=1
and brand_id = #{brandId}
and brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
UPDATE whs_mgnt_base_loc
SET sys_chg_dttm = now()
,sys_chg_id = #{userId}
loc_st_cd = 'LOC003'
WHERE 1=1
and concat(brand_id , whs_id) in (
select concat(brand_id, whs_id)
from whs_mgnt_base_info
WHERE 1=1
and brand_id = #{brandId}
and brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
)