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
be434022
Commit
be434022
authored
Mar 26, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
fdcf0567
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
25 deletions
+113
-25
MysqlGenerator.java
...energy/chnmuseum/party/common/mybatis/MysqlGenerator.java
+1
-5
LearningContent.java
...a/cn/wisenergy/chnmuseum/party/model/LearningContent.java
+31
-0
LearningContentBoard.java
...wisenergy/chnmuseum/party/model/LearningContentBoard.java
+12
-6
LearningContentController.java
...useum/party/web/controller/LearningContentController.java
+69
-14
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MysqlGenerator.java
View file @
be434022
...
@@ -3,11 +3,7 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
...
@@ -3,11 +3,7 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
public
class
MysqlGenerator
{
public
class
MysqlGenerator
{
private
static
final
String
[]
tableNames
=
new
String
[]{
private
static
final
String
[]
tableNames
=
new
String
[]{
"learning_content"
,
"learning_content_board"
"learning_content_board"
,
"learning_content_board_cat"
,
"learning_content_copyright_owner"
,
"learning_project"
};
};
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
private
static
final
String
projectPath
=
"/opt/ss"
;
private
static
final
String
projectPath
=
"/opt/ss"
;
...
...
src/main/java/cn/wisenergy/chnmuseum/party/model/LearningContent.java
View file @
be434022
...
@@ -12,6 +12,7 @@ import javax.validation.constraints.NotBlank;
...
@@ -12,6 +12,7 @@ import javax.validation.constraints.NotBlank;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
/**
* <p>
* <p>
...
@@ -82,4 +83,34 @@ public class LearningContent implements Serializable {
...
@@ -82,4 +83,34 @@ public class LearningContent implements Serializable {
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
@ApiModelProperty
(
"展板分类ID列表"
)
@TableField
(
exist
=
false
)
@NotNull
(
message
=
"展板分类ID列表不能为空"
,
groups
=
{
Add
.
class
})
private
List
<
String
>
exhibitionBoardCatIdList
;
@ApiModelProperty
(
"版权方ID列表"
)
@TableField
(
exist
=
false
)
@NotNull
(
message
=
"版权方ID列表不能为空"
,
groups
=
{
Add
.
class
})
private
List
<
String
>
copyrightOwnerIdList
;
@ApiModelProperty
(
"展板内容ID列表"
)
@TableField
(
exist
=
false
)
private
List
<
String
>
exhibitionBoardIdList
;
@ApiModelProperty
(
"展板分类名称列表"
)
@TableField
(
exist
=
false
)
private
List
<
String
>
exhibitionBoardCatNameList
;
@ApiModelProperty
(
"版权方名称列表"
)
@TableField
(
exist
=
false
)
private
List
<
String
>
copyrightOwnerNameList
;
@ApiModelProperty
(
"学习项目名称"
)
@TableField
(
exist
=
false
)
private
String
learningProjectName
;
@ApiModelProperty
(
"所含展板数量(列表使用)"
)
@TableField
(
exist
=
false
)
private
Integer
exhibitionBoardCount
;
}
}
src/main/java/cn/wisenergy/chnmuseum/party/model/LearningContentBoard.java
View file @
be434022
...
@@ -41,15 +41,21 @@ public class LearningContentBoard implements Serializable {
...
@@ -41,15 +41,21 @@ public class LearningContentBoard implements Serializable {
@ApiModelProperty
(
"学习内容ID"
)
@ApiModelProperty
(
"学习内容ID"
)
@TableField
(
"learning_content_id"
)
@TableField
(
"learning_content_id"
)
@NotBlank
(
message
=
"学习内容ID不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
@NotBlank
(
message
=
"学习内容ID不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
private
String
learningContentId
;
private
String
learningContentId
;
@ApiModelProperty
(
"展板ID"
)
@ApiModelProperty
(
"展板ID"
)
@TableField
(
"exhibition_board_id"
)
@TableField
(
"exhibition_board_id"
)
@NotBlank
(
message
=
"展板ID不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
@NotBlank
(
message
=
"展板ID不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
private
String
exhibitionBoardId
;
private
String
exhibitionBoardId
;
@ApiModelProperty
(
"展板名称"
)
@TableField
(
exist
=
false
)
@NotBlank
(
message
=
"展板ID不能为空"
,
groups
=
{
Add
.
class
,
Update
.
class
})
private
String
exhibitionBoardName
;
@ApiModelProperty
(
"排序顺序"
)
@TableField
(
"sortorder"
)
private
Integer
sortorder
;
}
}
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/LearningContentController.java
View file @
be434022
...
@@ -4,13 +4,11 @@ import cn.wisenergy.chnmuseum.party.common.enums.AuditStatusEnum;
...
@@ -4,13 +4,11 @@ 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.Add
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Update
;
import
cn.wisenergy.chnmuseum.party.common.validator.groups.Update
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.model.LearningContent
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentBoardCatService
;
import
cn.wisenergy.chnmuseum.party.service.*
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentBoardService
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentCopyrightOwnerService
;
import
cn.wisenergy.chnmuseum.party.service.LearningContentService
;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
cn.wisenergy.chnmuseum.party.web.controller.base.BaseController
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -49,23 +47,36 @@ public class LearningContentController extends BaseController {
...
@@ -49,23 +47,36 @@ public class LearningContentController extends BaseController {
private
LearningContentBoardService
learningContentBoardService
;
private
LearningContentBoardService
learningContentBoardService
;
@Resource
@Resource
private
LearningContentCopyrightOwnerService
learningContentCopyrightOwnerService
;
private
LearningContentCopyrightOwnerService
learningContentCopyrightOwnerService
;
@Resource
private
LearningProjectService
learningProjectService
;
@PostMapping
(
"/save"
)
@PostMapping
(
"/save"
)
@RequiresPermissions
(
"learning:content:save"
)
@RequiresPermissions
(
"learning:content:save"
)
@ApiOperation
(
value
=
"添加学习内容"
,
notes
=
"添加学习内容"
)
@ApiOperation
(
value
=
"添加学习内容"
,
notes
=
"添加学习内容"
)
public
Map
<
String
,
Object
>
saveLearningContent
(
@Validated
(
value
=
{
Add
.
class
})
LearningContent
learningContent
)
{
public
Map
<
String
,
Object
>
saveLearningContent
(
@Validated
(
value
=
{
Add
.
class
})
LearningContent
learningContent
)
{
learningContent
.
setAuditStatus
(
AuditStatusEnum
.
TBC
.
name
());
learningContent
.
setIsPublished
(
false
);
// 保存业务节点信息
// 保存业务节点信息
boolean
result
=
learningContentService
.
save
(
learningContent
);
boolean
result
=
learningContentService
.
save
(
learningContent
);
final
String
learningContentId
=
learningContent
.
getId
();
final
List
<
String
>
exhibitionBoardCatIdList
=
learningContent
.
getExhibitionBoardCatIdList
();
for
(
String
exhibitionBoardCatId
:
exhibitionBoardCatIdList
)
{
LearningContentBoardCat
learningContentBoardCat
=
LearningContentBoardCat
.
builder
().
exhibitionBoardCatId
(
exhibitionBoardCatId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentBoardCatService
.
save
(
learningContentBoardCat
);
}
final
List
<
String
>
copyrightOwnerIdList
=
learningContent
.
getCopyrightOwnerIdList
();
for
(
String
copyrightOwnerId
:
copyrightOwnerIdList
)
{
LearningContentCopyrightOwner
contentCopyrightOwner
=
LearningContentCopyrightOwner
.
builder
().
copyrightOwnerId
(
copyrightOwnerId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentCopyrightOwnerService
.
save
(
contentCopyrightOwner
);
}
final
List
<
String
>
exhibitionBoardIdList
=
learningContent
.
getExhibitionBoardIdList
();
for
(
String
exhibitionBoardId
:
exhibitionBoardIdList
)
{
LearningContentBoard
learningContentBoard
=
LearningContentBoard
.
builder
().
exhibitionBoardId
(
exhibitionBoardId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentBoardService
.
save
(
learningContentBoard
);
}
// 返回操作结果
// 返回操作结果
if
(
result
)
{
if
(
result
)
{
...
@@ -80,6 +91,44 @@ public class LearningContentController extends BaseController {
...
@@ -80,6 +91,44 @@ public class LearningContentController extends BaseController {
@RequiresPermissions
(
"learning:content:update"
)
@RequiresPermissions
(
"learning:content:update"
)
@ApiOperation
(
value
=
"修改学习内容信息"
,
notes
=
"修改学习内容信息"
)
@ApiOperation
(
value
=
"修改学习内容信息"
,
notes
=
"修改学习内容信息"
)
public
Map
<
String
,
Object
>
updateLearningContent
(
@Validated
(
value
=
{
Update
.
class
})
LearningContent
learningContent
)
{
public
Map
<
String
,
Object
>
updateLearningContent
(
@Validated
(
value
=
{
Update
.
class
})
LearningContent
learningContent
)
{
learningContent
.
setAuditStatus
(
AuditStatusEnum
.
TBC
.
name
());
learningContent
.
setIsPublished
(
false
);
// 保存业务节点信息
final
String
learningContentId
=
learningContent
.
getId
();
final
List
<
String
>
exhibitionBoardCatIdList
=
learningContent
.
getExhibitionBoardCatIdList
();
if
(
exhibitionBoardCatIdList
!=
null
&&
!
exhibitionBoardCatIdList
.
isEmpty
())
{
LambdaUpdateWrapper
<
LearningContentBoardCat
>
lambdaUpdateWrapper
=
Wrappers
.<
LearningContentBoardCat
>
lambdaUpdate
().
eq
(
LearningContentBoardCat:
:
getLearningContentId
,
learningContentId
);
this
.
learningContentBoardCatService
.
remove
(
lambdaUpdateWrapper
);
for
(
String
exhibitionBoardCatId
:
exhibitionBoardCatIdList
)
{
LearningContentBoardCat
learningContentBoardCat
=
LearningContentBoardCat
.
builder
().
exhibitionBoardCatId
(
exhibitionBoardCatId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentBoardCatService
.
save
(
learningContentBoardCat
);
}
}
final
List
<
String
>
copyrightOwnerIdList
=
learningContent
.
getCopyrightOwnerIdList
();
if
(
copyrightOwnerIdList
!=
null
&&
!
copyrightOwnerIdList
.
isEmpty
())
{
LambdaUpdateWrapper
<
LearningContentCopyrightOwner
>
lambdaUpdateWrapper
=
Wrappers
.<
LearningContentCopyrightOwner
>
lambdaUpdate
().
eq
(
LearningContentCopyrightOwner:
:
getLearningContentId
,
learningContentId
);
this
.
learningContentCopyrightOwnerService
.
remove
(
lambdaUpdateWrapper
);
for
(
String
copyrightOwnerId
:
copyrightOwnerIdList
)
{
LearningContentCopyrightOwner
contentCopyrightOwner
=
LearningContentCopyrightOwner
.
builder
().
copyrightOwnerId
(
copyrightOwnerId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentCopyrightOwnerService
.
save
(
contentCopyrightOwner
);
}
}
final
List
<
String
>
exhibitionBoardIdList
=
learningContent
.
getExhibitionBoardIdList
();
if
(
exhibitionBoardIdList
!=
null
&&
!
exhibitionBoardIdList
.
isEmpty
())
{
LambdaUpdateWrapper
<
LearningContentBoard
>
lambdaUpdateWrapper
=
Wrappers
.<
LearningContentBoard
>
lambdaUpdate
().
eq
(
LearningContentBoard:
:
getLearningContentId
,
learningContentId
);
this
.
learningContentBoardService
.
remove
(
lambdaUpdateWrapper
);
for
(
String
exhibitionBoardId
:
exhibitionBoardIdList
)
{
LearningContentBoard
learningContentBoard
=
LearningContentBoard
.
builder
().
exhibitionBoardId
(
exhibitionBoardId
).
learningContentId
(
learningContentId
).
build
();
this
.
learningContentBoardService
.
save
(
learningContentBoard
);
}
}
boolean
flag
=
learningContentService
.
updateById
(
learningContent
);
boolean
flag
=
learningContentService
.
updateById
(
learningContent
);
if
(
flag
)
{
if
(
flag
)
{
return
getSuccessResult
();
return
getSuccessResult
();
...
@@ -89,7 +138,7 @@ public class LearningContentController extends BaseController {
...
@@ -89,7 +138,7 @@ public class LearningContentController extends BaseController {
@DeleteMapping
(
"/delete/{id}"
)
@DeleteMapping
(
"/delete/{id}"
)
@RequiresPermissions
(
"learning:content:delete"
)
@RequiresPermissions
(
"learning:content:delete"
)
@ApiOperation
(
value
=
"根据ID
删除学习内容"
,
notes
=
"根据ID删除
学习内容"
)
@ApiOperation
(
value
=
"根据ID
下架学习内容"
,
notes
=
"根据ID下架
学习内容"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
paramType
=
"path"
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
paramType
=
"path"
,
dataType
=
"String"
)
})
})
...
@@ -144,7 +193,9 @@ public class LearningContentController extends BaseController {
...
@@ -144,7 +193,9 @@ public class LearningContentController extends BaseController {
LearningContent:
:
getUpdateTime
);
LearningContent:
:
getUpdateTime
);
Page
<
LearningContent
>
page
=
this
.
learningContentService
.
page
(
getPage
(),
queryWrapper
);
Page
<
LearningContent
>
page
=
this
.
learningContentService
.
page
(
getPage
(),
queryWrapper
);
for
(
LearningContent
learningContent
:
page
.
getRecords
())
{
for
(
LearningContent
learningContent
:
page
.
getRecords
())
{
LambdaQueryWrapper
<
LearningContentBoard
>
lambdaQueryWrapper
=
Wrappers
.<
LearningContentBoard
>
lambdaQuery
().
eq
(
LearningContentBoard:
:
getLearningContentId
,
learningContent
.
getId
());
int
exhibitionBoardCount
=
this
.
learningContentBoardService
.
count
(
lambdaQueryWrapper
);
learningContent
.
setExhibitionBoardCount
(
exhibitionBoardCount
);
}
}
return
getResult
(
page
);
return
getResult
(
page
);
}
}
...
@@ -157,6 +208,10 @@ public class LearningContentController extends BaseController {
...
@@ -157,6 +208,10 @@ public class LearningContentController extends BaseController {
@RequiresPermissions
(
"learning:content:get:id"
)
@RequiresPermissions
(
"learning:content:get:id"
)
public
Map
<
String
,
Object
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
public
Map
<
String
,
Object
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
LearningContent
learningContent
=
learningContentService
.
getById
(
id
);
LearningContent
learningContent
=
learningContentService
.
getById
(
id
);
LearningProject
learningProject
=
this
.
learningProjectService
.
getById
(
learningContent
.
getLearningProjectId
());
if
(
learningProject
!=
null
)
{
learningContent
.
setLearningProjectName
(
learningProject
.
getName
());
}
return
getResult
(
learningContent
);
return
getResult
(
learningContent
);
}
}
...
...
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