Commit 363108d6 authored by root's avatar root

修改接口

parent 74446078
...@@ -5,19 +5,25 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -5,19 +5,25 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.bbanner.dto.TopDownDTO;
import org.rcisoft.common.controller.PaginationController; import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel; import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bbanner.entity.BBanner; import org.rcisoft.business.bbanner.entity.BBanner;
import org.rcisoft.business.bbanner.service.BBannerService; import org.rcisoft.business.bbanner.service.BBannerService;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/** /**
* @author * @author
* @date 2019/9/11 * @date 2019/9/11
...@@ -42,20 +48,19 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -42,20 +48,19 @@ public class BBannerController extends PaginationController<BBanner> {
@ApiImplicitParam(name = "sort", value = "排序", required = false, dataType = "varchar"), @ApiImplicitParam(name = "sort", value = "排序", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@PostMapping(value = "/add") @PostMapping(value = "/add")
// @PreAuthorize("hasRole('ROLE_1001')") public Result add(CurUser curUser, @Valid BBanner bBanner, BindingResult bindingResult) {
public Result add(BBanner BBanner) { PersistModel data = bBannerService.persist(bBanner);
PersistModel data = bBannerService.persist(BBanner);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
BBanner); bBanner);
} }
@ApiOperation(value="删除Banner", notes="根据ID删除一条记录") @ApiOperation(value="删除Banner", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
public Result remove(String businessId) { public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) {
PersistModel data = bBannerService.removeBanner(businessId); PersistModel data = bBannerService.removeBanner(businessId);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -63,10 +68,11 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -63,10 +68,11 @@ public class BBannerController extends PaginationController<BBanner> {
businessId); businessId);
} }
@ApiOperation(value="唯一查找", notes="根据ID查找一条记录") @ApiOperation(value="唯一查找", notes="根据ID查找一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@GetMapping(value = "/one") @GetMapping(value = "/one")
public Result queryOne(String businessId) { public Result queryOne(CurUser curUser,String businessId, BindingResult bindingResult) {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
...@@ -82,10 +88,40 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -82,10 +88,40 @@ public class BBannerController extends PaginationController<BBanner> {
@ApiImplicitParam(name = "lineType", value = "类型(0:线下,1:线上)", required = false, dataType = "varchar"), @ApiImplicitParam(name = "lineType", value = "类型(0:线下,1:线上)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@GetMapping(value = "/queryBBannerByPagination") @GetMapping(value = "/queryBBannerByPagination")
public GridModel queryBBannerByPagination(BBanner param) { public Result queryBBannerByPagination(CurUser curUser, @Valid BBanner param,BindingResult bindingResult) {
bBannerService.queryBannerByPagination(getPaginationUtility(),param); bBannerService.queryBannerByPagination(getPaginationUtility(),param);
GridModel gridModel = getGridModelResponse(); 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);
}
} }
package org.rcisoft.business.bbanner.dao; package org.rcisoft.business.bbanner.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.rcisoft.business.bbanner.dto.TopDownDTO;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bbanner.entity.BBanner; import org.rcisoft.business.bbanner.entity.BBanner;
import org.springframework.boot.Banner;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -42,6 +45,15 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -42,6 +45,15 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
"</script>") "</script>")
int selectCountById(String id); 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 * @param model
...@@ -68,6 +80,27 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -68,6 +80,27 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
int updateById(BBanner model); int updateById(BBanner model);
/**
* 逻辑删除
* @param id
* @return
*/
@Update("update b_banner set del_flag = 1 where business_id = #{id}") @Update("update b_banner set del_flag = 1 where business_id = #{id}")
int deleteBanner(String id); int deleteBanner(String id);
@Select("<script>select * from b_banner where banner_sort &gt; #{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 &lt; #{bannerSort} " +
"and del_flag = 0 and flag = 1 " +
"ORDER BY sort desc LIMIT 1</script>")
@ResultMap(value = "BaseResultMap" )
BBanner getlessChapter(TopDownDTO param);
} }
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;
}
package org.rcisoft.business.bbanner.dto;
public class SelectBannerPaginDTO {
}
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;
}
...@@ -4,12 +4,13 @@ import lombok.AllArgsConstructor; ...@@ -4,12 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.sys.dept.entity.SysDept; import org.rcisoft.sys.dept.entity.SysDept;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
/** /**
...@@ -50,6 +51,4 @@ public class BBanner extends IdEntity<SysDept> { ...@@ -50,6 +51,4 @@ public class BBanner extends IdEntity<SysDept> {
//排序 //排序
private Integer bannerSort; private Integer bannerSort;
} }
\ No newline at end of file
package org.rcisoft.business.bbanner.service; 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.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bbanner.entity.BBanner; import org.rcisoft.business.bbanner.entity.BBanner;
...@@ -27,7 +30,7 @@ public interface BBannerService { ...@@ -27,7 +30,7 @@ public interface BBannerService {
* @param businessId * @param businessId
* @return * @return
*/ */
BBanner selectOne(String businessId); BannerInfoRspDTO selectOne(String businessId);
/** /**
* 获取图片分页 * 获取图片分页
...@@ -36,4 +39,20 @@ public interface BBannerService { ...@@ -36,4 +39,20 @@ public interface BBannerService {
* @return * @return
*/ */
List<BBanner> queryBannerByPagination(PageUtil pageUtil, BBanner model); List<BBanner> queryBannerByPagination(PageUtil pageUtil, BBanner model);
/**
* Banner向上调顺序
* @param topDownDTO
* @return
*/
int updateTopChapter(TopDownDTO topDownDTO);
/**
* Banner向下调顺序
* @param topDownDTO
* @return
*/
int updateDownChapter(TopDownDTO topDownDTO);
} }
package org.rcisoft.business.bbanner.service.impl; package org.rcisoft.business.bbanner.service.impl;
import org.apache.commons.lang3.StringUtils; 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.aop.PageUtil;
import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.business.bbanner.dao.BBannerRepository; import org.rcisoft.business.bbanner.dao.BBannerRepository;
import org.rcisoft.business.bbanner.entity.BBanner; import org.rcisoft.business.bbanner.entity.BBanner;
import org.rcisoft.business.bbanner.service.BBannerService; import org.rcisoft.business.bbanner.service.BBannerService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -35,17 +38,17 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -35,17 +38,17 @@ public class BBannerServiceImpl implements BBannerService {
int line = 0; int line = 0;
//外部链接但外部URL为空或长度为0 抛异常 //外部链接但外部URL为空或长度为0 抛异常
if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl())) if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl()))
// throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
throw new ServiceException("必填项未填写"); throw new ServiceException("必填项未填写");
//内部链接但类型或课程ID为空或长度为0 抛异常 //内部链接但类型或课程ID为空或长度为0 抛异常
if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId()))) if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId())))
throw new ServiceException("必填项未填写"); throw new ServiceException("必填项未填写");
// throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
if (model.getBusinessId() != null) { if (model.getBusinessId() != null) {
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){ if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){
throw new ServiceException("该数据不存在"); throw new ServiceException("该数据不存在");
} }
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
int sort = bBannerRepository.selectMaxSort();
model.setBannerSort(sort);
line = bBannerRepository.updateById(model); line = bBannerRepository.updateById(model);
} else { } else {
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
...@@ -57,16 +60,19 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -57,16 +60,19 @@ public class BBannerServiceImpl implements BBannerService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel removeBanner(String id) { public PersistModel removeBanner(String id) {
if (StringUtils.isEmpty(id)){ if (bBannerRepository.selectCountById(id) == 0){
throw new ServiceException("请选择"); throw new ServiceException("该数据不存在");
} }
return new PersistModel(1,bBannerRepository.deleteBanner(id)); return new PersistModel(1,bBannerRepository.deleteBanner(id));
} }
@Override @Override
public BBanner selectOne(String businessId) { public BannerInfoRspDTO selectOne(String id) {
return bBannerRepository.selectByPrimaryKey(businessId); BBanner banner = bBannerRepository.selectByPrimaryKey(id);
BannerInfoRspDTO bannerInfoRspDTO = new BannerInfoRspDTO();
BeanUtils.copyProperties(banner, bannerInfoRspDTO);
return bannerInfoRspDTO;
} }
@Override @Override
...@@ -74,5 +80,35 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -74,5 +80,35 @@ public class BBannerServiceImpl implements BBannerService {
return bBannerRepository.queryBanners(model); 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;
}
} }
...@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.controller; ...@@ -3,6 +3,7 @@ package org.rcisoft.business.blesson.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
...@@ -15,6 +16,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -15,6 +16,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UploadUtil; import org.rcisoft.core.util.UploadUtil;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -47,7 +49,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -47,7 +49,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam(name = "credits", value = "学分(1-5)", required = false, dataType = "varchar"), @ApiImplicitParam(name = "credits", value = "学分(1-5)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "directionId", value = "课程方向ID", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "directionId", value = "课程方向ID", required = false, dataType = "varchar")})
@PostMapping(value = "/add") @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()> if(bLesson.getCode().length()>
Integer.parseInt(global.getMAX_CODE_LENGTH())) Integer.parseInt(global.getMAX_CODE_LENGTH()))
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR); throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
...@@ -150,17 +152,28 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -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中的参数分页查询") @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") @GetMapping(value = "/queryBLessonsByPagination")
public Result queryBLessonsByPagination(BLesson param,String uid) { public Result queryBLessonsByPagination(CurUser curUser, @Valid BLessonIPublishDTO param, BindingResult bindingResult) {
bLessonService.queryBLessonsByPagination(getPaginationUtility(),param,uid); String userId = curUser.getUserId();
bLessonService.queryBLessonsByPagination(getPaginationUtility(),param,userId);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
// return gridModel;
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
...@@ -175,18 +188,18 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -175,18 +188,18 @@ public class BLessonController extends PaginationController<BLesson> {
// return gridModel; // return gridModel;
// } // }
@ApiOperation(value="根据条件查询", notes="根据URL中的参数查询全部") // @ApiOperation(value="根据条件查询", notes="根据URL中的参数查询全部")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"), // @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"), // @ApiImplicitParam(name = "code", value = "课程编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"), // @ApiImplicitParam(name = "lessonName", value = "课程名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"), // @ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "credits", value = "学分", required = false, dataType = "varchar")}) // @ApiImplicitParam(name = "credits", value = "学分", required = false, dataType = "varchar")})
@GetMapping(value = "/queryBLessons") // @GetMapping(value = "/queryBLessons")
public Result queryBLessons(BLesson param) { // public Result queryBLessons(BLesson param) {
return Result.builder(new PersistModel(1), // return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, // MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, // MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.queryBLessons(param)); // bLessonService.queryBLessons(param));
} // }
} }
package org.rcisoft.business.blesson.dao; package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*; 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.BLesson;
import org.rcisoft.business.blesson.entity.BLessonDirection; import org.rcisoft.business.blesson.entity.BLessonDirection;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
...@@ -34,23 +35,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -34,23 +35,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
//我发布的 //我发布的
@Select("<script>select * from b_lesson " + @Select("<script>select * from b_lesson " +
"where del_flag != 1 and flag = 1 and lecturer_id = #{lecturerId}" + "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>") "order by update_date desc</script>")
@ResultMap(value = "BaseResultMap") @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 " + @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 " + "left join b_lesson_direction bld on bl.business_id = bld.lession_id " +
......
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;
}
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;
}
...@@ -4,12 +4,12 @@ import lombok.AllArgsConstructor; ...@@ -4,12 +4,12 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -66,18 +66,22 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -66,18 +66,22 @@ public class BLesson extends IdEntity<BLesson> {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonType;//课程类型(0:课程 1:培训) private String lessonType;//课程类型(0:课程 1:培训)
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String discussNumber;//评论数 private String discussNumber;//评论数
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String recommend;//推荐(0:不推荐 1:推荐) private String recommend;//推荐(0:不推荐 1:推荐)
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String collectNumber;//关注数 private String collectNumber;//关注数
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String hotNumber;//热度 private String hotNumber;//热度
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String value;//价值 private String value;//价值
@Transient @Transient
private String learnProgress;//学习进度 private String learnProgress;//学习进度
...@@ -90,21 +94,6 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -90,21 +94,6 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String labels;//标签集合 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) { public BLesson(String code) {
this.code = code; this.code = code;
} }
......
...@@ -2,6 +2,8 @@ package org.rcisoft.business.blesson.service; ...@@ -2,6 +2,8 @@ package org.rcisoft.business.blesson.service;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; 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.business.blesson.entity.BLesson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -35,7 +37,7 @@ public interface BLessonService{ ...@@ -35,7 +37,7 @@ public interface BLessonService{
* @param model * @param model
* @return * @return
*/ */
List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model,String uid); List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLessonIPublishDTO model, String userId);
/** /**
* 根据条件分页查找我学习的 * 根据条件分页查找我学习的
...@@ -43,14 +45,14 @@ public interface BLessonService{ ...@@ -43,14 +45,14 @@ public interface BLessonService{
* @param model * @param model
* @return * @return
*/ */
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model,String userId); // List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model,String userId);
/** /**
* 根据条件查找全部 * 根据条件查找全部
* @param model * @param model
* @return * @return
*/ */
List<BLesson> queryBLessons(BLesson model); // List<BLesson> queryBLessons(BLesson model);
/** /**
* 插入 * 插入
......
package org.rcisoft.business.blesson.service.impl; package org.rcisoft.business.blesson.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.blesson.dao.BLessonRepository; 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.BLesson;
import org.rcisoft.business.blesson.entity.BLessonDirection; import org.rcisoft.business.blesson.entity.BLessonDirection;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
...@@ -19,6 +22,7 @@ import org.rcisoft.core.util.ExcelUtil; ...@@ -19,6 +22,7 @@ import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.TestChinese; import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -35,6 +39,7 @@ import java.util.Map; ...@@ -35,6 +39,7 @@ import java.util.Map;
/** /**
* Created by CodeGenerator on 2017/07/12. * Created by CodeGenerator on 2017/07/12.
*/ */
@Slf4j
@Service @Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
public class BLessonServiceImpl implements BLessonService { public class BLessonServiceImpl implements BLessonService {
...@@ -69,23 +74,24 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -69,23 +74,24 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model,String uid) { public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLessonIPublishDTO model, String userId) {
if (StringUtils.isEmpty(uid)){ return bLessonRepository.queryBLessons(model, userId);
throw new ServiceException("请登录");
}
model.setLecturerId(uid);
return bLessonRepository.queryBLessons(model);
} }
@Override // @Override
public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model ,String userId) { // public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model ,String userId) {
return bLessonRepository.queryLearnBLessons(model, userId); // return bLessonRepository.queryLearnBLessons(model, userId);
} // }
@Override // @Override
public List<BLesson> queryBLessons(BLesson model) { // public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLesson model ,String userId) {
return bLessonRepository.queryBLessons(model); // return bLessonRepository.queryLearnBLessons(model, userId);
} // }
// @Override
// public List<BLesson> queryBLessons(BLesson model) {
// return bLessonRepository.queryBLessons(model);
// }
@Override @Override
......
...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.entity.BLesson; 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.entity.BLessonPerson;
import org.rcisoft.business.blessonperson.service.BLessonPersonService; import org.rcisoft.business.blessonperson.service.BLessonPersonService;
import org.rcisoft.common.controller.PaginationController; import org.rcisoft.common.controller.PaginationController;
...@@ -12,12 +14,16 @@ import org.rcisoft.common.model.GridModel; ...@@ -12,12 +14,16 @@ import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@RestController @RestController
@RequestMapping("/BLessonPerson") @RequestMapping("/BLessonPerson")
@Slf4j @Slf4j
...@@ -38,18 +44,12 @@ public class BLessonPersonController extends PaginationController<BLesson> { ...@@ -38,18 +44,12 @@ public class BLessonPersonController extends PaginationController<BLesson> {
} }
//------- //-------
@ApiOperation(value="分页查询听课", notes="") @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")})
@GetMapping(value = "/queryLearnBLessonsByPagination") @GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(BLessonPerson param, String uid) { public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
// param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID)); String userId = curUser.getUserId();
bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(),param,uid); bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(),param,userId);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
// return gridModel;
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
......
...@@ -3,6 +3,7 @@ package org.rcisoft.business.blessonperson.dao; ...@@ -3,6 +3,7 @@ package org.rcisoft.business.blessonperson.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blabel.entity.BLabel; import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blesson.entity.BLesson; 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.entity.BLessonPerson;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -13,20 +14,21 @@ import java.util.List; ...@@ -13,20 +14,21 @@ import java.util.List;
public interface BLessonPersonRepository extends BaseMapper<BLabel> { public interface BLessonPersonRepository extends BaseMapper<BLabel> {
//我学习的 //我学习的
@Select("<script>select blp.*,bl.lesson_name lessonName,bl.default_url defaultUrl,bl.person_number personNumber," + @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.class_hour classHour,bl.discuss_number discussNumber ,bl.lecturer_id lecturerId, bl.lesson_type " +
" lessonType,bl.course_time courseTime " +
// ",su.name lecturerName " + // ",su.name lecturerName " +
"from b_lesson_person blp " + " from b_lesson_person blp " +
"left join b_lesson bl on blp.lesson_id = bl.business_id " + " 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 s_user su on su.business_id = bl.lecturer_id " +
// "left join b_course bc on bc.business_id = bl.course_type " + // "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 " + " 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} " + " 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.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> " +
"<if test=\"param.lessonType!=null and param.courseType != ''\">and bl.lesson_type = #{param.lessonType} </if> " + " <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
"order by blp.update_date desc</script>") " order by blp.update_date desc</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnBLessons(@Param("param") BLessonPerson param, @Param("userId") String userId); List<BLessonPerson> queryLearnBLessons(@Param("param") ILearnLessonDTO param, @Param("userId") String userId);
......
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;
}
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;
}
...@@ -5,12 +5,13 @@ import lombok.AllArgsConstructor; ...@@ -5,12 +5,13 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
@Entity @Entity
@Table(name = "b_lesson_label") @Table(name = "b_lesson_label")
......
package org.rcisoft.business.blessonperson.service; package org.rcisoft.business.blessonperson.service;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.entity.BLesson; 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.business.blessonperson.entity.BLessonPerson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -24,5 +27,5 @@ public interface BLessonPersonService { ...@@ -24,5 +27,5 @@ public interface BLessonPersonService {
* @param model * @param model
* @return * @return
*/ */
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLessonPerson model, String userId); List<ILearnLessonRspDTO> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId);
} }
package org.rcisoft.business.blessonperson.service.impl; 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.blesson.entity.BLesson;
import org.rcisoft.business.blessonperson.dao.BLessonPersonRepository; 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.entity.BLessonPerson;
import org.rcisoft.business.blessonperson.service.BLessonPersonService; import org.rcisoft.business.blessonperson.service.BLessonPersonService;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -33,8 +39,17 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -33,8 +39,17 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
} }
@Override @Override
public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, BLessonPerson model, String userId) { public List<ILearnLessonRspDTO> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId) {
return bLessonPersonRepository.queryLearnBLessons(model, 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;
} }
......
...@@ -50,6 +50,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter { ...@@ -50,6 +50,8 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
.addResourceLocations("classpath:/static/"); .addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html") registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/"); .addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("doc.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**") registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/"); .addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry); super.addResourceHandlers(registry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment