Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
3e922cd8
Commit
3e922cd8
authored
Jul 01, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
c90c3dab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
18 deletions
+30
-18
TourGoodBiz.java
...src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
+7
-1
TourGoodMapper.java
...in/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
+2
-0
TourGoodController.java
.../java/com/xxfc/platform/tour/rest/TourGoodController.java
+1
-1
TourGoodMapper.xml
...-tour-server/src/main/resources/mapper/TourGoodMapper.xml
+20
-16
No files found.
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
View file @
3e922cd8
...
@@ -66,7 +66,13 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
...
@@ -66,7 +66,13 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
*/
*/
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
){
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
){
Map
<
String
,
Object
>
params
=
initParam
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
Map
<
String
,
Object
>
params
=
initParam
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
return
new
ObjectRestResponse
().
status
(
RestCode
.
SUCCESS
.
getStatus
()).
msg
(
RestCode
.
SUCCESS
.
getMsg
()).
data
(
PageDataVO
.
pageInfo
(
page
,
limit
,
()
->
mapper
.
getGoodList
(
params
)));
PageDataVO
<
TourGood
>
dataVO
=
null
;
if
(
latitude
!=
null
&&
latitude
>
0
&&
longitude
!=
null
&&
longitude
>
0
){
dataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()->
mapper
.
getCoordinateList
(
params
));
}
else
{
dataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()->
mapper
.
getGoodList
(
params
));
}
return
new
ObjectRestResponse
().
status
(
RestCode
.
SUCCESS
.
getStatus
()).
msg
(
RestCode
.
SUCCESS
.
getMsg
()).
data
(
dataVO
);
}
}
private
Map
<
String
,
Object
>
initParam
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
)
{
private
Map
<
String
,
Object
>
initParam
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
)
{
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
View file @
3e922cd8
...
@@ -23,6 +23,8 @@ public interface TourGoodMapper extends Mapper<TourGood> {
...
@@ -23,6 +23,8 @@ public interface TourGoodMapper extends Mapper<TourGood> {
//查询旅游路线列表
//查询旅游路线列表
public
List
<
TourGood
>
getGoodList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
public
List
<
TourGood
>
getGoodList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
//根据经纬度查询旅游路线列表
public
List
<
TourGood
>
getCoordinateList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
//获取商品列表
//获取商品列表
public
List
<
TourGoodVo
>
findGoodList
(
@Param
(
"params"
)
GoodSearchDTO
tourGoodDTO
);
public
List
<
TourGoodVo
>
findGoodList
(
@Param
(
"params"
)
GoodSearchDTO
tourGoodDTO
);
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodController.java
View file @
3e922cd8
...
@@ -36,7 +36,7 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
...
@@ -36,7 +36,7 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
@RequestParam
(
value
=
"page"
,
required
=
true
)
Integer
page
,
@RequestParam
(
value
=
"limit"
,
required
=
true
)
Integer
limit
,
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
@RequestParam
(
value
=
"page"
,
required
=
true
)
Integer
page
,
@RequestParam
(
value
=
"limit"
,
required
=
true
)
Integer
limit
,
@RequestParam
(
value
=
"query"
,
required
=
false
)
String
query
,
@RequestParam
(
value
=
"latitude"
,
required
=
false
)
Double
latitude
,
@RequestParam
(
value
=
"query"
,
required
=
false
)
String
query
,
@RequestParam
(
value
=
"latitude"
,
required
=
false
)
Double
latitude
,
@RequestParam
(
value
=
"longitude"
,
required
=
false
)
Double
longitude
,
@RequestParam
(
value
=
"tagId"
,
required
=
false
)
Integer
tagId
,
@RequestParam
(
value
=
"longitude"
,
required
=
false
)
Double
longitude
,
@RequestParam
(
value
=
"tagId"
,
required
=
false
)
Integer
tagId
,
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"10.00"
)
Double
distance
)
{
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"10
0
.00"
)
Double
distance
)
{
return
baseBiz
.
getGoodList
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
return
baseBiz
.
getGoodList
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
}
}
...
...
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodMapper.xml
View file @
3e922cd8
...
@@ -51,6 +51,21 @@
...
@@ -51,6 +51,21 @@
<result
property=
"isOutside"
column=
"is_outside"
/>
<result
property=
"isOutside"
column=
"is_outside"
/>
</resultMap>
</resultMap>
<!--查询旅游路线列表-->
<select
id=
"getCoordinateList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
SELECT t.* from tour_good t
left join (
select good_id,
IFNULL(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS( #{params.longitude} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ,0 ) AS distance
FROM tour_good_site WHERE type=2 ) gs ON t.id=gs.good_id
where t.is_del=0 AND t.status=1 and gs.distance
<
#{params.distance}
<if
test=
"params.query != null and params.query != ''"
>
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if>
order by gs.distance
</select>
<!--查询旅游路线列表-->
<!--查询旅游路线列表-->
<select
id=
"getGoodList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
<select
id=
"getGoodList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
SELECT * from tour_good t
SELECT * from tour_good t
...
@@ -58,22 +73,11 @@
...
@@ -58,22 +73,11 @@
<if
test=
"params.query != null and params.query != ''"
>
<if
test=
"params.query != null and params.query != ''"
>
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if>
</if>
<if
test=
"params.latitude != null and params.latitude != '' and params.longitude != null and params.longitude != ''"
>
<if
test=
"params.tagId != null and params.tagId != '' "
>
and t.id in (SELECT s.good_id from (
and t.id in (SELECT tg.good_id from tour_good_tag tg
select good_id,
where tg.tag_id = #{params.tagId}) and t.recommend = 1
if(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS( #{params.longitude} * PI() / 180.0)
ORDER BY t.recommend
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 is null ,0,ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS(#{params.longitude} * PI() / 180.0)
</if>
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ) AS distance
FROM tour_good_site
order by distance
) s
where s.distance
<
#{params.distance})
</if>
<if
test=
"params.tagId != null and params.tagId != '' "
>
and t.id in (SELECT tg.good_id from tour_good_tag tg
where tg.tag_id = #{params.tagId}) and t.recommend = 1
ORDER BY t.recommend
</if>
</select>
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment