123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <?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.stockmng.WhsMngMapper">
- <select id="selectWhsMngGridList" resultType="com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity">
- /* WhsMngMapper.selectWhsMngGridList */
- SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
- A.whs_id, A.whs_nm, A.whs_dvsn, FN_CODE_NM('WHS_DVSN', A.whs_dvsn) AS whs_dvsn_nm,
- A.mgr_nm, FN_GET_TELNO(A.mgr_tel_no) AS mgr_tel_no, A.whs_st_cd, FN_CODE_NM('WHS_ST_CD', A.whs_st_cd) AS whs_st_nm,
- A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm
- FROM whs_mgnt_base_info A
- WHERE A.brand_id = #{sBrandId}
- <if test="sStoreId != null and sStoreId != ''">
- AND A.store_id = #{sStoreId}
- </if>
- <if test="sWhsDvsn != null and sWhsDvsn != ''">
- AND A.whs_dvsn = #{sWhsDvsn}
- </if>
- <if test="sWhsStCd != null and sWhsStCd != ''">
- AND A.whs_st_cd = #{sWhsStCd}
- </if>
- <if test="sWhsNm != null and sWhsNm != ''">
- AND A.whs_nm LIKE CONCAT('%',#{sWhsNm},'%')
- </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 A.whs_id ASC
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- ORDER BY A.whs_id DESC
- </if>
- </if>
- </when>
- <otherwise>
- ORDER BY A.whs_id ASC
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectWhsMngGridCnt" resultType="int">
- /* WhsMngMapper.selectWhsMngGridCnt */
- SELECT COUNT(*)
- FROM whs_mgnt_base_info A
- WHERE A.brand_id = #{sBrandId}
- <if test="sStoreId != null and sStoreId != ''">
- AND A.store_id = #{sStoreId}
- </if>
- <if test="sWhsDvsn != null and sWhsDvsn != ''">
- AND A.whs_dvsn = #{sWhsDvsn}
- </if>
- <if test="sWhsStCd != null and sWhsStCd != ''">
- AND A.whs_st_cd = #{sWhsStCd}
- </if>
- <if test="sWhsNm != null and sWhsNm != ''">
- AND A.whs_nm LIKE CONCAT('%',#{sWhsNm},'%')
- </if>
- </select>
- <select id="selectWhsMgntBaseInfo" resultType="com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity">
- /* WhsMngMapper.selectWhsMgntBaseInfo */
- SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
- A.whs_id, A.whs_nm, A.whs_dvsn, FN_CODE_NM('WHS_DVSN', A.whs_dvsn) AS whs_dvsn_nm,
- A.mgr_nm, FN_GET_TELNO(A.mgr_tel_no) AS mgr_tel_no, A.zip_no,
- A.addr1, A.addr2, A.whs_st_cd, FN_CODE_NM('WHS_ST_CD', A.whs_st_cd) AS whs_st_nm,
- A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
- DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, A.sys_reg_id, DATE_FORMAT(A.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, A.sys_chg_id
- FROM whs_mgnt_base_info A
- WHERE A.brand_id = #{brandId}
- AND A.whs_id = #{whsId}
- </select>
- <select id="selectWhsLocGridList" resultType="com.oqpo.api.entity.stockmng.WhsMgntBaseLocEntity">
- /* WhsMngMapper.selectWhsLocGridList */
- SELECT A.brand_id, A.whs_id, A.location, A.location_nm,
- A.stck_dvsn, FN_CODE_NM('STCK_DVSN', A.stck_dvsn) AS stck_dvsn_nm,
- A.loc_st_cd, FN_CODE_NM('LOC_ST_CD', A.loc_st_cd) AS loc_st_nm
- FROM whs_mgnt_base_loc A
- WHERE A.brand_id = #{brandId}
- AND A.whs_id = #{whsId}
- ORDER BY A.location ASC
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectWhsLocGridCnt" resultType="int">
- /* WhsMngMapper.selectWhsLocGridCnt */
- SELECT COUNT(*)
- FROM whs_mgnt_base_loc A
- WHERE A.brand_id = #{brandId}
- AND A.whs_id = #{whsId}
- </select>
- <insert id="insertWhsMgntBaseInfo" >
- /* 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})
- </insert>
- <update id="updateWhsMgntBaseInfo" >
- /* 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}
- </update>
- <delete id="deleteWhsMgntBaseInfo" >
- /* WhsMngMapper.deleteWhsMgntBaseInfo */
- DELETE FROM whs_mgnt_base_info
- WHERE brand_id = #{entity.brandId}
- AND whs_id = #{entity.whsId}
- </delete>
- <delete id="deleteWhsMgntBaseLoc4Info" >
- /* WhsMngMapper.deleteWhsMgntBaseLoc4Info */
- DELETE FROM whs_mgnt_base_loc
- WHERE brand_id = #{entity.brandId}
- AND whs_id = #{entity.whsId}
- </delete>
- <select id="selectNextLocation4Whs" resultType="java.lang.String">
- /* WhsMngMapper.selectNextLocation4Whs */
- SELECT IFNULL(MAX(A.LOCATION), 1000) + 1
- FROM whs_mgnt_base_loc A
- WHERE A.brand_id = #{brandId}
- AND A.whs_id = #{whsId}
- </select>
- <insert id="insertWhsMgntBaseLoc" >
- /* 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})
- </insert>
- <update id="updateWhsMgntBaseLoc" >
- /* 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}
- </update>
- <delete id="deleteWhsMgntBaseLoc" >
- /* WhsMngMapper.deleteWhsMgntBaseLoc */
- DELETE FROM whs_mgnt_base_loc
- WHERE brand_id = #{entity.brandId}
- AND whs_id = #{entity.whsId}
- AND location = #{entity.location}
- </delete>
- <update id="updateStoreWhsStatus" >
- /* WhsMngMapper.updateStoreWhsStatus */
- UPDATE whs_mgnt_base_info SET
- <if test="whsStCd != null and whsStCd != ''">
- whs_st_cd = #{whsStCd},
- </if>
- sys_chg_dttm = NOW(),
- sys_chg_id = #{userId}
- WHERE 1=1
- <if test="brandId != null and brandId != ''">
- and brand_id = #{brandId}
- </if>
- <if test="storeId != null and storeId != ''">
- AND store_id = #{storeId}
- </if>
- </update>
- <update id="updateWhsLocStatus" >
- /* WhsMngMapper.updateWhsLocStatus */
- UPDATE whs_mgnt_base_loc SET
- <if test="locStCd != null and locStCd != ''">
- loc_st_cd = #{locStCd},
- </if>
- 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
- <if test="brandId != null and brandId != ''">
- and brand_id = #{brandId}
- </if>
- <if test="storeId != null and storeId != ''">
- AND store_id = #{storeId}
- </if>
- )
- </update>
- <update id="updateCloseWhs" >
- update whs_mgnt_base_info
- set sys_chg_dttm = now()
- ,sys_chg_id = #{userId}
- ,whs_st_cd = 'W003'
- where 1=1
- <if test="brandId != null and brandId != ''">
- and brand_id = #{brandId}
- </if>
- <if test="afflShopId != null and afflShopId != ''">
- and brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
- </if>
- </update>
- <update id="updateCloseWhsLoc" >
- 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
- <if test="brandId != null and brandId != ''">
- and brand_id = #{brandId}
- </if>
- <if test="afflShopId != null and afflShopId != ''">
- and brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
- </if>
- )
- </update>
- </mapper>
|