Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
03071369
提交
03071369
authored
3月 12, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mcj:更新规则查询数据结构
上级
49f69a8f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
34 行增加
和
20 行删除
+34
-20
RuleController.java
...main/java/com/zjty/inspect/controller/RuleController.java
+3
-3
Page.java
src/main/java/com/zjty/inspect/entity/Page.java
+4
-0
RuleService.java
src/main/java/com/zjty/inspect/service/RuleService.java
+3
-4
RuleServiceImpl.java
...n/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
+24
-13
没有找到文件。
src/main/java/com/zjty/inspect/controller/RuleController.java
浏览文件 @
03071369
package
com
.
zjty
.
inspect
.
controller
;
package
com
.
zjty
.
inspect
.
controller
;
import
com.zjty.inspect.entity.Page
;
import
com.zjty.inspect.entity.PageResult
;
import
com.zjty.inspect.entity.PageResult
;
import
com.zjty.inspect.entity.Rule
;
import
com.zjty.inspect.entity.Rule
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.entity.RuleQo
;
...
@@ -9,7 +10,6 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -9,7 +10,6 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
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.data.domain.Page
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -101,7 +101,7 @@ public class RuleController {
...
@@ -101,7 +101,7 @@ public class RuleController {
})
})
@RequestMapping
(
value
=
"/search/{page}/{size}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/search/{page}/{size}"
,
method
=
RequestMethod
.
POST
)
public
ResponseEntity
findSearch
(
@RequestBody
Map
searchMap
,
@PathVariable
int
page
,
@PathVariable
int
size
){
public
ResponseEntity
findSearch
(
@RequestBody
Map
searchMap
,
@PathVariable
int
page
,
@PathVariable
int
size
){
Page
<
Rule
>
pageList
=
ruleService
.
findSearch
(
searchMap
,
page
,
size
);
Page
<
Rule
Qo
>
search
=
ruleService
.
findSearch
(
searchMap
,
page
,
size
);
return
ResponseEntity
.
ok
(
new
PageResult
<
Rule
>(
pageList
.
getTotalElements
(),
pageList
.
getContent
())
);
return
ResponseEntity
.
ok
(
search
);
}
}
}
}
src/main/java/com/zjty/inspect/entity/Page.java
浏览文件 @
03071369
...
@@ -38,4 +38,8 @@ public class Page<T> {
...
@@ -38,4 +38,8 @@ public class Page<T> {
public
List
<
T
>
getObjects
()
{
public
List
<
T
>
getObjects
()
{
return
objects
;
return
objects
;
}
}
public
void
setObjects
(
List
<
T
>
objects
)
{
this
.
objects
=
objects
;
}
}
}
src/main/java/com/zjty/inspect/service/RuleService.java
浏览文件 @
03071369
package
com
.
zjty
.
inspect
.
service
;
package
com
.
zjty
.
inspect
.
service
;
import
com.zjty.inspect.entity.
Rul
e
;
import
com.zjty.inspect.entity.
Pag
e
;
import
com.zjty.inspect.entity.RuleQo
;
import
com.zjty.inspect.entity.RuleQo
;
import
org.springframework.data.domain.Page
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -40,8 +39,8 @@ public interface RuleService {
...
@@ -40,8 +39,8 @@ public interface RuleService {
*/
*/
List
<
RuleQo
>
findAll
();
List
<
RuleQo
>
findAll
();
List
<
Rule
>
findByName
(
String
name
);
List
<
Rule
Qo
>
findByName
(
String
name
);
Page
<
Rule
>
findSearch
(
Map
searchMap
,
int
page
,
int
size
);
Page
<
Rule
Qo
>
findSearch
(
Map
searchMap
,
int
page
,
int
size
);
void
test
();
void
test
();
}
}
src/main/java/com/zjty/inspect/service/impl/RuleServiceImpl.java
浏览文件 @
03071369
...
@@ -97,10 +97,17 @@ public class RuleServiceImpl implements RuleService {
...
@@ -97,10 +97,17 @@ public class RuleServiceImpl implements RuleService {
* @return
* @return
*/
*/
@Override
@Override
public
Page
<
Rule
>
findSearch
(
Map
whereMap
,
int
page
,
int
size
)
{
public
com
.
zjty
.
inspect
.
entity
.
Page
<
RuleQo
>
findSearch
(
Map
whereMap
,
int
page
,
int
size
)
{
Specification
<
Rule
>
specification
=
createSpecification
(
whereMap
);
Specification
<
Rule
>
specification
=
createSpecification
(
whereMap
);
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
);
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
);
return
ruleDao
.
findAll
(
specification
,
pageRequest
);
Page
<
Rule
>
all
=
ruleDao
.
findAll
(
specification
,
pageRequest
);
List
<
RuleQo
>
ruleQos
=
data2RuleQo
(
all
.
getContent
());
com
.
zjty
.
inspect
.
entity
.
Page
<
RuleQo
>
myPage
=
new
com
.
zjty
.
inspect
.
entity
.
Page
<>();
myPage
.
setTotalPage
(
all
.
getTotalPages
());
myPage
.
setTotalElement
((
int
)
all
.
getTotalElements
());
myPage
.
setObjects
(
ruleQos
);
return
myPage
;
}
}
/**
/**
...
@@ -161,9 +168,22 @@ public class RuleServiceImpl implements RuleService {
...
@@ -161,9 +168,22 @@ public class RuleServiceImpl implements RuleService {
*/
*/
@Override
@Override
public
List
<
RuleQo
>
findAll
()
{
public
List
<
RuleQo
>
findAll
()
{
HashMap
<
String
,
RuleQo
>
hashMap
=
new
HashMap
<>();
ArrayList
<
Rule
>
list
=
new
ArrayList
<>();
List
<
Rule
>
rules
=
ruleDao
.
findAll
();
List
<
Rule
>
rules
=
ruleDao
.
findAll
();
List
<
RuleQo
>
ruleQos
=
data2RuleQo
(
rules
);
return
ruleQos
;
}
@Override
public
List
<
RuleQo
>
findByName
(
String
name
)
{
List
<
Rule
>
rules
=
ruleDao
.
findAllByTargetLike
(
"%"
+
name
+
"%"
);
if
(
rules
!=
null
&&
rules
.
size
()
>
0
)
{
return
data2RuleQo
(
rules
);
}
return
null
;
}
private
List
<
RuleQo
>
data2RuleQo
(
List
<
Rule
>
rules
){
HashMap
<
String
,
RuleQo
>
hashMap
=
new
HashMap
<>();
for
(
Rule
rule
:
rules
)
{
for
(
Rule
rule
:
rules
)
{
if
(!
hashMap
.
containsKey
(
rule
.
getTarget
()+
rule
.
getTechnologyId
())){
if
(!
hashMap
.
containsKey
(
rule
.
getTarget
()+
rule
.
getTechnologyId
())){
RuleQo
ruleQo
=
new
RuleQo
();
RuleQo
ruleQo
=
new
RuleQo
();
...
@@ -187,13 +207,4 @@ public class RuleServiceImpl implements RuleService {
...
@@ -187,13 +207,4 @@ public class RuleServiceImpl implements RuleService {
}
}
return
new
ArrayList
<>(
hashMap
.
values
());
return
new
ArrayList
<>(
hashMap
.
values
());
}
}
@Override
public
List
<
Rule
>
findByName
(
String
name
)
{
List
<
Rule
>
rules
=
ruleDao
.
findAllByTargetLike
(
"%"
+
name
+
"%"
);
if
(
rules
!=
null
&&
rules
.
size
()
>
0
)
{
return
rules
;
}
return
null
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论