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
68cdb58f
Commit
68cdb58f
authored
Jan 27, 2022
by
liu_cheng_jiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
095a5fd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
StudentInfoService.java
...xploring/engine/server/db/service/StudentInfoService.java
+81
-0
No files found.
server-db/src/main/java/cn/exploring/engine/server/db/service/StudentInfoService.java
0 → 100644
View file @
68cdb58f
package
cn
.
exploring
.
engine
.
server
.
db
.
service
;
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
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Service
public
class
StudentInfoService
{
@Resource
StudentInfoMapper
studentInfoMapper
;
/**
* 添加
* @param studentInfo
* @return
*/
public
Object
addStudentInfo
(
StudentInfo
studentInfo
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
studentInfo
.
setAddTime
(
now
);
studentInfo
.
setUpdateTime
(
now
);
studentInfoMapper
.
insertSelective
(
studentInfo
);
return
"添加成功"
;
}
/**
* 更新数据
* @param studentInfo
* @return
*/
public
Object
updateStudentInfo
(
StudentInfo
studentInfo
)
{
studentInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
studentInfoMapper
.
updateByPrimaryKey
(
studentInfo
);
return
"修改成功"
;
}
/**
* 批量删除数据
* @param idList
* @return
*/
public
Object
batchDeleted
(
List
<
Integer
>
idList
)
{
List
<
StudentInfo
>
studentInfoList
=
selectStudentInfo
(
null
,
null
,
idList
);
studentInfoList
.
forEach
(
x
->
{
x
.
setDeleted
(
false
);
updateStudentInfo
(
x
);
});
return
"batch deleted OK"
;
}
/**
* 检索学生相关的信息
* @param studentName
* @param studentId
* @return
*/
public
List
<
StudentInfo
>
selectStudentInfo
(
String
studentName
,
String
studentId
,
List
<
Integer
>
idList
)
{
StudentInfoExample
example
=
new
StudentInfoExample
();
StudentInfoExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andDeletedEqualTo
(
false
);
if
(!
StringUtils
.
isEmpty
(
studentName
))
{
criteria
.
andNameLike
(
"%"
+
studentName
+
"%"
);
}
if
(!
StringUtils
.
isEmpty
(
studentId
))
{
criteria
.
andStudentUniqueIdEqualTo
(
studentId
);
}
if
(
idList
!=
null
&&
idList
.
size
()
>
0
)
{
criteria
.
andIdIn
(
idList
);
}
return
studentInfoMapper
.
selectByExample
(
example
);
}
}
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