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
<?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="storeV1ServiceDaoImpl">
 
    <!-- 保存商户信息信息 add by wuxw 2018-07-03 -->
    <insert id="saveStoreInfo" parameterType="Map">
        insert into s_store(address, store_type_cd, name, tel, state, store_id, user_id, map_y, map_x, nearby_landmarks)
        values (#{address}, #{storeTypeCd}, #{name}, #{tel}, #{state}, #{storeId}, #{userId}, #{mapY}, #{mapX},
                #{nearByLandmarks})
    </insert>
 
    <!-- 查询商户信息信息 add by wuxw 2018-07-03 -->
    <select id="getStoreInfo" parameterType="Map" resultType="Map">
        select t.address,t.store_type_cd,t.store_type_cd storeTypeCd,t.name,t.tel,t.status_cd,t.status_cd
        statusCd,t.state,t.store_id,t.store_id storeId,t.user_id,t.user_id userId,t.map_y,t.map_y mapY,t.map_x,t.map_x
        mapX,t.create_time createTime,t.nearby_landmarks,t.nearby_landmarks nearByLandmarks,sa.value
        corporation,sa1.value foundingTime,
        CASE t.store_type_cd
        WHEN '800900000000' THEN '开发团队'
        WHEN '800900000001' THEN '运营团队'
        WHEN '800900000002' THEN '代理商'
        WHEN '800900000003' THEN '物业商户'
        WHEN '800900000005' THEN '商家'
        ELSE '其他' END as storeTypeName
        from s_store t
        left join s_store_attr sa on t.store_id = sa.store_id and sa.spec_cd = '100201903001' and sa.status_cd='0'
        left join s_store_attr sa1 on t.store_id = sa1.store_id and sa1.spec_cd = '100201903003' and sa1.status_cd='0'
        where 1 =1
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="storeTypeCd !=null and storeTypeCd != ''">
            and t.store_type_cd= #{storeTypeCd}
        </if>
        <if test="name !=null and name != ''">
            and t.name like '%${name}%'
        </if>
        <if test="tel !=null and tel != ''">
            and t.tel= #{tel}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="userId !=null and userId != ''">
            and t.user_id= #{userId}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="nearByLandmarks !=null and nearByLandmarks != ''">
            and t.nearby_landmarks= #{nearByLandmarks}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
    <!-- 修改商户信息信息 add by wuxw 2018-07-03  t.nearby_landmarks nearbyLandmarks -->
    <update id="updateStoreInfo" parameterType="Map">
        update s_store t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="address !=null and address != ''">
            , t.address= #{address}
        </if>
        <if test="storeTypeCd !=null and storeTypeCd != ''">
            , t.store_type_cd= #{storeTypeCd}
        </if>
        <if test="nearByLandmarks !=null and nearByLandmarks != ''">
            , t.nearby_landmarks= #{nearByLandmarks}
        </if>
        <if test="name !=null and name != ''">
            , t.name= #{name}
        </if>
        <if test="tel !=null and tel != ''">
            , t.tel= #{tel}
        </if>
        <if test="state !=null and state != ''">
            , t.state= #{state}
        </if>
        <if test="userId !=null and userId != ''">
            , t.user_id= #{userId}
        </if>
        <if test="mapY !=null and mapY != ''">
            , t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            , t.map_x= #{mapX}
        </if>
        where 1=1
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
    </update>
 
    <!-- 查询商户信息数量 add by wuxw 2018-07-03 -->
    <select id="queryStoresCount" parameterType="Map" resultType="Map">
        select count(1) count
        from s_store t
        where 1 =1
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="storeTypeCd !=null and storeTypeCd != ''">
            and t.store_type_cd= #{storeTypeCd}
        </if>
        <if test="name !=null and name != ''">
            and t.name like '%${name}%'
        </if>
        <if test="tel !=null and tel != ''">
            and t.tel= #{tel}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="userId !=null and userId != ''">
            and t.user_id= #{userId}
        </if>
        <if test="mapY !=null and mapY != ''">
            and t.map_y= #{mapY}
        </if>
        <if test="mapX !=null and mapX != ''">
            and t.map_x= #{mapX}
        </if>
        <if test="nearByLandmarks !=null and nearByLandmarks != ''">
            and t.nearby_landmarks= #{nearByLandmarks}
        </if>
    </select>
</mapper>