Commit 45a95d7e authored by root's avatar root

修改接口

parent ccc83c92
......@@ -186,11 +186,11 @@ public class BLessonController extends PaginationController<BLesson> {
businessId);
}
@ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(工作台)", response = BLesson.class)
@ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(Banner内部资源)", response = BLesson.class)
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/findLessonTrain")
public Result findLessonTrain(CurUser curUser, @Valid LessonTrainDTO lessonTrainDTO, BindingResult bindingResult) {
bLessonService.findLessonTrain(getPaginationUtility(),lessonTrainDTO);
@GetMapping(value = "/findLessonAtBannerByPagination")
public Result findLessonAtBannerByPagination(CurUser curUser, @Valid LessonTrainAtBannerDTO lessonTrainDTO, BindingResult bindingResult) {
bLessonService.findLessonAtBannerByPagination(getPaginationUtility(),lessonTrainDTO);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -265,4 +265,15 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="618 发布课程", notes="根据ID发布一个课程")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/release")
public Result release(CurUser curUser,String businessId,BindingResult bindingResult) {
PersistModel data = bLessonService.closeBLesson(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
}
......@@ -2,10 +2,7 @@ package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FindListLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.dto.ILessonCountDTO;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.core.base.BaseMapper;
......@@ -354,6 +351,63 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"where business_id=#{businessId}",
"</script>"})
int closeLesson(BLesson model);
/**
* 根据课程id发布课程
*
* @param model
* @return
*/
@Update({"<script>",
"update b_lesson",
" <set>",
" <if test='updateBy != null'>update_by=#{updateBy},</if>",
" <if test='updateDate != null'>update_date=#{updateDate},</if>",
" release_state = '2'",
" </set>",
"where business_id=#{businessId}",
"</script>"})
int releaseLesson(BLesson model);
/**
* 首页分页查询全部课程
* @param param
* @return
*/
@Select(" <script> select distinct bl.* " +
// " ,su.name lecturerName " +
// " ,suc.name createByName " +
" from b_lesson bl " +
// " left join s_user su on su.business_id = bl.lecturer_id " +
// " left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_viewrange bv on bl.business_id = bv.lesson_id " +
// " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
// " left join b_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 " +
// " and su.del_flag != 1 and su.flag = 1 " +
// " and suc.del_flag != 1 and suc.flag = 1 " +
// " and bv.del_flag != 1 and bv.flag = 1 " +
// " and bl.corp_id = #{param.corpId} "+
// " and su.corp_id = #{param.corpId} "+
// " and suc.corp_id = #{param.corpId} "+
// " and bv.corp_id = #{param.corpId} "+
" and bl.release_state = 2 " +
// " and ((bvs.type = 0 and bvs.target_id = #{param.userId}) " +
// " <if test=\"param.departs != null and param.departs.size() > 0 \"> " +
// " or (bvs.type = 1 and bvs.target_id in " +
// " <foreach item='item' index='index' collection='param.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
// " </if>) " +
" <if test= \" lessonName !=null and lessonName != ''\">and lesson_name like CONCAT('%',#{lessonName},'%') " +
// " or su.name like CONCAT('%',#{param.viewParam},'%'))" +
" </if> " +
// " <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_id in " +
// " <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
// " </if> " +
" order by bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> findLessonAtBannerByPagination(LessonTrainAtBannerDTO param);
/**
* 查询我发布和我学习课程数量
......@@ -468,6 +522,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"LEFT JOIN s_user u1 ON u1.business_id = les.lecturer_id " +
"AND u1.corp_id = #{corpId}" +
"WHERE 1=1 " +
"and les.del_flag != 1 and les.flag = 1 "+
"and b1.del_flag != 1 and b1.flag = 1 "+
"and b2.del_flag != 1 and b2.flag = 1 "+
"and b3.del_flag != 1 and b3.flag = 1 "+
"and u1.del_flag != 1 and u1.flag = 1 "+
"AND les.corp_id = #{corpId}" +
"<if test='!isAdmin'>" +
"AND les.lecturer_id IN" +
......
......@@ -7,19 +7,17 @@ import org.hibernate.validator.constraints.Length;
import javax.persistence.Transient;
@Data
public class LessonTrainDTO {
public class LessonTrainAtBannerDTO {
@ApiModelProperty(value = "课程名称",required = false)
@Length(min = 1,max = 200,message = "长度最小为1,最大为150")
private String lessonName;
@ApiModelProperty(value = "发布状态(0:待发布 1:审核中 2:已发布 3:已驳回 4:已关闭)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String releaseState;
// @ApiModelProperty(value = "发布状态(0:待发布 1:审核中 2:已发布 3:已驳回 4:已关闭)")
// private String releaseState;
@ApiModelProperty(value = "创建人姓名")
@Transient
private String createByName;
// @ApiModelProperty(value = "创建人姓名")
// @Transient
// private String createByName;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
......
......@@ -43,7 +43,7 @@ public class BLesson extends IdEntity<BLesson> {
@Length(min = 1,max = 200,message = "长度最小为1,最大为150")
private String lessonName;
@ApiModelProperty(value = "*默认封面图片url")
@ApiModelProperty(value = "*封面图片url")
private String defaultUrl;
@ApiModelProperty(value = "课时")
......
......@@ -104,13 +104,20 @@ public interface BLessonService{
*/
PersistModel closeBLesson(String id);
/**
* 发布课程
* @param id
* @return
*/
PersistModel releaseBLesson(String id);
/**
* 课程培训条件查询
* @param pageUtil
* @param lessonTrainDTO
* @return
*/
List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO);
List<BLesson> findLessonAtBannerByPagination(PageUtil pageUtil, LessonTrainAtBannerDTO lessonTrainDTO);
/**
* 我发布的总数
......
......@@ -239,8 +239,18 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO) {
return null;
public PersistModel releaseBLesson(String id) {
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.releaseLesson(bLesson);
//int line = bLessonRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
public List<BLesson> findLessonAtBannerByPagination(PageUtil pageUtil, LessonTrainAtBannerDTO lessonTrainDTO) {
return bLessonRepository.findLessonAtBannerByPagination(lessonTrainDTO);
}
@Override
......
......@@ -33,7 +33,7 @@ public class FileUploadController extends FileController {
@Autowired
private Global global;
@ApiOperation(value="上传图片", notes="上传图片到服务器")
@ApiOperation(value="901 上传图片", notes="上传图片到服务器")
@ApiImplicitParams({@ApiImplicitParam(name = "importFile", value = "图片文件", required = true, dataType = "MultipartFile"),
// @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar")
})
......
......@@ -169,7 +169,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("<script>SELECT sr.type AS roleList " +
"FROM s_user AS su " +
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN s_role AS sr ON ru.role_id = sr.business_id " +
"LEFT JOIN tm_admin_role AS sr ON ru.role_id = sr.r_id " +
"WHERE su.del_flag = 0 " +
"AND su.business_id = #{userId}</script>")
List<String> queryRoleTypeByUserId(@Param("userId")String userId);
......
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