|
@@ -0,0 +1,168 @@
|
|
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
|
+
|
|
4
|
+<mapper namespace="com.oqpo.api.mapper.stinfo.AfflShopBaseInfoMapper">
|
|
5
|
+ <select id="selectAfflShopGridList" resultType="com.oqpo.api.entity.stinfo.AfflShopBaseInfoEntity">
|
|
6
|
+ select /* selectAfflShopGridList */
|
|
7
|
+ affl_shop_id, affl_shop_nm, corp_type, st_cd, fn_code_nm('ST_CD', st_cd) as st_nm, owner_nm
|
|
8
|
+ , concat(date_format(reg_dt,'%Y-%m-%d'), ' ~ ', date_format(reg_dt,'%Y-%m-%d')) as join_dt
|
|
9
|
+ from affl_shop_base_info
|
|
10
|
+ where 1=1
|
|
11
|
+ and st_cd = 'S000'
|
|
12
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
13
|
+ and join_stt_dt between #{fromDt} and #{toDt}
|
|
14
|
+ </if>
|
|
15
|
+ <if test="sAfflShopNm != null and sAfflShopNm != ''">
|
|
16
|
+ and affl_shop_nm like concat('%',#{sAfflShopNm},'%')
|
|
17
|
+ </if>
|
|
18
|
+ <choose>
|
|
19
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
20
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
21
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
22
|
+ order by affl_shop_nm asc
|
|
23
|
+ </if>
|
|
24
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
25
|
+ order by affl_shop_nm desc
|
|
26
|
+ </if>
|
|
27
|
+ </if>
|
|
28
|
+ </when>
|
|
29
|
+ <otherwise>
|
|
30
|
+ order by affl_shop_nm asc
|
|
31
|
+ </otherwise>
|
|
32
|
+ </choose>
|
|
33
|
+ <if test="gridRequest.pagingYn == true">
|
|
34
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
35
|
+ </if>
|
|
36
|
+ </select>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+ <select id="selectAfflShopGridCnt" resultType="int">
|
|
40
|
+ select /* selectAfflShopGridCnt */
|
|
41
|
+ count(*) as cnt
|
|
42
|
+ from affl_shop_base_info
|
|
43
|
+ where 1=1
|
|
44
|
+ and st_cd = 'S000'
|
|
45
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
46
|
+ and join_stt_dt between #{fromDt} and #{toDt}
|
|
47
|
+ </if>
|
|
48
|
+ <if test="sAfflShopNm != null and sAfflShopNm != ''">
|
|
49
|
+ and affl_shop_nm like concat('%',#{sAfflShopNm},'%')
|
|
50
|
+ </if>
|
|
51
|
+ </select>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+ <select id="selectAfflShopBaseIdDupYn" resultType="String">
|
|
55
|
+ select /* selectAfflShopBaseIdDupYn */
|
|
56
|
+ case when count(*) <![CDATA[ > ]]> 0 then 'Y' else 'N' end as dup_yn
|
|
57
|
+ from affl_shop_base_info
|
|
58
|
+ where affl_shop_id = #{afflShopId}
|
|
59
|
+ </select>
|
|
60
|
+
|
|
61
|
+ <insert id="insertAfflShopBaseInfo" >
|
|
62
|
+ insert into affl_shop_base_info /* insertAfflShopBaseInfo */
|
|
63
|
+ ( affl_shop_id , affl_shop_nm, st_cd, affl_abbr, bsns_reg_no, corp_reg_no, auth_type, bsns_cndt, ctgr_bsns, owner_nm,
|
|
64
|
+ owner_tel_no, rprst_fax_no, rprst_email, zip_no, addr1, addr2, rprst_tel_no, lat_x, long_y, reg_dt, reg_tm, reg_id, join_stt_dt, join_end_dt,
|
|
65
|
+ cmpny_logo_file_no, del_yn, corp_type, sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id )
|
|
66
|
+ values
|
|
67
|
+ (#{entity.afflShopId}, #{entity.afflShopNm}, #{entity.stCd}, #{entity.afflAbbr}, #{entity.bsnsRegNo}, #{entity.corpRegNo}, #{entity.authType}, #{entity.bsnsCndt}, #{entity.ctgrBsns}, #{entity.ownerNm},
|
|
68
|
+ #{entity.ownerTelNo}, #{entity.rprstFaxNo}, #{entity.rprstEmail}, #{entity.zipNo}, #{entity.addr1}, #{entity.addr2}, #{entity.rprstTelNo}, #{entity.latX}, #{entity.longY}, #{entity.regDt}, '000000', #{userId}, #{entity.joinSttDt}, #{entity.joinEndDt},
|
|
69
|
+ #{entity.cmpnyLogoFileNo}, 'N', #{entity.corpType}, now(), #{userId}, now(), #{userId} )
|
|
70
|
+ </insert>
|
|
71
|
+
|
|
72
|
+ <update id="updateAfflShopBaseInfo">
|
|
73
|
+ update affl_shop_base_info /* updateAfflShopBaseInfo */
|
|
74
|
+ set
|
|
75
|
+ affl_shop_nm = #{entity.afflShopNm }
|
|
76
|
+ ,st_cd = #{entity.stCd }
|
|
77
|
+ ,bsns_reg_no = #{entity.bsnsRegNo }
|
|
78
|
+ ,corp_reg_no = #{entity.corpRegNo }
|
|
79
|
+ ,auth_type = #{entity.authType }
|
|
80
|
+ ,bsns_cndt = #{entity.bsnsCndt }
|
|
81
|
+ ,ctgr_bsns = #{entity.ctgrBsns }
|
|
82
|
+ ,owner_nm = #{entity.ownerNm }
|
|
83
|
+ ,owner_tel_no = #{entity.ownerTelNo }
|
|
84
|
+ ,rprst_fax_no = #{entity.rprstFaxNo }
|
|
85
|
+ ,rprst_email = #{entity.rprstEmail }
|
|
86
|
+ ,zip_no = #{entity.zipNo }
|
|
87
|
+ ,addr1 = #{entity.addr1 }
|
|
88
|
+ ,addr2 = #{entity.addr2 }
|
|
89
|
+ ,rprst_tel_no = #{entity.rprstTelNo }
|
|
90
|
+ ,lat_x = #{entity.latX }
|
|
91
|
+ ,long_y = #{entity.longY }
|
|
92
|
+ ,join_stt_dt = #{entity.joinSttDt }
|
|
93
|
+ ,join_end_dt = #{entity.joinEndDt }
|
|
94
|
+ ,cmpny_logo_file_no = #{entity.cmpnyLogoFileNo }
|
|
95
|
+ ,corp_type = #{entity.corpType }
|
|
96
|
+ ,sys_chg_dttm = now()
|
|
97
|
+ ,sys_chg_id = #{userId }
|
|
98
|
+ where affl_shop_id = #{entity.afflShopId }
|
|
99
|
+ </update>
|
|
100
|
+
|
|
101
|
+ <insert id="insertAfflSaleInfo" >
|
|
102
|
+ insert into /** insertAfflSaleInfo */ affl_sale_info
|
|
103
|
+ (affl_shop_id, sale_mgr_id, sys_reg_dtm, sys_reg_id, sys_chg_dtm, sys_chg_id)
|
|
104
|
+ values
|
|
105
|
+ <foreach collection="gridInsertData" item="item" separator=",">
|
|
106
|
+ ( #{item.afflShopId},#{item.saleMgrId}, now(), #{userId}, now(), #{userId})
|
|
107
|
+ </foreach>
|
|
108
|
+ </insert>
|
|
109
|
+
|
|
110
|
+ <update id="deleteUserAuth">
|
|
111
|
+ update affl_sale_info
|
|
112
|
+ set del_yn = 'Y'
|
|
113
|
+ where affl_shop_id = #{afflShopId}
|
|
114
|
+ and saleMgrId in
|
|
115
|
+ <foreach collection="gridDeleteData" item="item" separator="," open="(" close=")">
|
|
116
|
+ #{item.saleMgrId}
|
|
117
|
+ </foreach>
|
|
118
|
+ </update>
|
|
119
|
+
|
|
120
|
+ <select id="selectAfflShopBaseInfo" resultType="com.oqpo.api.entity.stinfo.AfflShopBaseInfoEntity">
|
|
121
|
+ select
|
|
122
|
+ affl_shop_id , affl_shop_nm, fn_code_nm('ST_CD',st_cd) as st_cd_nm
|
|
123
|
+ , affl_abbr, bsns_reg_no, corp_reg_no
|
|
124
|
+ , auth_type, fn_code_nm('AUTH_TYPE',auth_type) as auth_type_nm, bsns_cndt, ctgr_bsns, owner_nm
|
|
125
|
+ , fn_get_telno(owner_tel_no) as owner_tel_no, fn_get_telno(rprst_fax_no) as rprst_fax_no, rprst_email, zip_no, addr1, addr2, rprst_tel_no, lat_x, long_y
|
|
126
|
+ , date_format(reg_dt,'%Y-%m-%d') as reg_dt, reg_id, concat(date_format(reg_dt,'%Y-%m-%d'), ' ~ ', date_format(reg_dt,'%Y-%m-%d')) as join_dt
|
|
127
|
+ , cmpny_logo_file_no, del_yn, fn_code_nm('CORP_TYPE',corp_type) as corp_type, sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id
|
|
128
|
+ from affl_shop_base_info
|
|
129
|
+ where affl_shop_id = #{afflShopId}
|
|
130
|
+ </select>
|
|
131
|
+
|
|
132
|
+ <select id="selectAfflSaleTargetList" resultType="com.oqpo.api.entity.stinfo.AfflSaleInfoEntity">
|
|
133
|
+ select sinfo.affl_shop_id , sinfo.sale_mgr_id, mgrm.sale_mgr_nm as 'saleMgrInfo.sale_mget_nm', mgrm.rprst_emal as 'saleMgrInfo.rprst_emal'
|
|
134
|
+ ,fn_get_telno(mgrm.rprst_tel_no) as 'saleMgrInfo.rprst_tel_no'
|
|
135
|
+ , mgrm.st_cd as 'saleMgrInfo.st_cd', fn_code_nm('ST_CD',mgrm.st_cd) as 'saleMgrInfo.st_nm'
|
|
136
|
+ from affl_sale_info sinfo
|
|
137
|
+ join sale_mgr_mgnt mgrm on sinfo.sale_mgr_id = mgrm.sale_mgr_id and mgrm.st_cd <![CDATA[ <> ]]> 'S001'
|
|
138
|
+ where sinfo.del_yn = 'N'
|
|
139
|
+ and sinfo.affl_shop_id = #{affl_shop_id}
|
|
140
|
+ <choose>
|
|
141
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
142
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
143
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
144
|
+ order by mgrm.sale_mgr_nm asc
|
|
145
|
+ </if>
|
|
146
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
147
|
+ order by mgrm.sale_mgr_nm desc
|
|
148
|
+ </if>
|
|
149
|
+ </if>
|
|
150
|
+ </when>
|
|
151
|
+ <otherwise>
|
|
152
|
+ order by mgrm.sale_mgr_nm asc
|
|
153
|
+ </otherwise>
|
|
154
|
+ </choose>
|
|
155
|
+ <if test="gridRequest.pagingYn == true">
|
|
156
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
157
|
+ </if>
|
|
158
|
+ </select>
|
|
159
|
+
|
|
160
|
+ <select id="selectAfflSaleTargetCnt" resultType="int">
|
|
161
|
+ select count(*)
|
|
162
|
+ from affl_sale_info
|
|
163
|
+ where affl_shop_id = #{affl_shop_id}
|
|
164
|
+ and del_yn = 'N'
|
|
165
|
+ </select>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+</mapper>
|