Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
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
liqin
chnmuseum-party
Commits
ba85d253
Commit
ba85d253
authored
4 years ago
by
liqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
7ee932c9
master
1.0
dev
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
55 deletions
+25
-55
LearningProject.java
...a/cn/wisenergy/chnmuseum/party/model/LearningProject.java
+9
-8
LearningProjectController.java
...useum/party/web/controller/LearningProjectController.java
+16
-47
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/model/LearningProject.java
View file @
ba85d253
...
...
@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
/**
* <p>
*
*
* </p>
*
* @author Danny Lee
...
...
@@ -40,22 +40,23 @@ public class LearningProject implements Serializable {
@ApiModelProperty
(
"学习项目名称"
)
@TableField
(
"name"
)
@NotBlank
(
message
=
"学习项目名称不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
private
String
name
;
@NotBlank
(
message
=
"学习项目名称不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
private
String
name
;
@ApiModelProperty
(
"备注"
)
@TableField
(
"remarks"
)
private
String
remarks
;
@ApiModelProperty
(
"创建日期"
)
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createTime
;
@ApiModelProperty
(
"更新日期"
)
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
LocalDateTime
updateTime
;
@ApiModelProperty
(
"相关学习内容"
)
@TableField
(
exist
=
false
)
private
String
learningContentNames
;
}
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/LearningProjectController.java
View file @
ba85d253
package
cn
.
wisenergy
.
chnmuseum
.
party
.
web
.
controller
;
import
cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Add
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Update
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.model.LearningContent
;
import
cn.wisenergy.chnmuseum.party.model.LearningProject
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentService
;
import
cn.wisenergy.chnmuseum.party.service.LearningProjectService
;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.
conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.
toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -21,9 +22,9 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* <pre>
...
...
@@ -41,21 +42,8 @@ public class LearningProjectController extends BaseController {
@Resource
private
LearningProjectService
learningProjectService
;
@PostMapping
(
"/batchSave"
)
@RequiresPermissions
(
"learning:project:batch:save"
)
@ApiOperation
(
value
=
"批量添加"
,
notes
=
"批量添加"
)
public
Map
<
String
,
Object
>
batchSaveLearningProject
(
@Validated
(
value
=
{
Add
.
class
})
List
<
LearningProject
>
learningProjectList
)
{
// 保存业务节点信息
boolean
result
=
learningProjectService
.
saveBatch
(
learningProjectList
);
// 返回操作结果
if
(
result
)
{
return
getSuccessResult
();
}
else
{
// 保存失败
return
getFailResult
();
}
}
@Resource
private
LearningContentService
learningContentService
;
@PostMapping
(
"/save"
)
@RequiresPermissions
(
"learning:project:save"
)
...
...
@@ -83,45 +71,20 @@ public class LearningProjectController extends BaseController {
return
getFailResult
();
}
@PutMapping
(
"/updateAuditStatus/{id}"
)
@RequiresPermissions
(
"learning:project:update:audit:status"
)
@ApiOperation
(
value
=
"更新审核状态"
,
notes
=
"更新审核状态"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Map
<
String
,
Object
>
updateStatus
(
@NotNull
(
message
=
"ID不能为空"
)
@PathVariable
(
"id"
)
String
id
,
@RequestParam
(
"status"
)
AuditStatusEnum
status
)
{
UpdateWrapper
<
LearningProject
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
eq
(
"id"
,
id
);
updateWrapper
.
eq
(
"audit_status"
,
status
.
name
());
boolean
flag
=
learningProjectService
.
update
(
updateWrapper
);
if
(
flag
)
{
return
getSuccessResult
();
}
return
getFailResult
();
}
@DeleteMapping
(
"/delete/{id}"
)
@RequiresPermissions
(
"learning:project:delete"
)
@ApiOperation
(
value
=
"根据ID
删除"
,
notes
=
"根据ID删除
"
)
@ApiOperation
(
value
=
"根据ID
下架学习项目"
,
notes
=
"根据ID下架学习项目
"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
paramType
=
"path"
,
dataType
=
"String"
)
})
public
Map
<
String
,
Object
>
deleteLearningProject
(
@PathVariable
(
"id"
)
String
id
)
{
boolean
result
=
learningProjectService
.
removeById
(
id
);
if
(
result
)
{
return
getSuccessResult
();
}
return
getFailResult
();
return
getSuccessResult
();
}
@GetMapping
(
"/getList"
)
@RequiresPermissions
(
"learning:project:list"
)
@ApiOperation
(
value
=
"获取全部列表(无分页)"
,
notes
=
"获取全部列表(无分页)"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"auditStatus"
,
value
=
"审核状态"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Map
<
String
,
Object
>
getLearningProjectList
(
@RequestParam
(
value
=
"auditStatus"
,
defaultValue
=
"APPROVED_FINAL"
,
required
=
false
)
AuditStatusEnum
auditStatus
)
{
public
Map
<
String
,
Object
>
getLearningProjectList
()
{
List
<
LearningProject
>
learningProjectList
=
learningProjectService
.
list
();
return
getResult
(
learningProjectList
);
}
...
...
@@ -158,7 +121,13 @@ public class LearningProjectController extends BaseController {
LearningProject:
:
getUpdateTime
);
Page
<
LearningProject
>
page
=
this
.
learningProjectService
.
page
(
getPage
(),
queryWrapper
);
for
(
LearningProject
learningProject
:
page
.
getRecords
())
{
LambdaQueryWrapper
<
LearningContent
>
lambdaQueryWrapper
=
Wrappers
.<
LearningContent
>
lambdaQuery
()
.
eq
(
LearningContent:
:
getLearningProjectId
,
learningProject
.
getId
())
.
eq
(
LearningContent:
:
getIsPublished
,
true
);
lambdaQueryWrapper
.
select
(
LearningContent:
:
getName
);
List
<
LearningContent
>
learningContentList
=
this
.
learningContentService
.
list
(
lambdaQueryWrapper
);
String
learningContentNames
=
learningContentList
.
stream
().
map
(
LearningContent:
:
getName
).
collect
(
Collectors
.
joining
(
"、"
));
learningProject
.
setLearningContentNames
(
learningContentNames
);
}
return
getResult
(
page
);
}
...
...
This diff is collapsed.
Click to expand it.
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