Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
段启岩
beyond-clouds
Commits
dbebeccc
Commit
dbebeccc
authored
Feb 02, 2020
by
胡明森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
检索标签
parent
343cb12e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
4 deletions
+32
-4
src/main/java/cn/meteor/beyondclouds/modules/tag/api/TagApi.java
+13
-4
src/main/java/cn/meteor/beyondclouds/modules/tag/mapper/TagMapper.java
+4
-0
src/main/java/cn/meteor/beyondclouds/modules/tag/mapper/xml/TagMapper.xml
+4
-0
src/main/java/cn/meteor/beyondclouds/modules/tag/service/ITagService.java
+4
-0
src/main/java/cn/meteor/beyondclouds/modules/tag/service/impl/TagServiceImpl.java
+7
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/tag/api/TagApi.java
View file @
dbebeccc
package
cn
.
meteor
.
beyondclouds
.
modules
.
tag
.
api
;
package
cn
.
meteor
.
beyondclouds
.
modules
.
tag
.
api
;
import
cn.meteor.beyondclouds.core.api.Response
;
import
cn.meteor.beyondclouds.core.api.Response
;
import
cn.meteor.beyondclouds.modules.tag.entity.Tag
;
import
cn.meteor.beyondclouds.modules.tag.exception.TagServiceException
;
import
cn.meteor.beyondclouds.modules.tag.exception.TagServiceException
;
import
cn.meteor.beyondclouds.modules.tag.form.CreateTagForm
;
import
cn.meteor.beyondclouds.modules.tag.form.CreateTagForm
;
import
cn.meteor.beyondclouds.modules.tag.service.ITagService
;
import
cn.meteor.beyondclouds.modules.tag.service.ITagService
;
...
@@ -8,12 +9,10 @@ import io.swagger.annotations.Api;
...
@@ -8,12 +9,10 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
/**
* @author 胡明森
* @author 胡明森
...
@@ -48,4 +47,14 @@ public class TagApi {
...
@@ -48,4 +47,14 @@ public class TagApi {
}
}
}
}
@ApiOperation
(
"检索标签"
)
@GetMapping
(
"/tags/{keywords}"
)
public
Response
<
List
<
Tag
>>
searchTags
(
@PathVariable
(
"keywords"
)
String
keywords
)
{
List
<
Tag
>
tags
=
tagService
.
searchTags
(
keywords
);
return
Response
.
success
(
tags
);
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/tag/mapper/TagMapper.java
View file @
dbebeccc
...
@@ -4,6 +4,8 @@ import cn.meteor.beyondclouds.modules.tag.entity.Tag;
...
@@ -4,6 +4,8 @@ import cn.meteor.beyondclouds.modules.tag.entity.Tag;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
/**
* <p>
* <p>
* 标签表 Mapper 接口
* 标签表 Mapper 接口
...
@@ -16,4 +18,6 @@ import org.springframework.stereotype.Component;
...
@@ -16,4 +18,6 @@ import org.springframework.stereotype.Component;
public
interface
TagMapper
extends
BaseMapper
<
Tag
>
{
public
interface
TagMapper
extends
BaseMapper
<
Tag
>
{
Tag
getTags
(
String
tagName
,
Integer
tagType
);
Tag
getTags
(
String
tagName
,
Integer
tagType
);
List
<
Tag
>
searchTags
(
String
keywords
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/tag/mapper/xml/TagMapper.xml
View file @
dbebeccc
...
@@ -6,4 +6,8 @@
...
@@ -6,4 +6,8 @@
select * from tag where tag_name=#{tagName} and tag_type=#{tagType}
select * from tag where tag_name=#{tagName} and tag_type=#{tagType}
</select>
</select>
<select
id=
"searchTags"
resultType=
"cn.meteor.beyondclouds.modules.tag.entity.Tag"
>
select * from tag where tag_name like CONCAT('%',#{keywords},'%')
</select>
</mapper>
</mapper>
src/main/java/cn/meteor/beyondclouds/modules/tag/service/ITagService.java
View file @
dbebeccc
...
@@ -4,6 +4,8 @@ import cn.meteor.beyondclouds.modules.tag.entity.Tag;
...
@@ -4,6 +4,8 @@ import cn.meteor.beyondclouds.modules.tag.entity.Tag;
import
cn.meteor.beyondclouds.modules.tag.exception.TagServiceException
;
import
cn.meteor.beyondclouds.modules.tag.exception.TagServiceException
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
/**
* <p>
* <p>
* 标签表 服务类
* 标签表 服务类
...
@@ -20,4 +22,6 @@ public interface ITagService extends IService<Tag> {
...
@@ -20,4 +22,6 @@ public interface ITagService extends IService<Tag> {
* @param tagType
* @param tagType
*/
*/
void
createTag
(
String
tagName
,
Integer
tagType
)
throws
TagServiceException
;
void
createTag
(
String
tagName
,
Integer
tagType
)
throws
TagServiceException
;
List
<
Tag
>
searchTags
(
String
keywords
);
}
}
src/main/java/cn/meteor/beyondclouds/modules/tag/service/impl/TagServiceImpl.java
View file @
dbebeccc
...
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* <p>
* <p>
* 标签表 服务实现类
* 标签表 服务实现类
...
@@ -55,4 +57,9 @@ public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements ITagS
...
@@ -55,4 +57,9 @@ public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements ITagS
tag
.
setTagType
(
tagType
);
tag
.
setTagType
(
tagType
);
save
(
tag
);
save
(
tag
);
}
}
@Override
public
List
<
Tag
>
searchTags
(
String
keywords
)
{
return
tagMapper
.
searchTags
(
keywords
);
}
}
}
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