Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
push-message
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
liucheng
push-message
Commits
2997f6ca
Commit
2997f6ca
authored
Jul 12, 2022
by
renandong
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,优化sql
parent
3d77fe24
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
MenuService.java
src/main/java/com/weface/component/MenuService.java
+4
-7
UserTagDao.xml
src/main/resources/mapper/UserTagDao.xml
+8
-4
No files found.
src/main/java/com/weface/component/MenuService.java
View file @
2997f6ca
...
...
@@ -6,17 +6,14 @@ import cn.hutool.core.convert.ConvertException;
import
cn.hutool.core.lang.TypeReference
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.weface.common.utils.SnowIdUtil
;
import
com.weface.entity.MenuTagsEntity
;
import
com.weface.entity.UserMenusEntity
;
import
com.weface.entity.UserTagEntity
;
import
com.weface.service.UserMenusService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
...
...
@@ -30,8 +27,8 @@ public class MenuService {
@Autowired
private
GeTuiService
geTuiService
;
@Autowired
private
UserMenusService
userMenusService
;
/*
@Autowired
private UserMenusService userMenusService;
*/
/**
* 从map中解析标签并收集关系表数据
...
...
@@ -59,10 +56,10 @@ public class MenuService {
if
(
first
.
isPresent
())
{
//拿到id
String
uid
=
first
.
get
().
getUid
();
List
<
UserMenusEntity
>
entityList
=
userMenusService
.
list
(
new
LambdaQueryWrapper
<
UserMenusEntity
>().
eq
(
UserMenusEntity:
:
getUserId
,
uid
).
eq
(
UserMenusEntity:
:
getIsValid
,
1
));
/*
List<UserMenusEntity> entityList = userMenusService.list(new LambdaQueryWrapper<UserMenusEntity>().eq(UserMenusEntity::getUserId, uid).eq(UserMenusEntity::getIsValid, 1));
if (!CollectionUtils.isEmpty(entityList)) {
continue;
}
}
*/
//遍历标签id
Date
date
=
new
Date
();
for
(
Long
aLong
:
list
)
{
...
...
src/main/resources/mapper/UserTagDao.xml
View file @
2997f6ca
...
...
@@ -51,12 +51,16 @@
<!-- 查询id之后的用户信息-->
<select
id=
"findUserByIdAfter"
resultMap=
"userTagMap"
>
SELECT
us.*
us.id,
us.uid,
us.gid
FROM
( SELECT id, uid, gid FROM t_user_tag WHERE gid IS NOT NULL AND id > #{id} ) us
LEFT JOIN ( SELECT * FROM tb_user_menus WHERE is_valid = 1 ) um ON us.uid = um.user_id
t_user_tag us
WHERE
um.id IS NULL LIMIT #{limit}
us.id > #{id}
AND us.gid IS NOT NULL
AND us.uid NOT IN ( SELECT DISTINCT user_id FROM tb_user_menus)
LIMIT #{limit}
</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