Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
ba9f93dd
Commit
ba9f93dd
authored
Aug 21, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3ff97718
97b63558
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
228 additions
and
40 deletions
+228
-40
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
...ao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
+6
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
+9
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
.../main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
+4
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+23
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+147
-31
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
...ain/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
+1
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
...src/main/java/com/wwdz/ch/wx/service/CategoryService.java
+28
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
...rc/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
+6
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
View file @
ba9f93dd
...
@@ -15,6 +15,8 @@ public interface CategoryDao {
...
@@ -15,6 +15,8 @@ public interface CategoryDao {
Category
findByName
(
String
name
);
Category
findByName
(
String
name
);
List
<
Category
>
queryByName
(
String
name
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
int
updateById
(
Category
category
);
int
updateById
(
Category
category
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
View file @
ba9f93dd
...
@@ -13,6 +13,8 @@ public interface ItemDao {
...
@@ -13,6 +13,8 @@ public interface ItemDao {
List
<
Item
>
findList
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findList
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
PageInfo
<
Item
>
findByPage
(
CoinRequestDto
coinRequestDto
);
PageInfo
<
Item
>
findByPage
(
CoinRequestDto
coinRequestDto
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
View file @
ba9f93dd
...
@@ -58,6 +58,12 @@ public class CategoryDaoImpl implements CategoryDao {
...
@@ -58,6 +58,12 @@ public class CategoryDaoImpl implements CategoryDao {
return
categoryMapper
.
selectOneByExample
(
example
);
return
categoryMapper
.
selectOneByExample
(
example
);
}
}
public
List
<
Category
>
queryByName
(
String
name
)
{
CategoryExample
example
=
new
CategoryExample
();
example
.
or
().
andNameLike
(
"%"
+
name
+
"%"
).
andIsDeletedEqualTo
(
false
);
return
categoryMapper
.
selectByExample
(
example
);
}
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
String
order
)
{
CategoryExample
example
=
new
CategoryExample
();
CategoryExample
example
=
new
CategoryExample
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/ItemDaoImpl.java
View file @
ba9f93dd
...
@@ -52,6 +52,15 @@ public class ItemDaoImpl implements ItemDao {
...
@@ -52,6 +52,15 @@ public class ItemDaoImpl implements ItemDao {
return
itemMapper
.
selectByExample
(
example
);
return
itemMapper
.
selectByExample
(
example
);
}
}
@Override
public
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
)
{
ItemExample
example
=
new
ItemExample
();
ItemExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
coinRequestDto
.
getIds
(),
criteria:
:
andIdIn
);
criteria
.
andIsDeletedEqualTo
(
false
);
return
itemMapper
.
selectByExampleWithBLOBs
(
example
);
}
@Override
@Override
public
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
)
{
public
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
)
{
ItemExample
example
=
new
ItemExample
();
ItemExample
example
=
new
ItemExample
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/config/WebMvcConfiguration.java
View file @
ba9f93dd
...
@@ -29,7 +29,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
...
@@ -29,7 +29,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
loginInterceptor
())
registry
.
addInterceptor
(
loginInterceptor
())
.
addPathPatterns
(
"/**"
)
.
addPathPatterns
(
"/**"
)
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByWx"
.
excludePathPatterns
(
"/*.html"
,
"/**/*.html"
,
"/**/*.css"
,
"/**/*.js"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/favorites/info"
,
"/wx/favorites/itemList"
);
,
"/wx/user/loginByWx"
,
"/wx/user/loginByMobile"
,
"/wx/user/loginRegCaptcha"
,
"/wx/user/updateRegCaptcha"
,
"/wx/item/page"
,
"/wx/item/info"
,
"/wx/item/findNames"
,
"/wx/item/recommend"
,
"/wx/favorites/info"
,
"/wx/favorites/itemList"
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
ba9f93dd
...
@@ -63,7 +63,7 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -63,7 +63,7 @@ public class CategoryServiceImpl implements CategoryService {
i
--;
i
--;
}
}
List
<
CategoryResponseVo
>
responseVoList
=
categoryList
.
stream
()
List
<
CategoryResponseVo
>
responseVoList
=
categoryList
.
stream
()
.
map
(
this
::
toCatego
tyResong
seVo
).
collect
(
Collectors
.
toList
());
.
map
(
this
::
toCatego
ryRespon
seVo
).
collect
(
Collectors
.
toList
());
for
(
CategoryResponseVo
vo
:
responseVoList
)
{
for
(
CategoryResponseVo
vo
:
responseVoList
)
{
if
(
vo
.
getCid
().
equals
(
category
.
getId
()))
{
if
(
vo
.
getCid
().
equals
(
category
.
getId
()))
{
vo
.
setIsChosen
(
1
);
vo
.
setIsChosen
(
1
);
...
@@ -71,10 +71,30 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -71,10 +71,30 @@ public class CategoryServiceImpl implements CategoryService {
}
}
return
Result
.
success
(
convertVoList
(
responseVoList
));
return
Result
.
success
(
convertVoList
(
responseVoList
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
null
;
logger
.
error
(
"搜索分类失败"
,
e
);
return
Result
.
failed
(
"搜索分类失败"
);
}
}
}
}
@Override
public
Result
findNames
(
CategoryRequestDto
dto
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getName
()))
{
return
Result
.
success
(
new
ArrayList
<>());
}
try
{
return
Result
.
success
(
categoryDao
.
queryByName
(
dto
.
getName
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"搜索分类失败"
,
e
);
return
Result
.
failed
(
"搜索分类失败"
);
}
}
/**
* 分类列表树形转换
*
* @param voList
* @return
*/
public
List
<
CategoryResponseVo
>
convertVoList
(
List
<
CategoryResponseVo
>
voList
)
{
public
List
<
CategoryResponseVo
>
convertVoList
(
List
<
CategoryResponseVo
>
voList
)
{
Map
<
Integer
,
CategoryResponseVo
>
menuMap
=
new
HashMap
<>();
Map
<
Integer
,
CategoryResponseVo
>
menuMap
=
new
HashMap
<>();
CategoryResponseVo
root
=
new
CategoryResponseVo
();
CategoryResponseVo
root
=
new
CategoryResponseVo
();
...
@@ -102,7 +122,7 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -102,7 +122,7 @@ public class CategoryServiceImpl implements CategoryService {
return
root
.
getChild
();
return
root
.
getChild
();
}
}
private
CategoryResponseVo
toCatego
tyResong
seVo
(
Category
category
)
{
private
CategoryResponseVo
toCatego
ryRespon
seVo
(
Category
category
)
{
CategoryResponseVo
vo
=
new
CategoryResponseVo
();
CategoryResponseVo
vo
=
new
CategoryResponseVo
();
vo
.
setCid
(
category
.
getId
());
vo
.
setCid
(
category
.
getId
());
vo
.
setPid
(
category
.
getPid
());
vo
.
setPid
(
category
.
getPid
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
ba9f93dd
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/interceptor/LoginInterceptor.java
View file @
ba9f93dd
package
com.wwdz.ch.wx.interceptor
;
package
com.wwdz.ch.wx.interceptor
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.wx.
service
.UserTokenManager
;
import
com.wwdz.ch.wx.
manager
.UserTokenManager
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -27,10 +27,7 @@ public class LoginInterceptor implements HandlerInterceptor {
...
@@ -27,10 +27,7 @@ public class LoginInterceptor implements HandlerInterceptor {
*/
*/
@Override
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
logger
.
info
(
"-------------进入拦截器"
);
logger
.
info
(
"请求头名称:"
+
JSON
.
toJSONString
(
request
.
getHeaderNames
()));
String
token
=
request
.
getHeader
(
"Authorization"
);
String
token
=
request
.
getHeader
(
"Authorization"
);
logger
.
info
(
"token的值是:"
+
token
);
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
StringUtils
.
isNotBlank
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
if
(
userTokenManager
.
checkLogin
(
token
))
{
return
true
;
return
true
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
View file @
ba9f93dd
...
@@ -4,7 +4,35 @@ import com.wwdz.ch.core.type.Result;
...
@@ -4,7 +4,35 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.wx.entity.request.CategoryRequestDto
;
import
com.wwdz.ch.wx.entity.request.CategoryRequestDto
;
public
interface
CategoryService
{
public
interface
CategoryService
{
/**
* 按level分页查询
*
* @param dto
* @return
*/
Result
top
(
CategoryRequestDto
dto
);
Result
top
(
CategoryRequestDto
dto
);
/**
* 子分类列表查询
*
* @param dto
* @return
*/
Result
child
(
CategoryRequestDto
dto
);
Result
child
(
CategoryRequestDto
dto
);
/**
* 按名称搜索精确匹配返回分类的树形列表
*
* @param dto
* @return
*/
Result
find
(
CategoryRequestDto
dto
);
Result
find
(
CategoryRequestDto
dto
);
/**
* 按名称搜索模糊匹配返回分类列表
*
* @param dto
* @return
*/
Result
findNames
(
CategoryRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
View file @
ba9f93dd
...
@@ -68,4 +68,10 @@ public class WxCategoryController {
...
@@ -68,4 +68,10 @@ public class WxCategoryController {
public
Result
find
(
@RequestBody
CategoryRequestDto
dto
)
{
public
Result
find
(
@RequestBody
CategoryRequestDto
dto
)
{
return
categoryService
.
find
(
dto
);
return
categoryService
.
find
(
dto
);
}
}
@ApiOperation
(
value
=
"名称模糊联想"
)
@PostMapping
(
value
=
"/findNames"
)
public
Result
findNames
(
@RequestBody
CategoryRequestDto
dto
)
{
return
categoryService
.
findNames
(
dto
);
}
}
}
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