Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
engine-class-work
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
liuchengjiu
engine-class-work
Commits
a556a2b1
Commit
a556a2b1
authored
Feb 10, 2022
by
Mindfaker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
244590fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
ClassService.java
...a/cn/exploring/engine/server/db/service/ClassService.java
+15
-0
StudentInfoService.java
...xploring/engine/server/db/service/StudentInfoService.java
+12
-1
StudentController.java
.../cn/exploring/engine/server/wx/web/StudentController.java
+1
-1
No files found.
server-db/src/main/java/cn/exploring/engine/server/db/service/ClassService.java
View file @
a556a2b1
...
...
@@ -20,6 +20,21 @@ public class ClassService {
@Resource
ClassInfoMapper
classInfoMapper
;
public
Map
<
Integer
,
String
>
getClassNameMap
()
{
ClassInfoExample
example
=
new
ClassInfoExample
();
ClassInfoExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andDeletedEqualTo
(
false
);
List
<
ClassInfo
>
dataList
=
classInfoMapper
.
selectByExample
(
example
);
return
dataList
.
stream
().
map
(
x
->
{
Map
oneData
=
new
HashMap
();
oneData
.
put
(
x
.
getId
(),
x
.
getClassName
());
return
oneData
;
}).
reduce
(
new
HashMap
(),
(
x
,
y
)
->
{
x
.
putAll
(
y
);
return
x
;
});
}
public
List
<
ClassInfo
>
selectClass
(
String
className
,
List
<
Integer
>
idList
)
{
ClassInfoExample
example
=
new
ClassInfoExample
();
ClassInfoExample
.
Criteria
criteria
=
example
.
createCriteria
();
...
...
server-db/src/main/java/cn/exploring/engine/server/db/service/StudentInfoService.java
View file @
a556a2b1
...
...
@@ -4,6 +4,7 @@ import cn.exploring.engine.server.db.dao.SpecialSqlMapper;
import
cn.exploring.engine.server.db.dao.StudentInfoMapper
;
import
cn.exploring.engine.server.db.domain.StudentInfo
;
import
cn.exploring.engine.server.db.domain.StudentInfoExample
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,6 +15,7 @@ import java.time.LocalDateTime;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
public
class
StudentInfoService
{
...
...
@@ -21,6 +23,9 @@ public class StudentInfoService {
@Resource
StudentInfoMapper
studentInfoMapper
;
@Resource
ClassService
classService
;
@Resource
SpecialSqlMapper
specialSqlMapper
;
...
...
@@ -120,10 +125,16 @@ public class StudentInfoService {
PageHelper
.
startPage
(
page
,
limit
);
example
.
setOrderByClause
(
sort
+
" "
+
order
);
List
<
StudentInfo
>
studentInfoList
=
studentInfoMapper
.
selectByExample
(
example
);
Map
<
Integer
,
String
>
classMap
=
classService
.
getClassNameMap
();
List
<
Map
>
dataList
=
studentInfoList
.
stream
().
map
(
x
->
{
Map
oneData
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
x
),
Map
.
class
);
oneData
.
put
(
"className"
,
classMap
.
get
(
classId
));
return
oneData
;
}).
collect
(
Collectors
.
toList
());
Long
total
=
PageInfo
.
of
(
studentInfoList
).
getTotal
();
return
new
HashMap
(){{
put
(
"total"
,
total
);
put
(
"items"
,
studentInfo
List
);
put
(
"items"
,
data
List
);
}};
}
...
...
server-wx-api/src/main/java/cn/exploring/engine/server/wx/web/StudentController.java
View file @
a556a2b1
...
...
@@ -30,7 +30,7 @@ public class StudentController {
return
ResponseUtil
.
ok
(
studentInfoService
.
selectStudentInfo
(
classId
));
}
@
Ge
tMapping
(
"add"
)
@
Pos
tMapping
(
"add"
)
public
Object
add
(
@RequestBody
StudentInfo
studentInfo
)
{
String
status
=
studentInfoService
.
addStudentInfo
(
studentInfo
);
return
status
.
contains
(
"OK"
)
?
ResponseUtil
.
ok
(
status
)
:
ResponseUtil
.
fail
(
502
,
status
);
...
...
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