Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
65642149
Commit
65642149
authored
Jul 13, 2021
by
wenyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标签使用场景查询增加条件
parent
73b329a4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
23 deletions
+123
-23
yd-api/src/main/java/com/yd/api/metadata/service/impl/MetadataServiceImpl.java
+55
-16
yd-api/src/main/java/com/yd/api/metadata/vo/TagViewQueryRequestVO.java
+48
-2
yd-api/src/main/java/com/yd/dal/mapper/meta/MdTagViewMapper.java
+3
-1
yd-api/src/main/java/com/yd/dal/service/meta/MdTagViewDALService.java
+1
-1
yd-api/src/main/java/com/yd/dal/service/meta/impl/MdTagViewDALServiceImpl.java
+2
-2
yd-api/src/main/resources/mapper/meta/MdTagViewMapper.xml
+14
-1
No files found.
yd-api/src/main/java/com/yd/api/metadata/service/impl/MetadataServiceImpl.java
View file @
65642149
...
...
@@ -188,22 +188,61 @@ public class MetadataServiceImpl implements MetadataService {
responseVO
.
setCommonResult
(
commonResult
);
return
responseVO
;
}
Long
isActive
=
null
,
upperTagViewId
=
null
;
String
taglevel
=
null
,
tagName
=
null
,
tagViewType
=
null
;
if
(
requestVO
.
getIsActive
()
!=
null
){
isActive
=
requestVO
.
getIsActive
().
longValue
();
}
if
(
requestVO
.
getTaglevel
()
!=
null
){
taglevel
=
requestVO
.
getTaglevel
();
}
if
(
requestVO
.
getUpperTagViewId
()
!=
null
){
upperTagViewId
=
requestVO
.
getUpperTagViewId
();
}
if
(
requestVO
.
getTagViewType
()
!=
null
){
tagViewType
=
requestVO
.
getTagViewType
();
}
if
(!
CommonUtil
.
isNullOrBlank
(
requestVO
.
getTagName
())){
if
(
requestVO
.
getTaglevel
()
==
null
){
commonResult
.
setSuccess
(
false
);
commonResult
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"830036"
));
responseVO
.
setCommonResult
(
commonResult
);
return
responseVO
;
}
tagName
=
requestVO
.
getTagName
()+
"%"
;
}
PageHelper
.
clearPage
();
//偶然遇到了这个问题,同一个查询结果一会是10个(预期),一会是真实个数(刷新/重启应用就又变成真实个数) 查看日志,发现了问题:结果为10个时查询SQL自动加上了Limit 10
List
<
MdTagView
>
mdTagViewList
=
mdTagViewDALService
.
selectByIsActive
(
requestVO
.
getIsActive
().
longValue
());
if
(!
CommonUtil
.
isNullOrBlank
(
requestVO
.
getTagViewType
())){
BeanPropertyValueEqualsPredicate
predicateClause
=
new
BeanPropertyValueEqualsPredicate
(
"tagViewType"
,
requestVO
.
getTagViewType
());
mdTagViewList
=
(
List
<
MdTagView
>)
CollectionUtils
.
select
(
mdTagViewList
,
predicateClause
);
List
<
MdTagView
>
mdTagViewList
=
mdTagViewDALService
.
selectByIsActive
(
isActive
,
upperTagViewId
,
taglevel
,
tagViewType
,
tagName
);
if
(
taglevel
==
null
){
if
((
requestVO
.
getUpperTagViewId
()
!=
null
||
!
CommonUtil
.
isNullOrBlank
(
requestVO
.
getTagName
()))){
if
(
mdTagViewList
!=
null
&&
mdTagViewList
.
size
()
>
0
&&
mdTagViewList
.
get
(
0
)
!=
null
)
taglevel
=
((
MdTagView
)
mdTagViewList
.
get
(
0
)).
getTagLevel
();
}
else
{
taglevel
=
"1"
;
}
}
List
<
TagViewQueryInfo
>
tagViewQueryInfos
=
new
ArrayList
<>(
16
);
List
<
MdTagView
>
mdTagViewAddList
=
new
ArrayList
<>(
16
);
BeanPropertyValueEqualsPredicate
predicateClause
=
new
BeanPropertyValueEqualsPredicate
(
"tagLevel"
,
"1"
);
List
<
MdTagView
>
objectListSelect
=
(
List
<
MdTagView
>)
CollectionUtils
.
select
(
mdTagViewList
,
predicateClause
);
mdTagViewAddList
.
addAll
(
objectListSelect
);
classificationBuildUpMdTagView
(
mdTagViewList
,
mdTagViewAddList
,
objectListSelect
,
tagViewQueryInfos
);
if
(
isActive
==
null
||
isActive
==
1L
||
(
taglevel
!=
null
||
upperTagViewId
!=
null
||
!
CommonUtil
.
isNullOrBlank
(
requestVO
.
getTagName
()))){
List
<
MdTagView
>
mdTagViewAddList
=
new
ArrayList
<>(
16
);
BeanPropertyValueEqualsPredicate
predicateClause
=
new
BeanPropertyValueEqualsPredicate
(
"tagLevel"
,
taglevel
);
List
<
MdTagView
>
objectListSelect
=
(
List
<
MdTagView
>)
CollectionUtils
.
select
(
mdTagViewList
,
predicateClause
);
mdTagViewAddList
.
addAll
(
objectListSelect
);
classificationBuildUpMdTagView
(
mdTagViewList
,
mdTagViewAddList
,
objectListSelect
,
tagViewQueryInfos
);
mdTagViewList
.
removeAll
(
mdTagViewAddList
);
mdTagViewList
.
removeAll
(
mdTagViewAddList
);
}
else
{
for
(
MdTagView
mdTagView
:
mdTagViewList
)
{
TagViewQueryInfo
tagViewQueryInfo
=
new
TagViewQueryInfo
();
BeanUtils
.
copyProperties
(
mdTagView
,
tagViewQueryInfo
);
tagViewQueryInfo
.
setCreatedAt
(
CommonUtil
.
dateParseString
(
mdTagView
.
getCreatedAt
(),
"yyyy-MM-dd HH:mm:ss"
));
tagViewQueryInfo
.
setUpdatedAt
(
CommonUtil
.
dateParseString
(
mdTagView
.
getUpdatedAt
(),
"yyyy-MM-dd HH:mm:ss"
));
tagViewQueryInfos
.
add
(
tagViewQueryInfo
);
}
}
responseVO
.
setTagViewQueryInfos
(
tagViewQueryInfos
);
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
...
...
@@ -238,11 +277,11 @@ public class MetadataServiceImpl implements MetadataService {
private
void
tagViewQueryCheck
(
TagViewQueryRequestVO
requestVO
,
CommonResult
commonResult
)
{
if
(
CommonUtil
.
isNullOrZero
(
requestVO
.
getIsActive
())){
commonResult
.
setSuccess
(
false
);
commonResult
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"830031"
));
return
;
}
//
if (CommonUtil.isNullOrZero(requestVO.getIsActive())){
//
commonResult.setSuccess(false);
//
commonResult.setMessage(ZHBErrorConfig.getErrorInfo("830031"));
//
return;
//
}
commonResult
.
setSuccess
(
true
);
commonResult
.
setMessage
(
ZHBErrorConfig
.
getErrorInfo
(
"800000"
));
}
...
...
yd-api/src/main/java/com/yd/api/metadata/vo/TagViewQueryRequestVO.java
View file @
65642149
...
...
@@ -6,6 +6,9 @@ package com.yd.api.metadata.vo;
*/
public
class
TagViewQueryRequestVO
{
private
String
tagViewType
;
//标签显示类别(1=12宫格; 2=左侧热榜列表; 3=右上角筛选)
private
String
taglevel
;
//标签级别(1=一级; 2=二级; 3=三级)
private
Long
upperTagViewId
;
//上级标签
private
String
tagName
;
//标签名称
private
Integer
isActive
;
// 1=active 2=inactive
/**
...
...
@@ -22,6 +25,47 @@ public class TagViewQueryRequestVO {
this
.
tagViewType
=
tagViewType
;
}
/**
* @return the taglevel
*/
public
String
getTaglevel
()
{
return
taglevel
;
}
/**
* @param taglevel the taglevel to set
*/
public
void
setTaglevel
(
String
taglevel
)
{
this
.
taglevel
=
taglevel
;
}
/**
* @return the upperTagViewId
*/
public
Long
getUpperTagViewId
()
{
return
upperTagViewId
;
}
/**
* @param upperTagViewId the upperTagViewId to set
*/
public
void
setUpperTagViewId
(
Long
upperTagViewId
)
{
this
.
upperTagViewId
=
upperTagViewId
;
}
/**
* @return the tagName
*/
public
String
getTagName
()
{
return
tagName
;
}
/**
* @param tagName the tagName to set
*/
public
void
setTagName
(
String
tagName
)
{
this
.
tagName
=
tagName
;
}
/**
* @return the isActive
...
...
@@ -36,12 +80,14 @@ public class TagViewQueryRequestVO {
public
void
setIsActive
(
Integer
isActive
)
{
this
.
isActive
=
isActive
;
}
@Override
public
String
toString
()
{
return
"MdTagView{"
+
", tagViewType='"
+
tagViewType
+
'\''
+
", taglevel='"
+
taglevel
+
'\''
+
", upperTagViewId='"
+
upperTagViewId
+
'\''
+
", tagName='"
+
tagName
+
'\''
+
", isActive="
+
isActive
+
'}'
;
}
...
...
yd-api/src/main/java/com/yd/dal/mapper/meta/MdTagViewMapper.java
View file @
65642149
...
...
@@ -28,5 +28,6 @@ public interface MdTagViewMapper {
int
batchInsert
(
@Param
(
"list"
)
List
<
MdTagView
>
list
);
List
<
MdTagView
>
selectByIsActive
(
@Param
(
"isActive"
)
Long
isActive
);
List
<
MdTagView
>
selectByIsActive
(
@Param
(
"isActive"
)
Long
isActive
,
@Param
(
"upperTagViewId"
)
Long
upperTagViewId
,
@Param
(
"taglevel"
)
String
taglevel
,
@Param
(
"tagViewType"
)
String
tagViewType
,
@Param
(
"tagName"
)
String
tagName
);
}
\ No newline at end of file
yd-api/src/main/java/com/yd/dal/service/meta/MdTagViewDALService.java
View file @
65642149
...
...
@@ -9,7 +9,7 @@ import com.yd.dal.entity.meta.MdTagView;
*/
public
interface
MdTagViewDALService
{
List
<
MdTagView
>
selectByIsActive
(
Long
isActive
);
List
<
MdTagView
>
selectByIsActive
(
Long
isActive
,
Long
upperTagViewId
,
String
taglevel
,
String
tagViewType
,
String
tagName
);
void
insert
(
MdTagView
mdTagView
);
...
...
yd-api/src/main/java/com/yd/dal/service/meta/impl/MdTagViewDALServiceImpl.java
View file @
65642149
...
...
@@ -20,8 +20,8 @@ public class MdTagViewDALServiceImpl implements MdTagViewDALService {
public
MdTagViewMapper
mapper
;
@Override
public
List
<
MdTagView
>
selectByIsActive
(
Long
isActive
)
{
return
mapper
.
selectByIsActive
(
isActive
);
public
List
<
MdTagView
>
selectByIsActive
(
Long
isActive
,
Long
upperTagViewId
,
String
taglevel
,
String
tagViewType
,
String
tagName
)
{
return
mapper
.
selectByIsActive
(
isActive
,
upperTagViewId
,
taglevel
,
tagViewType
,
tagName
);
}
@Override
...
...
yd-api/src/main/resources/mapper/meta/MdTagViewMapper.xml
View file @
65642149
...
...
@@ -396,8 +396,21 @@
<include
refid=
"Base_Column_List"
/>
from ag_md_tag_view
<where>
1 = 1
<if
test=
"isActive != null"
>
is_active = #{isActive,jdbcType=BIGINT}
and is_active = #{isActive,jdbcType=BIGINT}
</if>
<if
test=
"upperTagViewId != null"
>
and upper_tag_view_id = #{upperTagViewId,jdbcType=BIGINT}
</if>
<if
test=
"taglevel != null"
>
and tag_level = #{taglevel,jdbcType=VARCHAR}
</if>
<if
test=
"tagViewType != null"
>
and tag_view_type = #{tagViewType,jdbcType=VARCHAR}
</if>
<if
test=
"tagName != null"
>
and tag_name like #{tagName,jdbcType=VARCHAR}
</if>
</where>
</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