PickUpPointMapper.xml
10.6 KB
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
<?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.diligrp.website.dao.impl.PickUpPointDaoImpl">
<resultMap id="pickInfo" type="com.diligrp.website.domain.PickUpPointDomain">
<id property="id" column="id"/>
<result property="pickName" column="pickup_name"/>
<result property="pickCode" column="pickup_code"/>
<result property="addressId" column="address_id"/>
<result property="addressTxt" column="address_txt"/>
<result property="remark" column="description"/>
<result property="isMarket" column="is_market"/>
<result property="isDeaflutMarket" column="is_default"/>
<result property="longitude" column="longitude"/>
<result property="latitude" column="latitude"/>
<result property="abbreviation" column="abbreviation"/>
<result property="createTime" column="created"/>
<result property="modifyTime" column="modified"/>
<result property="yn" column="yn"/>
<result property="operateId" column="operate_id"/>
<result property="operateName" column="operate_name"/>
<result property="parentPickId" column="parent_pickId"/>
<result property="relationMarket" column="relation_market"/>
<result property="recommend" column="recommend"/>
<result property="myself" column="myself"/>
<association property="personList" column="id"
select="com.diligrp.website.dao.impl.PickUpPersonDaoImpl.SELECT-PICK-UP-PERSON-INFO"/>
<association property="cityList" column="id"
select="com.diligrp.website.dao.impl.PickUpCityDaoImpl.SELECT-PICK-UP-CITY-INFO"/>
</resultMap>
<resultMap id="pickUpPerson" type="com.diligrp.website.domain.PickUpPerson">
<result property="pickid" column="packup_id"/>
<result property="contactName" column="contact_name"/>
<result property="contactPhone" column="contact_tel"/>
</resultMap>
<resultMap id="pickUpCity" type="com.diligrp.website.domain.PickUpCity">
<result property="pickId" column="packup_id"/>
<result property="cityId" column="city_id"/>
</resultMap>
<select id="SELECT-PICK-UP-INFO" parameterType="Query"
resultMap="pickInfo">
<![CDATA[
select id,pickup_code, pickup_name ,abbreviation,is_market,is_default,myself,recommend from t_packup where yn=1
]]>
<if test="param.pickName != null and param.pickName != ''">
and instr (pickup_name,#{param.pickName})
</if>
<if test="param.abbreviation != null and param.abbreviation!= ''">
and instr (abbreviation,#{param.abbreviation})
</if>
<if test="param.nowTime != null and param.nowTime != ''">
and period_begin >= #{param.nowTime}
and period_end
<= #{param.nowTime}
</if>
<if test="param.isMarket != null and param.isMarket != ''">
and is_market = #{param.isMarket}
</if>
<if test="param.myself != null and param.myself != ''">
and myself = #{param.myself}
</if>
<![CDATA[
order by created desc
limit #{startRow},#{pageSize}
]]>
</select>
<select id="SELECT-COUNT-PICK-UP-INFO" parameterType="Query"
resultType="Integer">
<![CDATA[
select count(1) from t_packup where yn=1
]]>
<if test="param.pickName != null and param.pickName != ''">
and instr (pickup_name,#{param.pickName})
</if>
<if test="param.abbreviation != null and param.abbreviation!= ''">
and instr (abbreviation,#{param.abbreviation})
</if>
<if test="param.nowTime != null and param.nowTime != ''">
and period_begin >= #{param.nowTime}
and period_end
<= #{param.nowTime}
</if>
<if test="param.isMarket != null and param.isMarket != ''">
and is_market = #{param.isMarket}
</if>
<if test="param.myself != null and param.myself != ''">
and myself = #{param.myself}
</if>
</select>
<insert id="INSERT-PICKUP-INFO" parameterType="com.diligrp.website.domain.PickUpPointDomain">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select
LAST_INSERT_ID() ;
</selectKey>
<![CDATA[
insert into
t_packup(pickup_name,pickup_code,address_id,address_txt,description,is_market,is_default,recommend,myself,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market)
values
(#{pickName},#{pickCode},#{addressId},#{addressTxt},#{remark},#{isMarket},#{isDeaflutMarket},#{recommend},#{myself},
#{longitude},#{latitude},#{abbreviation},#{operateId},#{operateName},sysdate(),#{parentPickId},#{relationMarket})
]]>
</insert>
<select id="SELECT-ONE-PICK-UP-INFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where id=#{id} and yn=1
</select>
<select id="SELECT-DEFALUT-PICK-UP-INFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where is_default=1 and yn=1
</select>
<update id="UPDATE-PICKUP-INFO" parameterType="com.diligrp.website.domain.PickUpPointDomain">
update t_packup set pickup_name=#{pickName} ,pickup_code=#{pickCode},address_id=#{addressId},address_txt=#{addressTxt},
description=#{remark},longitude=#{longitude},latitude=#{latitude},abbreviation=#{abbreviation},recommend=#{recommend},myself=#{myself}
,operate_id = #{operateId},operate_name=#{operateName},modified=sysdate(),parent_pickId=#{parentPickId} where id=#{id}
</update>
<update id="UPDATE-PICKUP-INFO-STATE" parameterType="Long">
update t_packup set is_default=1,modified=sysdate() where id=#{id}
</update>
<update id="UPDATE-PICKUP-INFO-STATE-NOT-DEAFULT">
update t_packup set is_default=0 where is_default=1 and is_market=1
</update>
<select id="SELECT-RELATION-PICKINFO" resultMap="pickInfo" parameterType="Long">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where parent_pickId=#{id} and yn=1
</select>
<select id="SELECT-IS-MARKET-RELATION-PICKINFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where is_market=2 and relation_market=0 and yn=1
</select>
<!-- 供管理服务用 是市场的提货点信息-->
<select id="SELECT-IS-MARKET-PICKINFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where is_market=1 and yn=1
</select>
<!-- 供管理服务用 不是市场-->
<select id="SELECT-IS-NOT-MARKET-PICKINFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where is_market=2 and yn=1
</select>
<!-- 所有 提货点信息 -->
<select id="SELECT-ALL-MARKET-PICKINFO" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where yn=1 ORDER BY recommend desc
</select>
<update id="UPDATE-RELATION-PICKINFO" parameterType="Map">
update t_packup set parent_pickId=#{pickId},relation_market=1 where id=#{id}
</update>
<update id="UPDATE-PICKUP-RELATION-INFO-STATE" parameterType="Long">
update t_packup set parent_pickId=null,relation_market=0 where parent_pickId=#{id}
</update>
<!-- 根据code查询提货点信心 -->
<select id="SELECT-CODE-BY-PICKINFO" resultMap="pickInfo" parameterType="String">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where pickup_code=#{code} and yn=1
</select>
<!-- 根据Name查询提货点信息 -->
<select id="getPickUpInfoByName" resultMap="pickInfo" parameterType="String">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where pickup_name like "%"#{pickName}"%" and yn=1
</select>
<!-- 获取推荐提货点 -->
<select id="getRecommendPickUp" resultMap="pickInfo">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup where recommend = 2 and yn=1
</select>
<!-- 根据城市Name模糊查询提货点信息 -->
<select id="getPickUpInfoByCityName" resultMap="pickInfo" parameterType="String">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup left join t_city on region_id = address_id where region_name like "%"#{cityName}"%" and yn=1
</select>
<!-- 根据城市Id查询所有提货点信息 -->
<select id="getAllPickUpListByCityId" resultMap="pickInfo" parameterType="Long">
select
id,pickup_name,pickup_code,address_id,address_txt,description,is_market,
is_default,longitude,latitude,abbreviation,operate_id,operate_name,created,parent_pickId,relation_market,recommend,myself
from t_packup p left join t_city ct on ct.region_id = p.address_id where ct.parent_id = #{cityId} or ct.region_id = #{cityId} and yn=1
</select>
</mapper>