123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <?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.StoreBaseInfoMapper">
- <select id="selectPopStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
- select /* selectPopStoreGridList */
- brand_id, fn_brand_nm(brand_id) as brand_nm, store_id, store_nm, store_st_cd, fn_code_nm('STORE_ST_CD',store_st_cd) as store_st_nm
- from store_base_info
- where 1=1
- and brand_id = #{sBrandId}
- <if test="sStoreNm != null and sStoreNm != ''">
- and store_nm like concat('%',#{sStoreNm},'%')
- </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 store_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by store_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by store_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectPopStoreGridCnt" resultType="int">
- select /*selectPopStoreGridCnt*/
- count(*)
- from store_base_info
- where 1=1
- and brand_id = #{sBrandId}
- <if test="sStoreNm != null and sStoreNm != ''">
- and store_nm like concat('%',#{sStoreNm},'%')
- </if>
- </select>
- <select id="selectStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
- select /* selectStoreGridList */
- brand_id, fn_brand_nm(brand_id) as brand_nm, store_id, store_nm, fn_get_regno(1,bsns_reg_no) as bsns_reg_no,
- store_dvsn, fn_code_nm('STORE_DVSN', store_dvsn) as store_dvsn_nm, store_st_cd, fn_code_nm('STORE_ST_CD',store_st_cd) as store_st_nm ,
- date_format(sys_reg_dttm,'%Y.%m.%d %H:%s:%i') as sys_reg_dttm
- from store_base_info
- where 1=1
- and brand_id = #{sBrandId}
- <if test="searchDateType == '10'">
- and open_dt between #{fromDt} and #{toDt}
- </if>
- <if test="searchDateType == '20'">
- and sys_reg_dttm between date_format(concat(#{fromDt},'000000'),'%Y%m%d%H%s%i') and date_format(concat(#{toDt},'000000'),'%Y%m%d%H%s%i')
- </if>
- <if test="sStoreDvsn != null and sStoreDvsn != ''">
- and store_dvsn = #{sStoreDvsn}
- </if>
- <if test="sStoreStCd != null and sStoreStCd != ''">
- and store_st_cd = #{sStoreStCd}
- </if>
- <if test="sLoanDvsn != null and sLoanDvsn != ''">
- and loan_dvsn = #{sLoanDvsn}
- </if>
- <if test="sStoreNm != null and sStoreNm != ''">
- and store_nm like concat('%',#{sStoreNm},'%')
- </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 brand_nm asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by brand_nm desc
- </if>
- </if>
- </when>
- <otherwise>
- order by brand_nm asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectStoreGridCnt" resultType="int">
- select /*selectStoreGridCnt*/
- count(*)
- from store_base_info
- where 1=1
- and brand_id = #{sBrandId}
- <if test="searchDateType == '10'">
- and open_dt between #{fromDt} and #{toDt}
- </if>
- <if test="searchDateType == '20'">
- and sys_reg_dttm between date_format(concat(#{fromDt},'000000'),'%Y%m%d%H%s%i') and date_format(concat(#{toDt},'000000'),'%Y%m%d%H%s%i')
- </if>
- <if test="sStoreDvsn != null and sStoreDvsn != ''">
- and store_dvsn = #{sStoreDvsn}
- </if>
- <if test="sStoreStCd != null and sStoreStCd != ''">
- and store_st_cd = #{sStoreStCd}
- </if>
- <if test="sLoanDvsn != null and sLoanDvsn != ''">
- and loan_dvsn = #{sLoanDvsn}
- </if>
- <if test="sStoreNm != null and sStoreNm != ''">
- and store_nm like concat('%',#{sStoreNm},'%')
- </if>
- </select>
- <select id="selectStoreInfo" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
- select store.brand_id, brand.brand_nm as 'brandInfo.brand_nm', store.store_id,store.store_nm,store.store_dvsn,fn_code_nm('STORE_DVSN',store.store_dvsn) as store_dvsn_nm
- ,store.mbl_no,date_format(store.open_dt,'%Y.%m.%d') as open_dt,date_format(store.close_dt,'%Y.%m.%d') as close_dt,store.loan_mgnt_unq_no,store.loan_dvsn
- ,fn_code_nm('LOAN_DVSN',store.loan_dvsn) as loan_dvsn_nm, store.limit_amt, store.rtn_proc_dvsn,fn_code_nm('RTN_PROC_DVSN',store.rtn_proc_dvsn) as rtn_proc_dvsn_nm,store.zip_no,store.addr1
- ,store.addr2,fn_get_telno(store.tel_no) as tel_no,fn_get_telno(store.fax_no) as fax_no,store.emal_addr,store.store_st_cd
- ,fn_code_nm('STORE_ST_CD',store.store_st_cd) as store_st_nm,fn_get_regno(1, store.bsns_reg_no) as bsns_reg_no,fn_get_regno(2, store.corp_reg_no) as corp_reg_no
- ,store.ctgr_bsns,store.bsns_cndt,store.owner_nm,store.del_yn,store.area_cd,fn_code_nm('AREA_CD',store.area_cd) as area_nm
- ,store.lat_x,store.long_y,store.oq_brand_id,store.oq_store_id,date_format(store.sys_reg_dttm,'%Y.%m.%d %H:%s:%i') as sys_reg_dttm
- ,store.sys_reg_id,date_format(store.sys_chg_dttm,'%Y.%m.%d %H:%s:%i') as sys_chg_dttm,store.sys_chg_id
- ,loan.tmp_rcv_acct_total as 'loanInfo.tmp_rcv_acct_total',loan.acct_bal as 'loanInfo.acct_bal'
- ,store.bnk_cd , store.acct_no, store.owac_nm
- ,brand.bnk_cd as 'brandInfo.bnk_cd', fn_code_nm('BNK_CD',brand.bnk_cd) as 'brandInfo.bnk_nm', brand.acct_no as 'brandInfo.acct_no', brand.owac_nm as 'brandInfo.owac_nm'
- ,store.whs_use_yn
- from store_base_info store
- join brand_base_info brand on store.brand_id = brand.brand_id
- left outer join loan_mgnt_base_info loan on store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no and store.brand_id = loan.brand_id and store.store_id = loan.store_id and loan.use_yn = 'N'
- where 1=1
- and store.brand_id = #{brandId}
- and store.store_id = #{storeId}
- </select>
- <insert id="insertStoreInfo" >
- insert into store_base_info
- (
- brand_id,store_id,store_nm,store_dvsn,mbl_no
- ,open_dt,close_dt,loan_mgnt_unq_no,loan_dvsn,limit_amt, rtn_proc_dvsn
- ,zip_no,addr1,addr2,tel_no,fax_no
- ,emal_addr,store_st_cd,bsns_reg_no,corp_reg_no,ctgr_bsns
- ,bsns_cndt, bnk_cd, acct_no, owner_nm,del_yn,area_cd,lat_x, whs_use_yn
- ,long_y,oq_brand_id,oq_store_id,sys_reg_dttm,sys_reg_id,sys_chg_dttm,sys_chg_id
- )
- values
- (
- #{entity.brandId},#{entity.storeId},#{entity.storeNm},#{entity.storeDvsn},#{entity.mblNo},
- #{entity.openDt},#{entity.closeDt},#{entity.loanMgntUnqNo},#{entity.loanDvsn},#{entity.limitAmt},#{entity.rtnProcDvsn},
- #{entity.zipNo},#{entity.addr1},#{entity.addr2},#{entity.telNo},#{entity.faxNo},
- #{entity.emalAddr},#{entity.storeStCd},#{entity.bsnsRegNo},#{entity.corpRegNo},#{entity.ctgrBsns},
- #{entity.bsnsCndt},#{entity.bnkCd}, #{entity.acctNo}, #{entity.ownerNm},'N',#{entity.areaCd},#{entity.latX},#{entity.whsUseYn},
- #{entity.longY},null,null,now(),#{userId},now(),#{userId}
- )
- </insert>
- <update id="updateStoreInfo">
- update store_base_info
- set store_nm = #{entity.storeNm}
- ,store_dvsn = #{entity.storeDvsn}
- ,mbl_no = #{entity.mblNo}
- ,open_dt = #{entity.openDt}
- ,close_dt = case when #{entity.storeStCd} = 'ST03' then date_format(now(),'%Y%m%d') else null end
- ,loan_mgnt_unq_no = #{entity.loanMgntUnqNo}
- ,loan_dvsn = #{entity.loanDvsn}
- ,rtn_proc_dvsn = #{entity.rtnProcDvsn}
- ,limit_amt = #{entity.limitAmt}
- ,zip_no = #{entity.zipNo}
- ,addr1 = #{entity.addr1}
- ,addr2 = #{entity.addr2}
- ,tel_no = #{entity.telNo}
- ,fax_no = #{entity.faxNo}
- ,emal_addr = #{entity.emalAddr}
- ,store_st_cd = #{entity.storeStCd}
- ,ctgr_bsns = #{entity.ctgrBsns}
- ,bsns_cndt = #{entity.bsnsCndt}
- ,bnk_cd = #{entity.bnkCd}
- ,acct_no = #{entity.acctNo}
- ,owner_nm = #{entity.ownerNm}
- ,area_cd = #{entity.areaCd}
- ,lat_x = #{entity.latX}
- ,long_y = #{entity.longY}
- ,whs_use_yn = #{entity.whsUseYn}
- ,sys_chg_dttm = now()
- ,sys_chg_id = #{userId}
- where brand_id = #{entity.brandId}
- and store_id = #{entity.storeId}
- </update>
- <select id="selectStoreInitPw" resultType="String">
- select bsns_reg_no
- from store_base_info
- where brand_id = #{brandId}
- and store_id = #{storeId}
- </select>
- <select id="selectStoreLoanInfo" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
- select loan_mgnt_unq_no,loan_dvsn,limit_amt, whs_use_yn
- from store_base_info
- where 1=1
- and brand_id = #{brandId}
- and store_id = #{storeId}
- </select>
- <update id="updateCloseStore" >
- update store_base_info
- set sys_chg_dttm = now()
- ,sys_chg_id = #{userId}
- ,store_st_cd = 'ST03'
- 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>
|