Store.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper">
  4. <select id="selectPopStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
  5. select /* selectPopStoreGridList */
  6. 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
  7. from store_base_info
  8. where 1=1
  9. and brand_id = #{sBrandId}
  10. <if test="sStoreNm != null and sStoreNm != ''">
  11. and store_nm like concat('%',#{sStoreNm},'%')
  12. </if>
  13. <choose>
  14. <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
  15. <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
  16. <if test="gridRequest.sord == 'asc'.toString()">
  17. order by store_nm asc
  18. </if>
  19. <if test="gridRequest.sord == 'desc'.toString()">
  20. order by store_nm desc
  21. </if>
  22. </if>
  23. </when>
  24. <otherwise>
  25. order by store_nm asc
  26. </otherwise>
  27. </choose>
  28. <if test="gridRequest.pagingYn == true">
  29. limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
  30. </if>
  31. </select>
  32. <select id="selectPopStoreGridCnt" resultType="int">
  33. select /*selectPopStoreGridCnt*/
  34. count(*)
  35. from store_base_info
  36. where 1=1
  37. and brand_id = #{sBrandId}
  38. <if test="sStoreNm != null and sStoreNm != ''">
  39. and store_nm like concat('%',#{sStoreNm},'%')
  40. </if>
  41. </select>
  42. <select id="selectStoreGridList" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
  43. select /* selectStoreGridList */
  44. 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,
  45. 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 ,
  46. date_format(sys_reg_dttm,'%Y.%m.%d %H:%s:%i') as sys_reg_dttm
  47. from store_base_info
  48. where 1=1
  49. and brand_id = #{sBrandId}
  50. <if test="searchDateType == '10'">
  51. and open_dt between #{fromDt} and #{toDt}
  52. </if>
  53. <if test="searchDateType == '20'">
  54. 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')
  55. </if>
  56. <if test="sStoreDvsn != null and sStoreDvsn != ''">
  57. and store_dvsn = #{sStoreDvsn}
  58. </if>
  59. <if test="sStoreStCd != null and sStoreStCd != ''">
  60. and store_st_cd = #{sStoreStCd}
  61. </if>
  62. <if test="sLoanDvsn != null and sLoanDvsn != ''">
  63. and loan_dvsn = #{sLoanDvsn}
  64. </if>
  65. <if test="sStoreNm != null and sStoreNm != ''">
  66. and store_nm like concat('%',#{sStoreNm},'%')
  67. </if>
  68. <choose>
  69. <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
  70. <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
  71. <if test="gridRequest.sord == 'asc'.toString()">
  72. order by brand_nm asc
  73. </if>
  74. <if test="gridRequest.sord == 'desc'.toString()">
  75. order by brand_nm desc
  76. </if>
  77. </if>
  78. </when>
  79. <otherwise>
  80. order by brand_nm asc
  81. </otherwise>
  82. </choose>
  83. <if test="gridRequest.pagingYn == true">
  84. limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
  85. </if>
  86. </select>
  87. <select id="selectStoreGridCnt" resultType="int">
  88. select /*selectStoreGridCnt*/
  89. count(*)
  90. from store_base_info
  91. where 1=1
  92. and brand_id = #{sBrandId}
  93. <if test="searchDateType == '10'">
  94. and open_dt between #{fromDt} and #{toDt}
  95. </if>
  96. <if test="searchDateType == '20'">
  97. 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')
  98. </if>
  99. <if test="sStoreDvsn != null and sStoreDvsn != ''">
  100. and store_dvsn = #{sStoreDvsn}
  101. </if>
  102. <if test="sStoreStCd != null and sStoreStCd != ''">
  103. and store_st_cd = #{sStoreStCd}
  104. </if>
  105. <if test="sLoanDvsn != null and sLoanDvsn != ''">
  106. and loan_dvsn = #{sLoanDvsn}
  107. </if>
  108. <if test="sStoreNm != null and sStoreNm != ''">
  109. and store_nm like concat('%',#{sStoreNm},'%')
  110. </if>
  111. </select>
  112. <select id="selectStoreInfo" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
  113. 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
  114. ,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
  115. ,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
  116. ,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
  117. ,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
  118. ,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
  119. ,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
  120. ,store.sys_reg_id,date_format(store.sys_chg_dttm,'%Y.%m.%d %H:%s:%i') as sys_chg_dttm,store.sys_chg_id
  121. ,loan.tmp_rcv_acct_total as 'loanInfo.tmp_rcv_acct_total',loan.acct_bal as 'loanInfo.acct_bal'
  122. ,store.bnk_cd , store.acct_no, store.owac_nm
  123. ,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'
  124. ,store.whs_use_yn
  125. from store_base_info store
  126. join brand_base_info brand on store.brand_id = brand.brand_id
  127. 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'
  128. where 1=1
  129. and store.brand_id = #{brandId}
  130. and store.store_id = #{storeId}
  131. </select>
  132. <insert id="insertStoreInfo" >
  133. insert into store_base_info
  134. (
  135. brand_id,store_id,store_nm,store_dvsn,mbl_no
  136. ,open_dt,close_dt,loan_mgnt_unq_no,loan_dvsn,limit_amt, rtn_proc_dvsn
  137. ,zip_no,addr1,addr2,tel_no,fax_no
  138. ,emal_addr,store_st_cd,bsns_reg_no,corp_reg_no,ctgr_bsns
  139. ,bsns_cndt, bnk_cd, acct_no, owner_nm,del_yn,area_cd,lat_x, whs_use_yn
  140. ,long_y,oq_brand_id,oq_store_id,sys_reg_dttm,sys_reg_id,sys_chg_dttm,sys_chg_id
  141. )
  142. values
  143. (
  144. #{entity.brandId},#{entity.storeId},#{entity.storeNm},#{entity.storeDvsn},#{entity.mblNo},
  145. #{entity.openDt},#{entity.closeDt},#{entity.loanMgntUnqNo},#{entity.loanDvsn},#{entity.limitAmt},#{entity.rtnProcDvsn},
  146. #{entity.zipNo},#{entity.addr1},#{entity.addr2},#{entity.telNo},#{entity.faxNo},
  147. #{entity.emalAddr},#{entity.storeStCd},#{entity.bsnsRegNo},#{entity.corpRegNo},#{entity.ctgrBsns},
  148. #{entity.bsnsCndt},#{entity.bnkCd}, #{entity.acctNo}, #{entity.ownerNm},'N',#{entity.areaCd},#{entity.latX},#{entity.whsUseYn},
  149. #{entity.longY},null,null,now(),#{userId},now(),#{userId}
  150. )
  151. </insert>
  152. <update id="updateStoreInfo">
  153. update store_base_info
  154. set store_nm = #{entity.storeNm}
  155. ,store_dvsn = #{entity.storeDvsn}
  156. ,mbl_no = #{entity.mblNo}
  157. ,open_dt = #{entity.openDt}
  158. ,close_dt = case when #{entity.storeStCd} = 'ST03' then date_format(now(),'%Y%m%d') else null end
  159. ,loan_mgnt_unq_no = #{entity.loanMgntUnqNo}
  160. ,loan_dvsn = #{entity.loanDvsn}
  161. ,rtn_proc_dvsn = #{entity.rtnProcDvsn}
  162. ,limit_amt = #{entity.limitAmt}
  163. ,zip_no = #{entity.zipNo}
  164. ,addr1 = #{entity.addr1}
  165. ,addr2 = #{entity.addr2}
  166. ,tel_no = #{entity.telNo}
  167. ,fax_no = #{entity.faxNo}
  168. ,emal_addr = #{entity.emalAddr}
  169. ,store_st_cd = #{entity.storeStCd}
  170. ,ctgr_bsns = #{entity.ctgrBsns}
  171. ,bsns_cndt = #{entity.bsnsCndt}
  172. ,bnk_cd = #{entity.bnkCd}
  173. ,acct_no = #{entity.acctNo}
  174. ,owner_nm = #{entity.ownerNm}
  175. ,area_cd = #{entity.areaCd}
  176. ,lat_x = #{entity.latX}
  177. ,long_y = #{entity.longY}
  178. ,whs_use_yn = #{entity.whsUseYn}
  179. ,sys_chg_dttm = now()
  180. ,sys_chg_id = #{userId}
  181. where brand_id = #{entity.brandId}
  182. and store_id = #{entity.storeId}
  183. </update>
  184. <select id="selectStoreInitPw" resultType="String">
  185. select bsns_reg_no
  186. from store_base_info
  187. where brand_id = #{brandId}
  188. and store_id = #{storeId}
  189. </select>
  190. <select id="selectStoreLoanInfo" resultType="com.oqpo.api.entity.stinfo.StoreBaseInfoEntity">
  191. select loan_mgnt_unq_no,loan_dvsn,limit_amt, whs_use_yn
  192. from store_base_info
  193. where 1=1
  194. and brand_id = #{brandId}
  195. and store_id = #{storeId}
  196. </select>
  197. <update id="updateCloseStore" >
  198. update store_base_info
  199. set sys_chg_dttm = now()
  200. ,sys_chg_id = #{userId}
  201. ,store_st_cd = 'ST03'
  202. where 1=1
  203. <if test="brandId != null and brandId != ''">
  204. and brand_id = #{brandId}
  205. </if>
  206. <if test="afflShopId != null and afflShopId != ''">
  207. and brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
  208. </if>
  209. </update>
  210. </mapper>