wzy
2021-04-01 d388e2788b7ef088d7cd40f901b0acdcec460bc3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?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.matrix.system.hive.dao.SysShopInfoDao">
 
 
    <resultMap type="SysShopInfo" id="SysShopInfoMap">
        <id property="id" column="ID" />
        <result property="shopNo" column="SHOP_NO" />
        <result property="shopName" column="SHOP_NAME" />
        <result property="shopAddr" column="SHOP_ADDR" />
        <result property="shopTel" column="SHOP_TEL" />
        <result property="shopDes" column="SHOP_DES" />
        <result property="shopImag" column="SHOP_IMAG" />
        <result property="qrcode" column="qrcode" />
 
        <result property="longitude" column="LONGITUDE" />
        <result property="latitude" column="LATITUDE" />
        <result property="rent" column="rent" />
        <result property="companyId" column="company_id" />
        <result property="bankNo" column="bank_no" />
        <result property="bankName" column="bank_name" />
        <result property="bankOwnerName" column="bank_owner_name" />
        <result property="shopShortName" column="shop_short_name" />
        <result property="shopType" column="shop_type" />
        <result property="isOpenNet" column="is_open_net" />
 
 
    </resultMap>
    <!--  插入方法   -->
    <insert id="insert" parameterType="SysShopInfo"
            useGeneratedKeys="true" keyProperty="id">
        INSERT INTO sys_shop_info (
            ID,
            SHOP_NO,
            SHOP_NAME,
            SHOP_ADDR,
            SHOP_TEL,
            SHOP_DES,
            SHOP_IMAG,
            LONGITUDE,
            LATITUDE,
            rent,
            qrcode,
            company_id,
            shop_short_name,
            shop_type,
            is_open_net,
            bank_no,
            bank_name,
            bank_owner_name
        )
    VALUES (
            #{id},
            #{shopNo},
            #{shopName},
            #{shopAddr},
            #{shopTel},
            #{shopDes},
            #{shopImag},
            #{longitude},
            #{latitude},
            #{rent},
            #{qrcode},
            #{companyId},
            #{shopShortName},
            #{shopType},
            #{isOpenNet},
            #{bankNo},
            #{bankName},
            #{bankOwnerName}
    )
    </insert>
 
 
    <!--  根据id更新 部分更新   -->
    <update id="update" >
        UPDATE sys_shop_info
        <set>
            <if test="shopNo != null and shopNo !='' ">
                SHOP_NO = #{shopNo},
            </if>
            <if test="shopName != null and shopName !='' ">
                SHOP_NAME = #{shopName},
            </if>
            <if test="shopAddr != null and shopAddr !='' ">
                SHOP_ADDR = #{shopAddr},
            </if>
            <if test="shopTel != null and shopTel !='' ">
                SHOP_TEL = #{shopTel},
            </if>
            <if test="shopDes != null and shopDes !='' ">
                SHOP_DES = #{shopDes},
            </if>
            <if test="shopImag != null and shopImag !='' ">
                SHOP_IMAG = #{shopImag},
            </if>
            <if test="qrcode != null and qrcode !='' ">
                qrcode = #{qrcode},
            </if>
 
 
            <if test="longitude != null and longitude !='' ">
                LONGITUDE = #{longitude},
            </if>
            <if test="latitude != null and latitude !='' ">
                LATITUDE = #{latitude},
            </if>
            <if test="rent != null and rent !='' ">
                rent = #{rent},
            </if>
            <if test="bankNo != null and bankNo !='' ">
                bank_no = #{bankNo},
            </if>
            <if test="bankName != null and bankName !='' ">
                bank_name = #{bankName},
            </if>
            <if test="bankOwnerName != null and bankOwnerName !='' ">
                bank_owner_name = #{bankOwnerName},
            </if>
            <if test="shopShortName != null and shopShortName !='' ">
                shop_short_name = #{shopShortName},
            </if>
            <if test="shopType != null and shopType !='' ">
                shop_type = #{shopType},
            </if>
            <if test="isOpenNet != null and isOpenNet !='' ">
                is_open_net = #{isOpenNet},
            </if>
 
        </set>
        WHERE id=#{id}
    </update>
 
 
 
    <!-- 批量删除 -->
    <delete id="deleteByIds" parameterType="java.util.List">
        delete from sys_shop_info where  ID in
        <foreach collection="list" index="index" item="item" open="("
                 separator="," close=")">
            #{item}
        </foreach>
    </delete>
 
    <!-- 根据id删除-->
    <delete id="deleteById" >
        DELETE FROM sys_shop_info
        where  ID=#{id}
    </delete>
 
    <select id="selectByShopName" resultMap="SysShopInfoMap">
            select *
        from sys_shop_info
        where SHOP_NAME = #{shopName}
 
    </select>
 
    <!-- 分页查询 -->
    <select id="selectInPage" resultMap="SysShopInfoMap">
        select
        a.*
        from sys_shop_info a
        where 1=1
        <if test="record!=null">
            <if test="record.id != null and record.id !='' ">
                and ID  = #{record.id}
            </if>
            <if test="record.shopNo != null and record.shopNo !='' ">
                and SHOP_NO  like CONCAT('%', #{record.shopNo},'%')
            </if>
            <if test="record.shopName != null and record.shopName !='' ">
                and SHOP_NAME  like CONCAT('%', #{record.shopName},'%')
            </if>
 
            <if test="record.shopTel != null and record.shopTel !='' ">
                and SHOP_TEL  = #{record.shopTel}
            </if>
 
            <if test="record.longitude != null and record.longitude !='' ">
                and    LONGITUDE = #{record.longitude}
            </if>
            <if test="record.latitude != null and record.latitude !='' ">
                and    LATITUDE = #{record.latitude}
            </if>
 
            <if test="record.shopType != null and record.shopType !='' ">
                and    shop_type = #{record.shopType}
            </if>
 
            <if test="record.companyId != null and record.companyId !='' ">
                and    company_id = #{record.companyId}
            </if>
 
 
 
        </if>
        <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
            <if test="pageVo.sort !=null  and pageVo.order !=null">
                order by
                ${pageVo.sort} ${pageVo.order}
            </if>
            <if test="pageVo.offset >=0  and pageVo.limit >0">
                limit
                #{pageVo.offset},#{pageVo.limit}
            </if>
        </if>
    </select>
 
    <!-- 查询总条数 -->
    <select id="selectTotalRecord"    resultType="java.lang.Integer">
        select count(*)
        from sys_shop_info
        where 1=1
        <if test="record!=null">
            <if test="record.id != null and record.id !='' ">
                and ID  = #{record.id}
            </if>
            <if test="record.shopNo != null and record.shopNo !='' ">
                and SHOP_NO  = #{record.shopNo}
            </if>
            <if test="record.shopName != null and record.shopName !='' ">
                and SHOP_NAME  like CONCAT('%', #{record.shopName},'%')
            </if>
 
            <if test="record.shopTel != null and record.shopTel !='' ">
                and SHOP_TEL  = #{record.shopTel}
            </if>
 
            <if test="record.longitude != null and record.longitude !='' ">
                and    LONGITUDE = #{record.longitude}
            </if>
            <if test="record.latitude != null and record.latitude !='' ">
                and    LATITUDE = #{record.latitude}
            </if>
 
            <if test="record.shopType != null and record.shopType !='' ">
                and    shop_type = #{record.shopType}
            </if>
            <if test="record.companyId != null and record.companyId !='' ">
                and    company_id = #{record.companyId}
            </if>
 
        </if>
    </select>
 
    <!-- 根据id查询-->
    <select id="selectById" resultMap="SysShopInfoMap">
        select *
        from sys_shop_info
        where  id=#{id}
    </select>
 
    <select id="selectShopInfo" resultMap="SysShopInfoMap">
            select * from sys_shop_info where  shop_type != 1
        <if test="companyId != null   ">
            and company_id=#{companyId}
        </if>
    </select>
 
 
 
 
 
    <!-- 根据对象查询-->
    <select id="selectByModel" resultMap="SysShopInfoMap">
        select *
        from sys_shop_info
        where 1=1
        <if test="record!=null">
            <if test="record.id != null and record.id !='' ">
                and ID  = #{record.id}
            </if>
            <if test="record.shopNo != null and record.shopNo !='' ">
                and SHOP_NO  = #{record.shopNo}
            </if>
            <if test="record.shopName != null and record.shopName !='' ">
                and SHOP_NAME  like CONCAT('%', #{record.shopName},'%')
            </if>
 
            <if test="record.shopTel != null and record.shopTel !='' ">
                and SHOP_TEL  = #{record.shopTel}
            </if>
            <if test="(record.companyId!=null and record.companyId!='') ">
                and company_id = #{record.companyId}
            </if>
 
            <if test="record.shopType != null and record.shopType !='' ">
                and    shop_type = #{record.shopType}
            </if>
            <if test="record.isOpenNet != null and record.isOpenNet !='' ">
                and    is_open_net = #{record.isOpenNet}
            </if>
 
 
 
        </if>
    </select>
 
    <select id="selectByIdAndComId" resultMap="SysShopInfoMap">
        select * from sys_shop_info where id=#{id}
    </select>
 
    <select id="selectByType" resultMap="SysShopInfoMap">
        select * from sys_shop_info where shop_type=#{shopType} and company_id=#{companyId}
    </select>
 
 
    <select id="selectZbShop" resultMap="SysShopInfoMap">
        select * from sys_shop_info where shop_type=1 and company_id=#{companyId}
    </select>
 
</mapper>