合并yc分支
This commit is contained in:
parent
8c345d0f2b
commit
af16ff2f41
|
|
@ -46,7 +46,7 @@ router.beforeEach(function (to, from, next) {
|
|||
let user = sessionStorage.getItem('user');
|
||||
//除了登录、注册、首页、商家列表、商家信息之外,都需要判断是否登录
|
||||
if (!(to.path == '/' || to.path == '/index' || to.path == '/businessList' || to.path == '/businessInfo' ||
|
||||
to.path == '/login' || to.path == '/register' || to.path == '/my' || to.path == '/error403')) {
|
||||
to.path == '/login' || to.path == '/register' || to.path == '/my' || to.path == '/error403' || to.path == '/searchResults')) {
|
||||
if (user == null) {
|
||||
router.push('/login');
|
||||
// location.reload();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import My from '../views/My.vue';
|
|||
import PointsDetails from '../views/PointsDetails.vue';
|
||||
import Wallet from '../views/Wallet.vue';
|
||||
import Error403 from '../components/Error403';
|
||||
import SearchResults from "../views/SearchResults";
|
||||
|
||||
|
||||
const routes = [{
|
||||
|
|
@ -83,6 +84,10 @@ const routes = [{
|
|||
path: '/error403',
|
||||
name: 'Error403',
|
||||
component: Error403
|
||||
}, {
|
||||
path: '/searchResults',
|
||||
name: 'SearchResults',
|
||||
component: SearchResults
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@
|
|||
<div class="location-text">天津大学北洋园校区<i class="fa fa-caret-down"></i></div>
|
||||
</header>
|
||||
<!-- search部分 -->
|
||||
<!--
|
||||
<!--
|
||||
搜索框部分(此块与search-fixed-top块宽度高度一致,用于当
|
||||
search-fixed-top块固定后,挡住下面块不要窜上去)
|
||||
-->
|
||||
<div class="search">
|
||||
<!-- 当滚动条超过上面的定位块时,search-fixed-top块变成固定在顶部。 -->
|
||||
<div class="search-fixed-top" ref="fixedBox">
|
||||
<!-- 搜索框部分中间的白框 -->
|
||||
<div class="search-box">
|
||||
<i class="fa fa-search"></i>搜索饿了么商家、商品名称
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search">
|
||||
<!-- 当滚动条超过上面的定位块时,search-fixed-top块变成固定在顶部。 -->
|
||||
<div class="search-fixed-top" ref="fixedBox">
|
||||
<!-- 搜索框部分中间的白框 -->
|
||||
<div class="search-box">
|
||||
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i><input type="text" v-model="keyword" placeholder="搜索饿了么商家、商品名称">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 点餐分类部分 -->
|
||||
<ul class="foodtype">
|
||||
<li @click="toBusinessList(1)">
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
</div>
|
||||
<div class="business-info-promotion">
|
||||
<div class="business-info-promotion-left">
|
||||
<div class="business-info-promotion-left-incon" style="backgroundcolor: #F1884F;">特</div>
|
||||
<div class="business-info-promotion-left-incon" style="background-color: #F1884F;">特</div>
|
||||
<p>特价商品5元起</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -331,6 +331,11 @@
|
|||
import Footer from '../components/Footer.vue';
|
||||
export default {
|
||||
name: 'Index',
|
||||
data(){
|
||||
return{
|
||||
keyword: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.onscroll = () => {
|
||||
//获取滚动条位置
|
||||
|
|
@ -370,7 +375,16 @@
|
|||
orderTypeId: orderTypeId
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
toSearch(){
|
||||
if(this.keyword==='') return;
|
||||
this.$router.push({
|
||||
path: '/searchResults',
|
||||
query: {
|
||||
keyword: this.keyword
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -460,10 +474,21 @@
|
|||
user-select: none;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top .search-box input{
|
||||
border: none;
|
||||
outline: none;
|
||||
height: 4vw;
|
||||
font-size: 3vw;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top .search-box .fa-search {
|
||||
margin-right: 1vw;
|
||||
}
|
||||
|
||||
.blue-icon {
|
||||
color: #01B0F2;
|
||||
}
|
||||
|
||||
/****************** 点餐分类部分 ******************/
|
||||
.wrapper .foodtype {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,428 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
|
||||
<!-- header部分 -->
|
||||
<header>
|
||||
<i class="fa fa-angle-left" @click="back"></i>
|
||||
<p>搜索结果</p>
|
||||
</header>
|
||||
|
||||
<!-- search部分 -->
|
||||
<div class="search">
|
||||
<!-- 当滚动条超过上面的定位块时,search-fixed-top块变成固定在顶部。 -->
|
||||
<div class="search-fixed-top" ref="fixedBox">
|
||||
<!-- 搜索框部分中间的白框 -->
|
||||
<div class="search-box">
|
||||
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i>
|
||||
<input type="text" v-model="keyword" @input="toSearch()" placeholder="搜索饿了么商家、商品名称">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类 -->
|
||||
<div class="category">
|
||||
<div @click="curTab=0;this.$setSessionStorage('defaultTab', 0);" :class="[curTab === 0 ? 'cur' : 'other']">商家</div>
|
||||
<div @click="curTab=1;this.$setSessionStorage('defaultTab', 1);" :class="[curTab === 1 ? 'cur' : 'other']">食品</div>
|
||||
</div>
|
||||
|
||||
<!-- 未找到 -->
|
||||
<div v-if="curTab===0&&businessArr.length===0||curTab===1&&foodArr.length===0" class="not-found">未找到任何结果,请尝试其他关键词</div>
|
||||
|
||||
<!-- 商家列表部分 -->
|
||||
<ul v-if="curTab===0" class="business">
|
||||
<li v-for="item in businessArr" @click="toBusinessInfo(item.businessId)">
|
||||
<div class="border">
|
||||
<div class="business-img">
|
||||
<img :src="item.businessImg">
|
||||
<div class="business-img-quantity" v-show="item.quantity>0">{{ item.quantity }}</div>
|
||||
</div>
|
||||
<div class="business-info">
|
||||
<h3 v-html="highlightKeyword(item.businessName)"></h3>
|
||||
<p>¥{{ item.starPrice }}起送 | ¥{{ item.deliveryPrice }}配送</p>
|
||||
<p v-html="highlightKeyword(item.businessExplain)"></p>
|
||||
<p v-html="highlightKeyword(item.businessAddress)"></p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- 食品列表部分 -->
|
||||
<ul v-if="curTab===1" class="food">
|
||||
<li v-for="(item,index) in foodArr" @click="toBusinessInfo(item.businessId)">
|
||||
<div class="food-left">
|
||||
<img :src="item.foodImg">
|
||||
<div class="food-left-info">
|
||||
<h3 v-html="highlightKeyword(item.foodName)"></h3>
|
||||
<p v-html="highlightKeyword(item.foodExplain)"></p>
|
||||
<p>¥{{item.foodPrice}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<Footer></Footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Footer from '../components/Footer.vue';
|
||||
|
||||
export default {
|
||||
name: 'SearchResults',
|
||||
data() {
|
||||
return {
|
||||
keyword: this.$route.query.keyword,
|
||||
businessArr: [],
|
||||
foodArr: [],
|
||||
user: {},
|
||||
curTab: this.$getSessionStorage('defaultTab')===null?0:this.$getSessionStorage('defaultTab')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.user = this.$getSessionStorage('user');
|
||||
|
||||
this.listBusinessAndFood();
|
||||
},
|
||||
components: {
|
||||
Footer
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
this.$router.go(-1);
|
||||
},
|
||||
listCart() {
|
||||
let url = `CartController/listCart/${this.user.userId}`
|
||||
this.$axios.get(url).then(response => {
|
||||
let cartArr = response.data.result;
|
||||
//遍历所有食品列表
|
||||
for (let businessItem of this.businessArr) {
|
||||
businessItem.quantity = 0;
|
||||
for (let cartItem of cartArr) {
|
||||
if (cartItem.businessId == businessItem.businessId) {
|
||||
businessItem.quantity += cartItem.quantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.businessArr.sort();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
listBusinessAndFood(){
|
||||
//根据keyword查询商家信息
|
||||
let url = `SearchController/listBusinessByKeyword/${this.keyword}`
|
||||
this.$axios.get(url).then(response => {
|
||||
this.businessArr = response.data.result;
|
||||
//判断是否登录
|
||||
if (this.user != null) {
|
||||
this.listCart();
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
url=`SearchController/listFoodByKeyword/${this.keyword}`
|
||||
this.$axios.get(url).then(response => {
|
||||
this.foodArr = response.data.result;
|
||||
for (let i = 0; i < this.foodArr.length; i++) {
|
||||
this.foodArr[i].quantity = 0;
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
toBusinessInfo(businessId) {
|
||||
this.$router.push({
|
||||
path: '/businessInfo',
|
||||
query: {
|
||||
businessId: businessId
|
||||
}
|
||||
});
|
||||
},
|
||||
highlightKeyword(text) {
|
||||
let res=text
|
||||
for(let i of this.$route.query.keyword){
|
||||
if(/\s/.test(i)) continue
|
||||
let regex = new RegExp(i, 'g')
|
||||
res=res.replace(regex, `<span style="color: #01B0F2;">${i}</span>`)
|
||||
}
|
||||
return res
|
||||
},
|
||||
toSearch() {
|
||||
if (this.keyword === '') return;
|
||||
this.$router.replace({
|
||||
path: '/searchResults',
|
||||
query: {
|
||||
keyword: this.keyword
|
||||
}
|
||||
});
|
||||
this.user = this.$getSessionStorage('user');
|
||||
|
||||
this.listBusinessAndFood();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/****************总容器***************/
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/****************header部分***************/
|
||||
.wrapper header {
|
||||
width: 100%;
|
||||
height: 12vw;
|
||||
background-color: #01B0F2;
|
||||
font-size: 4.8vw;
|
||||
color: #fff;
|
||||
|
||||
z-index: 10;
|
||||
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.wrapper header i {
|
||||
margin: 0vw 0vw 0vw 3vw;
|
||||
font-size: 6vw;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wrapper header p {
|
||||
margin: 0vw 0vw 0vw 33.5vw;
|
||||
}
|
||||
|
||||
/****************** search ******************/
|
||||
.wrapper .search {
|
||||
width: 100%;
|
||||
height: 13vw;
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
top: 12vw;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top {
|
||||
width: 100%;
|
||||
height: 13vw;
|
||||
background-color: #01B0F2;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top .search-box {
|
||||
width: 90%;
|
||||
height: 9vw;
|
||||
background-color: #fff;
|
||||
border-radius: 4vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 3.5vw;
|
||||
color: #AEAEAE;
|
||||
font-family: "宋体";
|
||||
/*此样式是让文本选中状态无效*/
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top .search-box input {
|
||||
border: none;
|
||||
outline: none;
|
||||
height: 4vw;
|
||||
font-size: 3vw;
|
||||
}
|
||||
|
||||
.wrapper .search .search-fixed-top .search-box .fa-search {
|
||||
margin-right: 1vw;
|
||||
}
|
||||
|
||||
.blue-icon {
|
||||
color: #01B0F2;
|
||||
}
|
||||
|
||||
/****************分类***************/
|
||||
.wrapper .category{
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top: 25vw;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-size: 4vw;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.wrapper .category .cur{
|
||||
display: flex;
|
||||
width: 50%;
|
||||
justify-content: center;
|
||||
background-image: linear-gradient(to bottom, #01B0F2ff, #01B0F260);
|
||||
padding: 1vw;
|
||||
}
|
||||
|
||||
.wrapper .category .other{
|
||||
display: flex;
|
||||
width: 50%;
|
||||
justify-content: center;
|
||||
background-color: #01B0F2;
|
||||
padding: 1vw;
|
||||
}
|
||||
|
||||
/****************未找到部分***************/
|
||||
.wrapper .not-found {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 35vw;
|
||||
font-size: 3.5vw;
|
||||
color: #01B0F2;
|
||||
}
|
||||
|
||||
/****************商家列表部分***************/
|
||||
.wrapper .business {
|
||||
width: 100%;
|
||||
margin-top: 30vw;
|
||||
padding-bottom: 14vw;
|
||||
}
|
||||
|
||||
.wrapper .business li {
|
||||
width: 100%;
|
||||
padding: 2vw 2vw 0vw 2vw;
|
||||
background-color: #F4F8Fb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wrapper .business li .border {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 2vw;
|
||||
user-select: none;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 2vw;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img img {
|
||||
width: 20vw;
|
||||
height: 20vw;
|
||||
border-radius: 2vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-img .business-img-quantity {
|
||||
width: 5vw;
|
||||
height: 5vw;
|
||||
background-color: red;
|
||||
color: #fff;
|
||||
font-size: 3.6vw;
|
||||
border-radius: 2.5vw;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
position: absolute;
|
||||
right: -1.5vw;
|
||||
top: -1.5vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info {
|
||||
margin-left: 3vw;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info h3 {
|
||||
font-size: 3.8vw;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.wrapper .business li .border .business-info p {
|
||||
font-size: 3vw;
|
||||
color: #888;
|
||||
margin-top: 2vw;
|
||||
}
|
||||
|
||||
/****************食品信息部分***************/
|
||||
.wrapper .food {
|
||||
width: 100%;
|
||||
margin-top: 30vw;
|
||||
padding-bottom: 14vw;
|
||||
}
|
||||
|
||||
.wrapper .food li {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 2.5vw;
|
||||
user-select: none;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-left img {
|
||||
width: 20vw;
|
||||
height: 20vw;
|
||||
border-radius: 1vw;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-left .food-left-info {
|
||||
margin-left: 3vw;
|
||||
|
||||
}
|
||||
|
||||
.wrapper .food li .food-left .food-left-info h3 {
|
||||
font-size: 3.8vw;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-left .food-left-info p {
|
||||
font-size: 3vw;
|
||||
color: #888;
|
||||
margin-top: 2vw;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-right {
|
||||
width: 16vw;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-right .fa-minus-circle {
|
||||
font-size: 5.5vw;
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-right p {
|
||||
font-size: 3.6vw;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.wrapper .food li .food-right .fa-plus-circle {
|
||||
font-size: 5.5vw;
|
||||
color: #01B0F2;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<module name="gateway_server_14000" />
|
||||
<module name="business_server_10301" />
|
||||
<module name="deliveryaddress_server_10500" />
|
||||
<module name="search_server_11600" />
|
||||
<module name="business_server_10300" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
<file url="file://$PROJECT_DIR$/orders_server_10600/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/user_server_10100/src/main/java" charset="UTF-8" />
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/search_server_11600/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -52,6 +52,11 @@ spring:
|
|||
predicates:
|
||||
- Path=/OrdersController/*/**
|
||||
|
||||
- id: searchServer
|
||||
uri: lb://search-server
|
||||
predicates:
|
||||
- Path=/SearchController/*/**
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ spring:
|
|||
predicates:
|
||||
- Path=/OrdersController/*/**
|
||||
|
||||
- id: searchServer
|
||||
uri: lb://search-server
|
||||
predicates:
|
||||
- Path=/SearchController/*/**
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
<module>orders_server_10601</module>
|
||||
<module>config_server_15000</module>
|
||||
<module>config_server_15001</module>
|
||||
<module>search_server_116000</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>springcloud_elm</artifactId>
|
||||
<groupId>com.neusoft</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>search_server_11600</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.ansj</groupId>
|
||||
<artifactId>ansj_seg</artifactId>
|
||||
<version>5.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.20</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- 热部署 gav -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.neusoft;
|
||||
|
||||
import org.ansj.domain.Result;
|
||||
import org.ansj.splitWord.analysis.ToAnalysis;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MyApplication {
|
||||
public static void main(String[] args){
|
||||
SpringApplication.run(MyApplication.class,args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.neusoft.controller;
|
||||
|
||||
import com.neusoft.po.Business;
|
||||
import com.neusoft.po.CommonResult;
|
||||
import com.neusoft.po.Food;
|
||||
import com.neusoft.service.SearchService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RefreshScope
|
||||
@RestController
|
||||
@RequestMapping("/SearchController")
|
||||
public class SearchController {
|
||||
@Autowired
|
||||
private SearchService searchService;
|
||||
|
||||
@GetMapping("/listFoodByKeyword/{keyword}")
|
||||
public CommonResult<List<Food>> listFoodByKeyword(@PathVariable("keyword") String keyword) throws Exception {
|
||||
List<Food> list= searchService.listFoodByKeyword(keyword);
|
||||
return new CommonResult<>(200,"success",list);
|
||||
}
|
||||
|
||||
@GetMapping("/listBusinessByKeyword/{keyword}")
|
||||
public CommonResult<List<Business>> listBusinessByKeyword(@PathVariable("keyword") String keyword) throws Exception {
|
||||
List<Business> list= searchService.listBusinessByKeyword(keyword);
|
||||
return new CommonResult<>(200,"success",list);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.neusoft.mapper;
|
||||
|
||||
import com.neusoft.po.Business;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BusinessMapper {
|
||||
public List<Business> listBusinessByKeyword(List<String> keywords);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.neusoft.mapper;
|
||||
|
||||
import com.neusoft.po.Food;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FoodMapper {
|
||||
public List<Food> listFoodByKeyWord(List<String> keywords);
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Business {
|
||||
private Integer businessId;
|
||||
private String businessName;
|
||||
private String businessAddress;
|
||||
private String businessExplain;
|
||||
private String businessImg;
|
||||
private Integer orderTypeId;
|
||||
private double starPrice;
|
||||
private double deliveryPrice;
|
||||
private String remarks;
|
||||
private List<Food> foodList;
|
||||
|
||||
public Integer getBusinessId() {
|
||||
return businessId;
|
||||
}
|
||||
|
||||
public void setBusinessId(Integer businessId) {
|
||||
this.businessId = businessId;
|
||||
}
|
||||
|
||||
public String getBusinessName() {
|
||||
return businessName;
|
||||
}
|
||||
|
||||
public void setBusinessName(String businessName) {
|
||||
this.businessName = businessName;
|
||||
}
|
||||
|
||||
public String getBusinessAddress() {
|
||||
return businessAddress;
|
||||
}
|
||||
|
||||
public void setBusinessAddress(String businessAddress) {
|
||||
this.businessAddress = businessAddress;
|
||||
}
|
||||
|
||||
public String getBusinessExplain() {
|
||||
return businessExplain;
|
||||
}
|
||||
|
||||
public void setBusinessExplain(String businessExplain) {
|
||||
this.businessExplain = businessExplain;
|
||||
}
|
||||
|
||||
public String getBusinessImg() {
|
||||
return businessImg;
|
||||
}
|
||||
|
||||
public void setBusinessImg(String businessImg) {
|
||||
this.businessImg = businessImg;
|
||||
}
|
||||
|
||||
public Integer getOrderTypeId() {
|
||||
return orderTypeId;
|
||||
}
|
||||
|
||||
public void setOrderTypeId(Integer orderTypeId) {
|
||||
this.orderTypeId = orderTypeId;
|
||||
}
|
||||
|
||||
public double getStarPrice() {
|
||||
return starPrice;
|
||||
}
|
||||
|
||||
public void setStarPrice(double starPrice) {
|
||||
this.starPrice = starPrice;
|
||||
}
|
||||
|
||||
public double getDeliveryPrice() {
|
||||
return deliveryPrice;
|
||||
}
|
||||
|
||||
public void setDeliveryPrice(double deliveryPrice) {
|
||||
this.deliveryPrice = deliveryPrice;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public List<Food> getFoodList() {
|
||||
return foodList;
|
||||
}
|
||||
|
||||
public void setFoodList(List<Food> foodList) {
|
||||
this.foodList = foodList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CommonResult<T> implements Serializable {
|
||||
private Integer code;
|
||||
private String message;
|
||||
private T result;
|
||||
|
||||
public CommonResult() {}
|
||||
|
||||
public CommonResult(Integer code, String message, T result) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(T result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.neusoft.po;
|
||||
|
||||
public class Food {
|
||||
private Integer foodId;
|
||||
private String foodName;
|
||||
private String foodExplain;
|
||||
private String foodImg;
|
||||
private Double foodPrice;
|
||||
private Integer businessId;
|
||||
private String remarks;
|
||||
|
||||
public Integer getFoodId() {
|
||||
return foodId;
|
||||
}
|
||||
|
||||
public void setFoodId(Integer foodId) {
|
||||
this.foodId = foodId;
|
||||
}
|
||||
|
||||
public String getFoodName() {
|
||||
return foodName;
|
||||
}
|
||||
|
||||
public void setFoodName(String foodName) {
|
||||
this.foodName = foodName;
|
||||
}
|
||||
|
||||
public String getFoodExplain() {
|
||||
return foodExplain;
|
||||
}
|
||||
|
||||
public void setFoodExplain(String foodExplain) {
|
||||
this.foodExplain = foodExplain;
|
||||
}
|
||||
|
||||
public String getFoodImg() {
|
||||
return foodImg;
|
||||
}
|
||||
|
||||
public void setFoodImg(String foodImg) {
|
||||
this.foodImg = foodImg;
|
||||
}
|
||||
|
||||
public Double getFoodPrice() {
|
||||
return foodPrice;
|
||||
}
|
||||
|
||||
public void setFoodPrice(Double foodPrice) {
|
||||
this.foodPrice = foodPrice;
|
||||
}
|
||||
|
||||
public Integer getBusinessId() {
|
||||
return businessId;
|
||||
}
|
||||
|
||||
public void setBusinessId(Integer businessId) {
|
||||
this.businessId = businessId;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.neusoft.service;
|
||||
|
||||
import com.neusoft.po.Business;
|
||||
import com.neusoft.po.Food;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SearchService {
|
||||
public List<Food> listFoodByKeyword(String query);
|
||||
|
||||
public List<Business> listBusinessByKeyword(String query);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.neusoft.service.impl;
|
||||
|
||||
import com.neusoft.mapper.BusinessMapper;
|
||||
import com.neusoft.mapper.FoodMapper;
|
||||
import com.neusoft.po.Business;
|
||||
import com.neusoft.po.Food;
|
||||
import com.neusoft.service.SearchService;
|
||||
import org.ansj.domain.Result;
|
||||
import org.ansj.domain.Term;
|
||||
import org.ansj.splitWord.analysis.ToAnalysis;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SearchServiceImpl implements SearchService {
|
||||
@Autowired
|
||||
private FoodMapper foodMapper;
|
||||
@Autowired
|
||||
private BusinessMapper businessMapper;
|
||||
|
||||
@Override
|
||||
public List<Food> listFoodByKeyword(String query) {
|
||||
Result res = ToAnalysis.parse(query);
|
||||
List<String> keywords=new ArrayList<>();
|
||||
for(Term term:res){
|
||||
keywords.add(term.getName());
|
||||
}
|
||||
return foodMapper.listFoodByKeyWord(keywords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Business> listBusinessByKeyword(String query) {
|
||||
Result res = ToAnalysis.parse(query);
|
||||
List<String> keywords=new ArrayList<>();
|
||||
for(Term term:res){
|
||||
keywords.add(term.getName());
|
||||
}
|
||||
return businessMapper.listBusinessByKeyword(keywords);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
spring:
|
||||
cloud:
|
||||
config:
|
||||
name: search_server_11600
|
||||
profile: dev
|
||||
label: master
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config-server
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true #使用ip地址向eureka server进行注册
|
||||
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
|
||||
lease-renewal-interval-in-seconds: 5
|
||||
lease-expiration-duration-in-seconds: 15
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?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.neusoft.mapper.BusinessMapper">
|
||||
<select id="listBusinessByKeyword" resultType="Business">
|
||||
select * from business
|
||||
<where>
|
||||
<foreach item="keyword" collection="list" separator="and">
|
||||
(businessName like concat('%', #{keyword}, '%') or businessAddress like concat('%', #{keyword}, '%') or
|
||||
businessExplain like concat('%', #{keyword}, '%'))
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?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.neusoft.mapper.FoodMapper">
|
||||
<select id="listFoodByKeyWord" resultType="Food">
|
||||
select * from food
|
||||
<where>
|
||||
<foreach item="keyword" index="index" collection="list" separator="and">
|
||||
(foodName like concat('%', #{keyword}, '%') or foodExplain like concat('%', #{keyword}, '%'))
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
spring:
|
||||
cloud:
|
||||
config:
|
||||
name: search_server_11600
|
||||
profile: dev
|
||||
label: master
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config-server
|
||||
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true #使用ip地址向eureka server进行注册
|
||||
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
|
||||
lease-renewal-interval-in-seconds: 5
|
||||
lease-expiration-duration-in-seconds: 15
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?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.neusoft.mapper.BusinessMapper">
|
||||
<select id="listBusinessByKeyword" resultType="Business">
|
||||
select * from business
|
||||
<where>
|
||||
<foreach item="keyword" collection="list" separator="and">
|
||||
(businessName like concat('%', #{keyword}, '%') or businessAddress like concat('%', #{keyword}, '%') or
|
||||
businessExplain like concat('%', #{keyword}, '%'))
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?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.neusoft.mapper.FoodMapper">
|
||||
<select id="listFoodByKeyWord" resultType="Food">
|
||||
select * from food
|
||||
<where>
|
||||
<foreach item="keyword" index="index" collection="list" separator="and">
|
||||
(foodName like concat('%', #{keyword}, '%') or foodExplain like concat('%', #{keyword}, '%'))
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue