Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
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
李丛阳
education
Commits
363108d6
Commit
363108d6
authored
Sep 22, 2019
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
74446078
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
439 additions
and
113 deletions
+439
-113
BBannerController.java
...cisoft/business/bbanner/controller/BBannerController.java
+44
-8
BBannerRepository.java
...a/org/rcisoft/business/bbanner/dao/BBannerRepository.java
+33
-0
BannerInfoRspDTO.java
...va/org/rcisoft/business/bbanner/dto/BannerInfoRspDTO.java
+35
-0
SelectBannerPaginDTO.java
...rg/rcisoft/business/bbanner/dto/SelectBannerPaginDTO.java
+4
-0
TopDownDTO.java
...ain/java/org/rcisoft/business/bbanner/dto/TopDownDTO.java
+21
-0
BBanner.java
...ain/java/org/rcisoft/business/bbanner/entity/BBanner.java
+2
-3
BBannerService.java
.../org/rcisoft/business/bbanner/service/BBannerService.java
+20
-1
BBannerServiceImpl.java
...oft/business/bbanner/service/impl/BBannerServiceImpl.java
+43
-7
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+35
-22
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+3
-14
BLessonIPublishDTO.java
.../org/rcisoft/business/blesson/dto/BLessonIPublishDTO.java
+18
-0
BLessonIPublishRspDTO.java
...g/rcisoft/business/blesson/dto/BLessonIPublishRspDTO.java
+32
-0
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+6
-17
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+5
-3
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+20
-14
BLessonPersonController.java
...ess/blessonperson/controller/BLessonPersonController.java
+10
-10
BLessonPersonRepository.java
...t/business/blessonperson/dao/BLessonPersonRepository.java
+12
-10
ILearnLessonDTO.java
...g/rcisoft/business/blessonperson/dto/ILearnLessonDTO.java
+28
-0
ILearnLessonRspDTO.java
...cisoft/business/blessonperson/dto/ILearnLessonRspDTO.java
+43
-0
BLessonPerson.java
.../rcisoft/business/blessonperson/entity/BLessonPerson.java
+2
-1
BLessonPersonService.java
.../business/blessonperson/service/BLessonPersonService.java
+4
-1
BLessonPersonServiceImpl.java
.../blessonperson/service/impl/BLessonPersonServiceImpl.java
+17
-2
MvcConfig.java
src/main/java/org/rcisoft/config/MvcConfig.java
+2
-0
No files found.
src/main/java/org/rcisoft/business/bbanner/controller/BBannerController.java
View file @
363108d6
...
...
@@ -5,19 +5,25 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.bbanner.dto.TopDownDTO
;
import
org.rcisoft.common.controller.PaginationController
;
import
org.rcisoft.common.model.GridModel
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.business.bbanner.entity.BBanner
;
import
org.rcisoft.business.bbanner.service.BBannerService
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.Banner
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
/**
* @author
* @date 2019/9/11
...
...
@@ -42,20 +48,19 @@ public class BBannerController extends PaginationController<BBanner> {
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
value
=
"/add"
)
// @PreAuthorize("hasRole('ROLE_1001')")
public
Result
add
(
BBanner
BBanner
)
{
PersistModel
data
=
bBannerService
.
persist
(
BBanner
);
public
Result
add
(
CurUser
curUser
,
@Valid
BBanner
bBanner
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bBannerService
.
persist
(
bBanner
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
B
Banner
);
b
Banner
);
}
@ApiOperation
(
value
=
"删除Banner"
,
notes
=
"根据ID删除一条记录"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/remove"
)
public
Result
remove
(
String
businessId
)
{
public
Result
remove
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bBannerService
.
removeBanner
(
businessId
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -63,10 +68,11 @@ public class BBannerController extends PaginationController<BBanner> {
businessId
);
}
@ApiOperation
(
value
=
"唯一查找"
,
notes
=
"根据ID查找一条记录"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/one"
)
public
Result
queryOne
(
String
businessId
)
{
public
Result
queryOne
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
@@ -82,10 +88,40 @@ public class BBannerController extends PaginationController<BBanner> {
@ApiImplicitParam
(
name
=
"lineType"
,
value
=
"类型(0:线下,1:线上)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBBannerByPagination"
)
public
GridModel
queryBBannerByPagination
(
BBanner
param
)
{
public
Result
queryBBannerByPagination
(
CurUser
curUser
,
@Valid
BBanner
param
,
BindingResult
bindingResult
)
{
bBannerService
.
queryBannerByPagination
(
getPaginationUtility
(),
param
);
GridModel
gridModel
=
getGridModelResponse
();
return
gridModel
;
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
gridModel
);
}
@ApiOperation
(
value
=
"Banner向上调顺序"
,
notes
=
"Banner向上调顺序"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"当前顺序"
,
required
=
true
,
dataType
=
"Integer"
)})
@PostMapping
(
value
=
"/updateTopBanner"
)
public
Result
updateTopBanner
(
CurUser
curUser
,
@Valid
TopDownDTO
topDownDTO
,
BindingResult
bindingResult
){
int
data
=
bBannerService
.
updateTopChapter
(
topDownDTO
);
return
Result
.
builder
(
new
PersistModel
(
data
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
topDownDTO
);
}
@ApiOperation
(
value
=
"Banner向下调顺序"
,
notes
=
"Banner向下调顺序"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"当前顺序"
,
required
=
true
,
dataType
=
"Integer"
)})
@PostMapping
(
value
=
"/updateDownBanner"
)
public
Result
updateDownBanner
(
CurUser
curUser
,
@Valid
TopDownDTO
topDownDTO
,
BindingResult
bindingResult
){
int
data
=
bBannerService
.
updateDownChapter
(
topDownDTO
);
return
Result
.
builder
(
new
PersistModel
(
data
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
topDownDTO
);
}
}
src/main/java/org/rcisoft/business/bbanner/dao/BBannerRepository.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
dao
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Update
;
import
org.rcisoft.business.bbanner.dto.TopDownDTO
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.business.bbanner.entity.BBanner
;
import
org.springframework.boot.Banner
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
...
...
@@ -42,6 +45,15 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
"</script>"
)
int
selectCountById
(
String
id
);
/**
* 获取sort最大值 +1
* @return
*/
@Select
(
"<script>select DISTINCT IFNULL((select max(sort) from b_chapter where "
+
"and del_flag = 0 and flag = 1 ),0)+1 as sort</script>"
)
int
selectMaxSort
();
/**
* 更新
* @param model
...
...
@@ -68,6 +80,27 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
int
updateById
(
BBanner
model
);
/**
* 逻辑删除
* @param id
* @return
*/
@Update
(
"update b_banner set del_flag = 1 where business_id = #{id}"
)
int
deleteBanner
(
String
id
);
@Select
(
"<script>select * from b_banner where banner_sort > #{bannerSort} "
+
" and del_flag = 0 and flag = 1 "
+
"ORDER BY sort asc LIMIT 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BBanner
getBigChapter
(
TopDownDTO
param
);
@Update
(
"<script>update b_banner set banner_sort = #{bannerSort} where business_id = #{businessId}</script>"
)
int
updateSortById
(
@Param
(
"businessId"
)
String
businessId
,
@Param
(
"bannerSort"
)
int
bannerSort
);
@Select
(
"<script>select * from b_banner where banner_sort < #{bannerSort} "
+
"and del_flag = 0 and flag = 1 "
+
"ORDER BY sort desc LIMIT 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BBanner
getlessChapter
(
TopDownDTO
param
);
}
src/main/java/org/rcisoft/business/bbanner/dto/BannerInfoRspDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* Banner 详情DTO
*/
@Data
public
class
BannerInfoRspDTO
{
@ApiModelProperty
(
value
=
"主键id"
)
private
String
businessId
;
@ApiModelProperty
(
value
=
"标题"
)
private
String
title
;
@ApiModelProperty
(
value
=
"图片地址"
)
private
String
imageUrl
;
@ApiModelProperty
(
value
=
"是否为外部链接(0:否,1:是)"
)
private
String
isExternalLink
;
@ApiModelProperty
(
value
=
"外部URL"
)
private
String
externalUrl
;
@ApiModelProperty
(
value
=
"类型(0:线下,1:线上"
)
private
String
lineType
;
@ApiModelProperty
(
value
=
"课程ID"
)
private
String
courseId
;
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
bannerSort
;
}
src/main/java/org/rcisoft/business/bbanner/dto/SelectBannerPaginDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
dto
;
public
class
SelectBannerPaginDTO
{
}
src/main/java/org/rcisoft/business/bbanner/dto/TopDownDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotNull
;
@Data
public
class
TopDownDTO
{
@NotNull
@Length
(
min
=
1
,
max
=
50
,
message
=
"长度最小为1,最大为50"
)
@ApiModelProperty
(
value
=
"主键"
)
private
String
businessId
;
@NotNull
@Length
(
min
=
1
,
max
=
11
,
message
=
"长度最小为1,最大为11"
)
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
bannerSort
;
}
src/main/java/org/rcisoft/business/bbanner/entity/BBanner.java
View file @
363108d6
...
...
@@ -4,12 +4,13 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.rcisoft.core.entity.IdEntity
;
import
org.rcisoft.sys.dept.entity.SysDept
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.validation.constraints.NotBlank
;
/**
...
...
@@ -50,6 +51,4 @@ public class BBanner extends IdEntity<SysDept> {
//排序
private
Integer
bannerSort
;
}
\ No newline at end of file
src/main/java/org/rcisoft/business/bbanner/service/BBannerService.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
service
;
import
org.rcisoft.business.bbanner.dto.BannerInfoRspDTO
;
import
org.rcisoft.business.bbanner.dto.TopDownDTO
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.business.bbanner.entity.BBanner
;
...
...
@@ -27,7 +30,7 @@ public interface BBannerService {
* @param businessId
* @return
*/
B
Banner
selectOne
(
String
businessId
);
B
annerInfoRspDTO
selectOne
(
String
businessId
);
/**
* 获取图片分页
...
...
@@ -36,4 +39,20 @@ public interface BBannerService {
* @return
*/
List
<
BBanner
>
queryBannerByPagination
(
PageUtil
pageUtil
,
BBanner
model
);
/**
* Banner向上调顺序
* @param topDownDTO
* @return
*/
int
updateTopChapter
(
TopDownDTO
topDownDTO
);
/**
* Banner向下调顺序
* @param topDownDTO
* @return
*/
int
updateDownChapter
(
TopDownDTO
topDownDTO
);
}
src/main/java/org/rcisoft/business/bbanner/service/impl/BBannerServiceImpl.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
bbanner
.
service
.
impl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.business.bbanner.dto.BannerInfoRspDTO
;
import
org.rcisoft.business.bbanner.dto.TopDownDTO
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.constant.DelStatus
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.business.bbanner.dao.BBannerRepository
;
import
org.rcisoft.business.bbanner.entity.BBanner
;
import
org.rcisoft.business.bbanner.service.BBannerService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -35,17 +38,17 @@ public class BBannerServiceImpl implements BBannerService {
int
line
=
0
;
//外部链接但外部URL为空或长度为0 抛异常
if
(
"1"
.
equals
(
model
.
getIsExternalLink
())
&&
StringUtils
.
isEmpty
(
model
.
getExternalUrl
()))
// throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
throw
new
ServiceException
(
"必填项未填写"
);
//内部链接但类型或课程ID为空或长度为0 抛异常
if
(
"0"
.
equals
(
model
.
getIsExternalLink
())
&&
(
StringUtils
.
isEmpty
(
model
.
getLineType
())
||
StringUtils
.
isEmpty
(
model
.
getCourseId
())))
throw
new
ServiceException
(
"必填项未填写"
);
// throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
if
(
model
.
getBusinessId
()
!=
null
)
{
if
(
bBannerRepository
.
selectCountById
(
model
.
getBusinessId
())
==
0
){
throw
new
ServiceException
(
"该数据不存在"
);
}
UserUtil
.
setCurrentMergeOperation
(
model
);
int
sort
=
bBannerRepository
.
selectMaxSort
();
model
.
setBannerSort
(
sort
);
line
=
bBannerRepository
.
updateById
(
model
);
}
else
{
UserUtil
.
setCurrentPersistOperation
(
model
);
...
...
@@ -57,16 +60,19 @@ public class BBannerServiceImpl implements BBannerService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
PersistModel
removeBanner
(
String
id
)
{
if
(
StringUtils
.
isEmpty
(
id
)
){
throw
new
ServiceException
(
"
请选择
"
);
if
(
bBannerRepository
.
selectCountById
(
id
)
==
0
){
throw
new
ServiceException
(
"
该数据不存在
"
);
}
return
new
PersistModel
(
1
,
bBannerRepository
.
deleteBanner
(
id
));
}
@Override
public
BBanner
selectOne
(
String
businessId
)
{
return
bBannerRepository
.
selectByPrimaryKey
(
businessId
);
public
BannerInfoRspDTO
selectOne
(
String
id
)
{
BBanner
banner
=
bBannerRepository
.
selectByPrimaryKey
(
id
);
BannerInfoRspDTO
bannerInfoRspDTO
=
new
BannerInfoRspDTO
();
BeanUtils
.
copyProperties
(
banner
,
bannerInfoRspDTO
);
return
bannerInfoRspDTO
;
}
@Override
...
...
@@ -74,5 +80,35 @@ public class BBannerServiceImpl implements BBannerService {
return
bBannerRepository
.
queryBanners
(
model
);
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
int
updateTopChapter
(
TopDownDTO
topDownDTO
)
{
int
result
=
0
;
BBanner
lessBanner
=
bBannerRepository
.
getlessChapter
(
topDownDTO
);
int
sort
=
topDownDTO
.
getBannerSort
();
int
lessSort
=
lessBanner
.
getBannerSort
();
int
data
=
bBannerRepository
.
updateSortById
(
topDownDTO
.
getBusinessId
(),
lessSort
);
int
data2
=
bBannerRepository
.
updateSortById
(
lessBanner
.
getBusinessId
(),
sort
);
if
(
data
==
data2
){
result
=
1
;
}
return
result
;
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
int
updateDownChapter
(
TopDownDTO
topDownDTO
)
{
int
result
=
0
;
BBanner
bigBanner
=
bBannerRepository
.
getBigChapter
(
topDownDTO
);
int
sort
=
topDownDTO
.
getBannerSort
();
int
bigSort
=
bigBanner
.
getBannerSort
();
int
data
=
bBannerRepository
.
updateSortById
(
topDownDTO
.
getBusinessId
(),
bigSort
);
int
data2
=
bBannerRepository
.
updateSortById
(
bigBanner
.
getBusinessId
(),
sort
);
if
(
data
==
data2
){
result
=
1
;
}
return
result
;
}
}
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
363108d6
...
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.controller;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.common.component.Global
;
...
...
@@ -15,6 +16,7 @@ import org.rcisoft.core.model.PersistModel;
import
org.rcisoft.core.result.Result
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.UploadUtil
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -47,7 +49,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分(1-5)"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"directionId"
,
value
=
"课程方向ID"
,
required
=
false
,
dataType
=
"varchar"
)})
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BLesson
bLesson
,
BindingResult
bindingResult
)
{
public
Result
add
(
CurUser
curUser
,
@Valid
BLesson
bLesson
,
BindingResult
bindingResult
)
{
if
(
bLesson
.
getCode
().
length
()>
Integer
.
parseInt
(
global
.
getMAX_CODE_LENGTH
()))
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMETER_ERROR
);
...
...
@@ -150,17 +152,28 @@ public class BLessonController extends PaginationController<BLesson> {
}
// @ApiOperation(value="根据条件分页查询", notes="根据URL中的参数分页查询")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
// @ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
// @ApiImplicitParam(name = "condition", value = "模糊查询条件", required = false, dataType = "varchar"),
// @ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"),
// @ApiImplicitParam(name = "credits", value = "学分", required = false, dataType = "varchar")})
// @GetMapping(value = "/queryBLessonsByPagination")
// public Result queryBLessonsByPagination(BLesson param,String uid) {
// bLessonService.queryBLessonsByPagination(getPaginationUtility(),param,uid);
// GridModel gridModel = getGridModelResponse();
//// return gridModel;
// return Result.builder(new PersistModel(1),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// gridModel);
// }
@ApiOperation
(
value
=
"根据条件分页查询"
,
notes
=
"根据URL中的参数分页查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"code"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"condition"
,
value
=
"模糊查询条件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBLessonsByPagination"
)
public
Result
queryBLessonsByPagination
(
BLesson
param
,
String
uid
)
{
bLessonService
.
queryBLessonsByPagination
(
getPaginationUtility
(),
param
,
uid
);
public
Result
queryBLessonsByPagination
(
CurUser
curUser
,
@Valid
BLessonIPublishDTO
param
,
BindingResult
bindingResult
)
{
String
userId
=
curUser
.
getUserId
();
bLessonService
.
queryBLessonsByPagination
(
getPaginationUtility
(),
param
,
userId
);
GridModel
gridModel
=
getGridModelResponse
();
// return gridModel;
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
@@ -175,18 +188,18 @@ public class BLessonController extends PaginationController<BLesson> {
// return gridModel;
// }
@ApiOperation
(
value
=
"根据条件查询"
,
notes
=
"根据URL中的参数查询全部"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"code"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"lessonName"
,
value
=
"课程名称"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBLessons"
)
public
Result
queryBLessons
(
BLesson
param
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bLessonService
.
queryBLessons
(
param
));
}
//
@ApiOperation(value="根据条件查询", notes="根据URL中的参数查询全部")
//
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
//
@ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
//
@ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"),
//
@ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"),
//
@ApiImplicitParam(name = "credits", value = "学分", required = false, dataType = "varchar")})
//
@GetMapping(value = "/queryBLessons")
//
public Result queryBLessons(BLesson param) {
//
return Result.builder(new PersistModel(1),
//
MessageConstant.MESSAGE_ALERT_SUCCESS,
//
MessageConstant.MESSAGE_ALERT_ERROR,
//
bLessonService.queryBLessons(param));
//
}
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
blesson
.
dao
;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.entity.BLessonDirection
;
import
org.rcisoft.core.base.BaseMapper
;
...
...
@@ -34,23 +35,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
//我发布的
@Select
(
"<script>select * from b_lesson "
+
"where del_flag != 1 and flag = 1 and lecturer_id = #{lecturerId}"
+
"<if test=\"
releaseState!=null and releaseState != ''\">and release_state = #{
releaseState} </if>"
+
"<if test=\"
param.releaseState!=null and param.releaseState != ''\">and release_state = #{param.
releaseState} </if>"
+
"order by update_date desc</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryBLessons
(
BLesson
param
);
List
<
BLesson
>
queryBLessons
(
@Param
(
"param"
)
BLessonIPublishDTO
param
,
@Param
(
"lecturerId"
)
String
lecturerId
);
//我学习的
@Select
(
"<script>select bl.*,blp.learn_progress learnProgress,su.name lecturerName from b_lesson_person blp "
+
"left join b_lesson bl on blp.lesson_id = bl.business_id "
+
"left join s_user su on su.business_id = bl.lecturer_id "
+
// "left join b_course bc on bc.business_id = bl.course_type " +
"where blp.del_flag != 1 and blp.flag = 1 and bl.release_state = '2' and blp.person_id = #{userId} "
+
"<if test=\"param.isLearnOver == 1 \">and blp.learn_progress = '100' </if> "
+
"<if test=\"param.isLearnOver == 0 \">and blp.learn_progress != '100' </if> "
+
"<if test=\"param.courseType!=null and param.courseType != ''\">and bl.course_type = #{param.courseType} </if> "
+
"order by blp.update_date desc</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryLearnBLessons
(
@Param
(
"param"
)
BLesson
param
,
@Param
(
"userId"
)
String
userId
);
@Select
(
"<script>select bl.*,bld.direction_id as directionId from b_lesson bl "
+
"left join b_lesson_direction bld on bl.business_id = bld.lession_id "
+
...
...
src/main/java/org/rcisoft/business/blesson/dto/BLessonIPublishDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
blesson
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
/**
* 我发布的课程
*/
@Data
public
class
BLessonIPublishDTO
{
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
@ApiModelProperty
(
value
=
"发布状态(0:待发布 1:审核中 2:已发布 3:已驳回)"
,
required
=
false
)
private
String
releaseState
;
}
src/main/java/org/rcisoft/business/blesson/dto/BLessonIPublishRspDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
blesson
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
BLessonIPublishRspDTO
{
@ApiModelProperty
(
value
=
"课程id"
)
private
String
lessonId
;
@ApiModelProperty
(
value
=
"课程名"
)
private
String
lessonName
;
@ApiModelProperty
(
value
=
"选课人数"
)
private
String
personNumber
;
@ApiModelProperty
(
value
=
"评论数"
)
private
String
discussNumber
;
@ApiModelProperty
(
value
=
"课时数"
)
private
String
classHour
;
@ApiModelProperty
(
value
=
"课程时长"
)
private
String
courseTime
;
@ApiModelProperty
(
value
=
"封面图片url"
)
private
String
defaultUrl
;
@ApiModelProperty
(
value
=
"发布状态(0:待发布 1:审核中 2:已发布 3:已驳回)"
)
private
String
releaseState
;
}
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
363108d6
...
...
@@ -4,12 +4,12 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.rcisoft.core.entity.IdEntity
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
javax.validation.constraints.NotBlank
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -66,18 +66,22 @@ public class BLesson extends IdEntity<BLesson> {
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
lessonType
;
//课程类型(0:课程 1:培训)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
discussNumber
;
//评论数
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
recommend
;
//推荐(0:不推荐 1:推荐)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
collectNumber
;
//关注数
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
hotNumber
;
//热度
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
value
;
//价值
@Transient
private
String
learnProgress
;
//学习进度
...
...
@@ -90,21 +94,6 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private
String
labels
;
//标签集合
// @Transient
// private String directionId;//课程方向ID
//
// @Transient
// private String directionName;//课程方向名称
//
// @Transient
// private String directionCode;//课程方向编号
//
// @Transient
// private String chapterClassHour;//目前已添加总学时
//
// @Transient
// private String condition;//模糊查询条件
public
BLesson
(
String
code
)
{
this
.
code
=
code
;
}
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
363108d6
...
...
@@ -2,6 +2,8 @@ package org.rcisoft.business.blesson.service;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishRspDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
...
...
@@ -35,7 +37,7 @@ public interface BLessonService{
* @param model
* @return
*/
List
<
BLesson
>
queryBLessonsByPagination
(
PageUtil
pageUtil
,
BLesson
model
,
String
ui
d
);
List
<
BLesson
>
queryBLessonsByPagination
(
PageUtil
pageUtil
,
BLesson
IPublishDTO
model
,
String
userI
d
);
/**
* 根据条件分页查找我学习的
...
...
@@ -43,14 +45,14 @@ public interface BLessonService{
* @param model
* @return
*/
List
<
BLesson
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
BLesson
model
,
String
userId
);
//
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model,String userId);
/**
* 根据条件查找全部
* @param model
* @return
*/
List
<
BLesson
>
queryBLessons
(
BLesson
model
);
//
List<BLesson> queryBLessons(BLesson model);
/**
* 插入
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
blesson
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.blesson.dao.BLessonRepository
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishRspDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.entity.BLessonDirection
;
import
org.rcisoft.business.blesson.service.BLessonService
;
...
...
@@ -19,6 +22,7 @@ import org.rcisoft.core.util.ExcelUtil;
import
org.rcisoft.core.util.IdGen
;
import
org.rcisoft.core.util.TestChinese
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -35,6 +39,7 @@ import java.util.Map;
/**
* Created by CodeGenerator on 2017/07/12.
*/
@Slf4j
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
BLessonServiceImpl
implements
BLessonService
{
...
...
@@ -69,23 +74,24 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public
List
<
BLesson
>
queryBLessonsByPagination
(
PageUtil
pageUtil
,
BLesson
model
,
String
uid
)
{
if
(
StringUtils
.
isEmpty
(
uid
)){
throw
new
ServiceException
(
"请登录"
);
}
model
.
setLecturerId
(
uid
);
return
bLessonRepository
.
queryBLessons
(
model
);
public
List
<
BLesson
>
queryBLessonsByPagination
(
PageUtil
pageUtil
,
BLessonIPublishDTO
model
,
String
userId
)
{
return
bLessonRepository
.
queryBLessons
(
model
,
userId
);
}
@Override
public
List
<
BLesson
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
BLesson
model
,
String
userId
)
{
return
bLessonRepository
.
queryLearnBLessons
(
model
,
userId
);
}
//
@Override
//
public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model ,String userId) {
//
return bLessonRepository.queryLearnBLessons(model, userId);
//
}
@Override
public
List
<
BLesson
>
queryBLessons
(
BLesson
model
)
{
return
bLessonRepository
.
queryBLessons
(
model
);
}
// @Override
// public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model ,String userId) {
// return bLessonRepository.queryLearnBLessons(model, userId);
// }
// @Override
// public List<BLesson> queryBLessons(BLesson model) {
// return bLessonRepository.queryBLessons(model);
// }
@Override
...
...
src/main/java/org/rcisoft/business/blessonperson/controller/BLessonPersonController.java
View file @
363108d6
...
...
@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonDTO
;
import
org.rcisoft.business.blessonperson.entity.BLessonPerson
;
import
org.rcisoft.business.blessonperson.service.BLessonPersonService
;
import
org.rcisoft.common.controller.PaginationController
;
...
...
@@ -12,12 +14,16 @@ import org.rcisoft.common.model.GridModel;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
@RestController
@RequestMapping
(
"/BLessonPerson"
)
@Slf4j
...
...
@@ -38,18 +44,12 @@ public class BLessonPersonController extends PaginationController<BLesson> {
}
//-------
@ApiOperation
(
value
=
"分页查询听课"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"code"
,
value
=
"课程编号"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"condition"
,
value
=
"模糊查询条件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"credits"
,
value
=
"学分"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiOperation
(
value
=
"分页查询我学习"
,
notes
=
"分页查询我学习"
)
@GetMapping
(
value
=
"/queryLearnBLessonsByPagination"
)
public
Result
queryLearnBLessonsByPagination
(
BLessonPerson
param
,
String
uid
)
{
// param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID)
);
bLessonPersonService
.
queryLearnBLessonsByPagination
(
getPaginationUtility
(),
param
,
u
i
d
);
public
Result
queryLearnBLessonsByPagination
(
CurUser
curUser
,
@Valid
ILearnLessonDTO
param
,
BindingResult
bindingResult
)
{
String
userId
=
curUser
.
getUserId
(
);
bLessonPersonService
.
queryLearnBLessonsByPagination
(
getPaginationUtility
(),
param
,
u
serI
d
);
GridModel
gridModel
=
getGridModelResponse
();
// return gridModel;
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/business/blessonperson/dao/BLessonPersonRepository.java
View file @
363108d6
...
...
@@ -3,6 +3,7 @@ package org.rcisoft.business.blessonperson.dao;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.business.blabel.entity.BLabel
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonDTO
;
import
org.rcisoft.business.blessonperson.entity.BLessonPerson
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -13,20 +14,21 @@ import java.util.List;
public
interface
BLessonPersonRepository
extends
BaseMapper
<
BLabel
>
{
//我学习的
@Select
(
"<script>select blp.*,bl.lesson_name lessonName,bl.default_url defaultUrl,bl.person_number personNumber,"
+
"bl.class_hour classHour,bl.discuss_number discussNumber ,bl.lecturer_id lecturerId "
+
@Select
(
"<script> select blp.*,bl.lesson_name lessonName,bl.default_url defaultUrl,bl.person_number personNumber, "
+
" bl.class_hour classHour,bl.discuss_number discussNumber ,bl.lecturer_id lecturerId, bl.lesson_type "
+
" lessonType,bl.course_time courseTime "
+
// ",su.name lecturerName " +
"from b_lesson_person blp "
+
"left join b_lesson bl on blp.lesson_id = bl.business_id "
+
"
from b_lesson_person blp "
+
"
left join b_lesson bl on blp.lesson_id = bl.business_id "
+
// "left join s_user su on su.business_id = bl.lecturer_id " +
// "left join b_course bc on bc.business_id = bl.course_type " +
"where blp.del_flag != 1 and blp.flag = 1 and bl.del_flag != 1 and bl.flag = 1 "
+
"and bl.release_state = '2' and blp.person_id = #{userId} "
+
"
<if test=\"param.isFinish!=
null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> "
+
"
<if test=\"param.lessonType!=null and param.course
Type != ''\">and bl.lesson_type = #{param.lessonType} </if> "
+
"order by blp.update_date desc</script>"
)
"
where blp.del_flag != 1 and blp.flag = 1 and bl.del_flag != 1 and bl.flag = 1 "
+
"
and bl.release_state = '2' and blp.person_id = #{userId} "
+
"
<if test= \" param.isFinish !=
null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> "
+
"
<if test= \" param.lessonType !=null and param.lesson
Type != ''\">and bl.lesson_type = #{param.lessonType} </if> "
+
"
order by blp.update_date desc</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryLearnBLessons
(
@Param
(
"param"
)
BLessonPerson
param
,
@Param
(
"userId"
)
String
userId
);
List
<
BLesson
Person
>
queryLearnBLessons
(
@Param
(
"param"
)
ILearnLessonDTO
param
,
@Param
(
"userId"
)
String
userId
);
...
...
src/main/java/org/rcisoft/business/blessonperson/dto/ILearnLessonDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
blessonperson
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
@Entity
@Table
(
name
=
"b_lesson_label"
)
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
ILearnLessonDTO
{
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
@ApiModelProperty
(
value
=
"是否学完 0:未学完 1:已学完"
)
private
String
isFinish
;
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
@ApiModelProperty
(
value
=
"课程类型 0 课程 1 培训"
)
private
String
lessonType
;
}
src/main/java/org/rcisoft/business/blessonperson/dto/ILearnLessonRspDTO.java
0 → 100644
View file @
363108d6
package
org
.
rcisoft
.
business
.
blessonperson
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Transient
;
@Data
public
class
ILearnLessonRspDTO
{
@ApiModelProperty
(
value
=
"课程id"
)
private
String
lessonId
;
@ApiModelProperty
(
value
=
"课程名"
)
private
String
lessonName
;
@ApiModelProperty
(
value
=
"学习进度"
)
private
String
learnProgress
;
@ApiModelProperty
(
value
=
"是否学完 0:未学完 1:已学完"
)
private
String
isFinish
;
@ApiModelProperty
(
value
=
"选课人数"
)
private
String
personNumber
;
@ApiModelProperty
(
value
=
"评论数"
)
private
String
discussNumber
;
@ApiModelProperty
(
value
=
"课时数"
)
private
String
classHour
;
@ApiModelProperty
(
value
=
"课程时长"
)
private
String
courseTime
;
@ApiModelProperty
(
value
=
"封面图片url"
)
private
String
defaultUrl
;
@ApiModelProperty
(
value
=
"讲师姓名"
)
private
String
lecturerName
;
@ApiModelProperty
(
value
=
"课程类型 0 课程 1 培训"
)
private
String
lessonType
;
}
src/main/java/org/rcisoft/business/blessonperson/entity/BLessonPerson.java
View file @
363108d6
...
...
@@ -5,12 +5,13 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.rcisoft.core.entity.IdEntity
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
javax.validation.constraints.NotBlank
;
@Entity
@Table
(
name
=
"b_lesson_label"
)
...
...
src/main/java/org/rcisoft/business/blessonperson/service/BLessonPersonService.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
blessonperson
.
service
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonDTO
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonRspDTO
;
import
org.rcisoft.business.blessonperson.entity.BLessonPerson
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
...
...
@@ -24,5 +27,5 @@ public interface BLessonPersonService {
* @param model
* @return
*/
List
<
BLesson
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
BLessonPerson
model
,
String
userId
);
List
<
ILearnLessonRspDTO
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
ILearnLessonDTO
model
,
String
userId
);
}
src/main/java/org/rcisoft/business/blessonperson/service/impl/BLessonPersonServiceImpl.java
View file @
363108d6
package
org
.
rcisoft
.
business
.
blessonperson
.
service
.
impl
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishRspDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blessonperson.dao.BLessonPersonRepository
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonDTO
;
import
org.rcisoft.business.blessonperson.dto.ILearnLessonRspDTO
;
import
org.rcisoft.business.blessonperson.entity.BLessonPerson
;
import
org.rcisoft.business.blessonperson.service.BLessonPersonService
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -33,8 +39,17 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
}
@Override
public
List
<
BLesson
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
BLessonPerson
model
,
String
userId
)
{
return
bLessonPersonRepository
.
queryLearnBLessons
(
model
,
userId
);
public
List
<
ILearnLessonRspDTO
>
queryLearnBLessonsByPagination
(
PageUtil
pageUtil
,
ILearnLessonDTO
model
,
String
userId
)
{
List
<
BLessonPerson
>
bLessonPersonList
=
bLessonPersonRepository
.
queryLearnBLessons
(
model
,
userId
);
List
<
ILearnLessonRspDTO
>
bLessonIPublishRspDTOs
=
new
ArrayList
<>();
bLessonPersonList
.
forEach
(
bLesson
->{
ILearnLessonRspDTO
iLearnLessonRspDTO
=
new
ILearnLessonRspDTO
();
BeanUtils
.
copyProperties
(
bLesson
,
iLearnLessonRspDTO
);
bLessonIPublishRspDTOs
.
add
(
iLearnLessonRspDTO
);
});
return
bLessonIPublishRspDTOs
;
}
...
...
src/main/java/org/rcisoft/config/MvcConfig.java
View file @
363108d6
...
...
@@ -50,6 +50,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
.
addResourceLocations
(
"classpath:/static/"
);
registry
.
addResourceHandler
(
"swagger-ui.html"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"doc.html"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
super
.
addResourceHandlers
(
registry
);
...
...
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