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
51d52c07
Commit
51d52c07
authored
Jun 08, 2019
by
wuwz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
旅游路线
parent
e300a0bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
30 deletions
+98
-30
TourGoodBiz.java
...src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
+40
-17
TourGoodMapper.java
...in/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
+6
-1
TourGoodController.java
.../java/com/xxfc/platform/tour/rest/TourGoodController.java
+28
-12
TourGoodMapper.xml
...-tour-server/src/main/resources/mapper/TourGoodMapper.xml
+24
-0
No files found.
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
View file @
51d52c07
package
com
.
xxfc
.
platform
.
tour
.
biz
;
package
com
.
xxfc
.
platform
.
tour
.
biz
;
import
com.xxfc.platform.tour.mapper.TourGoodMapper
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
org.springframework.stereotype.Service
;
import
com.github.wxiaoqi.security.common.msg.ListRestResponse
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.tour.entity.TourGood
;
import
com.xxfc.platform.tour.mapper.TourGoodMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 旅游商品表
import
com.xxfc.platform.tour.entity.TourGood
;
*
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
* @author zjw
import
org.springframework.web.bind.annotation.PathVariable
;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
import
java.util.HashMap
;
*/
import
java.util.List
;
@Service
import
java.util.Map
;
public
class
TourGoodBiz
extends
BaseBiz
<
TourGoodMapper
,
TourGood
>
{
/**
* 旅游商品表
*
* @author zjw
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Service
public
class
TourGoodBiz
extends
BaseBiz
<
TourGoodMapper
,
TourGood
>
{
@Autowired
private
TourGoodMapper
tourGoodMapper
;
public
PageDataVO
<
TourGood
>
getGoodList
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
){
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"query"
,
query
);
params
.
put
(
"latitude"
,
latitude
);
params
.
put
(
"longitude"
,
longitude
);
params
.
put
(
"tagId"
,
tagId
);
params
.
put
(
"distance"
,
distance
);
List
<
TourGood
>
list
=
tourGoodMapper
.
getGoodList
(
params
);
return
PageDataVO
.
pageInfo
(
page
,
limit
,
list
);
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
View file @
51d52c07
package
com
.
xxfc
.
platform
.
tour
.
mapper
;
package
com
.
xxfc
.
platform
.
tour
.
mapper
;
import
com.xxfc.platform.tour.entity.TourGood
;
import
com.xxfc.platform.tour.entity.TourGood
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 旅游商品表
* 旅游商品表
*
*
...
@@ -11,5 +16,5 @@ import tk.mybatis.mapper.common.Mapper;
...
@@ -11,5 +16,5 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-06-06 11:41:51
* @date 2019-06-06 11:41:51
*/
*/
public
interface
TourGoodMapper
extends
Mapper
<
TourGood
>
{
public
interface
TourGoodMapper
extends
Mapper
<
TourGood
>
{
public
List
<
TourGood
>
getGoodList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
}
}
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodController.java
View file @
51d52c07
package
com
.
xxfc
.
platform
.
tour
.
rest
;
package
com
.
xxfc
.
platform
.
tour
.
rest
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.xxfc.platform.tour.biz.TourGoodBiz
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.xxfc.platform.tour.entity.TourGood
;
import
com.github.wxiaoqi.security.common.msg.ListRestResponse
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.tour.biz.TourGoodBiz
;
@RestController
import
com.xxfc.platform.tour.entity.TourGood
;
@RequestMapping
(
"tourGood"
)
import
io.swagger.annotations.ApiOperation
;
public
class
TourGoodController
extends
BaseController
<
TourGoodBiz
,
TourGood
>
{
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RequestMapping
(
"tourGood"
)
public
class
TourGoodController
extends
BaseController
<
TourGoodBiz
,
TourGood
>
{
@ApiOperation
(
"订单详情"
)
@RequestMapping
(
value
=
"/app/unauth/getGoodList"
,
method
=
RequestMethod
.
GET
)
//@GetMapping(value = "/app/unauth/getGoodList")
@IgnoreClientToken
@ResponseBody
public
PageDataVO
<
TourGood
>
getGoodList
(
@RequestParam
(
value
=
"page"
,
required
=
true
)
Integer
page
,
@RequestParam
(
value
=
"limit"
,
required
=
true
)
Integer
limit
,
@RequestParam
(
value
=
"query"
)
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
=
"distance"
,
defaultValue
=
"10.00"
)
Double
distance
){
//BaseResponse baseResponse = new BaseResponse();
return
baseBiz
.
getGoodList
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodMapper.xml
View file @
51d52c07
...
@@ -25,4 +25,28 @@
...
@@ -25,4 +25,28 @@
<result
property=
"unit"
column=
"unit"
/>
<result
property=
"unit"
column=
"unit"
/>
</resultMap>
</resultMap>
<select
id=
"getGoodList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
SELECT * from tour_good t
where 1=1
<if
test=
"params.query != null and params.query != ''"
>
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if>
<if
test=
"params.latitude != null and params.latitude != '' and params.longitude != null and params.longitude != ''"
>
and t.id in (SELECT s.good_id from (
select good_id,
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)
*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-22.954205* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS(113.879421 * PI() / 180.0)
*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 = 1) and t.recommend = 1
ORDER BY t.recommend
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
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