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
095a5fd2
Commit
095a5fd2
authored
Jan 27, 2022
by
liu_cheng_jiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
236751cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
ClassService.java
...a/cn/exploring/engine/server/db/service/ClassService.java
+70
-0
No files found.
server-db/src/main/java/cn/exploring/engine/server/db/service/ClassService.java
View file @
095a5fd2
package
cn
.
exploring
.
engine
.
server
.
db
.
service
;
import
cn.exploring.engine.server.db.dao.ClassInfoMapper
;
import
cn.exploring.engine.server.db.domain.ClassInfo
;
import
cn.exploring.engine.server.db.domain.ClassInfoExample
;
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
ClassService
{
@Resource
ClassInfoMapper
classInfoMapper
;
public
List
<
ClassInfo
>
selectClass
(
String
className
)
{
ClassInfoExample
example
=
new
ClassInfoExample
();
ClassInfoExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andDeletedEqualTo
(
false
);
criteria
.
andClassNameEqualTo
(
className
);
return
classInfoMapper
.
selectByExample
(
example
);
}
public
List
<
ClassInfo
>
webSelectClass
(
String
className
,
List
<
Integer
>
idList
)
{
ClassInfoExample
example
=
new
ClassInfoExample
();
ClassInfoExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andDeletedEqualTo
(
false
);
if
(!
StringUtils
.
isEmpty
(
className
))
{
criteria
.
andClassNameLike
(
"%"
+
className
+
"%"
);
}
if
(
idList
!=
null
&&
idList
.
size
()
>
0
)
{
criteria
.
andIdIn
(
idList
);
}
criteria
.
andClassNameEqualTo
(
className
);
return
classInfoMapper
.
selectByExample
(
example
);
}
/**
* 添加班级信息
* @param className
* @return
*/
public
Object
addClassInfo
(
String
className
)
{
List
<
ClassInfo
>
classInfoList
=
selectClass
(
className
);
if
(
classInfoList
!=
null
&&
classInfoList
.
size
()
!=
0
)
{
return
"当前已存在该班级"
;
}
ClassInfo
classInfo
=
new
ClassInfo
();
LocalDateTime
now
=
LocalDateTime
.
now
();
classInfo
.
setAddTime
(
now
);
classInfo
.
setUpdateTime
(
now
);
classInfo
.
setDeleted
(
false
);
classInfo
.
setClassName
(
className
);
classInfoMapper
.
insertSelective
(
classInfo
);
return
"添加班级成功"
;
}
public
void
updateClassInfo
(
ClassInfo
classInfo
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
classInfo
.
setUpdateTime
(
now
);
classInfoMapper
.
updateByPrimaryKey
(
classInfo
);
}
public
Object
batchDeletedData
(
List
<
Integer
>
idList
)
{
List
<
ClassInfo
>
classInfoList
=
webSelectClass
(
null
,
idList
);
classInfoList
.
forEach
(
x
->
{
x
.
setDeleted
(
null
);
updateClassInfo
(
x
);
});
return
"batch deleted OK"
;
}
}
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