Commit 2850edeb authored by 王淑君's avatar 王淑君

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents 3797c9ca 61e8eea5
package org.rcisoft.business.bcourse.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.dto.QueryCourseResDTO;
import org.rcisoft.business.bcourse.entity.BCourse;
import org.rcisoft.core.base.BaseMapper;
......@@ -39,4 +40,12 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@Select("select * from b_course where course_level = 1 and del_flag != '1' and flag ='1'")
@ResultMap(value = "BaseResultMapDTO")
List<QueryCourseResDTO> queryFirstLevel();
/**
* 查询所有分类存到List中
* @return
*/
@Select("select * from b_course where del_flag != '1' and flag ='1'")
@ResultMap(value = "AllCourseResultMap")
List<AllCourseDTO> findAllCourse();
}
package org.rcisoft.business.bcourse.dto;
import lombok.Data;
@Data
public class AllCourseDTO {
private String businessId;
private String cName;
private String pid;
private String courseLevel;
}
package org.rcisoft.business.bcourse.service;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.dto.QueryCourseResDTO;
import org.rcisoft.business.bcourse.entity.BCourse;
import org.rcisoft.core.aop.PageUtil;
......@@ -21,5 +22,11 @@ public interface BCourseService {
PersistModel updateCourse(BCourse bCoursee);
/**
* 查询所有分类放入List中
* @return
*/
List<AllCourseDTO> findAllCourse();
}
package org.rcisoft.business.bcourse.service.impl;
import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.dto.QueryCourseResDTO;
import org.rcisoft.business.bcourse.entity.BCourse;
import org.rcisoft.business.bcourse.service.BCourseService;
......@@ -81,4 +82,9 @@ public class BCourseServiceImpl implements BCourseService {
return new PersistModel(bCourseRepository.updateByPrimaryKeySelective(bCourse), MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
public List<AllCourseDTO> findAllCourse() {
return bCourseRepository.findAllCourse();
}
}
......@@ -4,9 +4,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.service.BCourseService;
import org.rcisoft.business.blesson.dto.AddLessonDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.dto.LessonTrainDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.common.component.Global;
......@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**
......@@ -39,6 +44,9 @@ public class BLessonController extends PaginationController<BLesson> {
@Autowired
private BLessonService bLessonService;
@Autowired
private BCourseService bCourseService;
@Autowired
private Global global;
......@@ -127,8 +135,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注")
@GetMapping(value = "/queryConcernByPagination")
public Result queryConcernByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
// String userId = curUser.getUserId();
public Result queryConcernByPagination(CurUser curUser) {
bLessonService.queryConcernByPagination(getPaginationUtility());
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
......@@ -140,8 +147,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣")
@GetMapping(value = "/queryInterestedByPagination")
public Result queryInterestedByPagination(CurUser curUser, @Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
// String userId = curUser.getUserId();
public Result queryInterestedByPagination(CurUser curUser) {
bLessonService.queryInterestedByPagination(getPaginationUtility());
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
......@@ -149,4 +155,42 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="610 首页分页查询全部课程", notes="根据条件分页查询全部课程")
@GetMapping(value = "/queryHomeBLessonsByPagination")
public Result queryHomeBLessonsByPagination(CurUser curUser, @Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse();
}
bLessonService.queryHomeBLessonsByPagination(getPaginationUtility(),firstPageQueryDTO,allCourse);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="611 关闭课程", notes="根据ID关闭一个课程")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/close")
public Result close(CurUser curUser,String businessId,BindingResult bindingResult) {
PersistModel data = bLessonService.closeBLesson(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(工作台)")
@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);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
}
......@@ -5,6 +5,7 @@ import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.core.base.BaseMapper;
......@@ -69,11 +70,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Delete("<script>delete from b_lesson_label where lesson_id = #{businessId}</script>")
int removeLabelByLessonId(BLesson model);
@Select("<script>select * from b_lesson " +
"" +
"where del_flag != 1 and flag = 1 and lecturer_id = #{lecturerId}" +
"<if test=\"param.releaseState!=null and param.releaseState != ''\">and release_state = #{param.releaseState} </if>" +
"order by update_date desc</script>")
/**
* 单一查询课程信息
* @param businessId
* @return
*/
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" ,bc.c_name courseName " +
" 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_course bc on bc.business_id = bl.course_type " +
" 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 bl.business_id = #{businessId} " +
"</script>")
@ResultMap(value = "BaseResultMap")
BLesson selectInfoById(String businessId);
......@@ -90,19 +104,18 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" 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_course bc on bc.business_id = bl.course_type " +
" 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 " +
" <if test= \" code != null and code != ''\">and bl.code = CONCAT('%',#{code},'%') </if> " +
" <if test= \" lessonName != null and lessonName != ''\">and bl.lesson_name = CONCAT('%',#{lessonName},'%') </if> " +
" <if test= \" code != null and code != ''\">and bl.code like CONCAT('%',#{code},'%') </if> " +
" <if test= \" lessonName != null and lessonName != ''\">and bl.lesson_name like CONCAT('%',#{lessonName},'%') </if> " +
" <if test= \" releaseState !=null and releaseState != ''\">and bl.release_state = #{releaseState} </if> " +
" <if test= \" createByName != null and createByName != ''\">and suc.name = CONCAT('%',#{createByName},'%') </if> " +
" <if test= \" createByName != null and createByName != ''\">and suc.name like CONCAT('%',#{createByName},'%') </if> " +
" <if test= \" courseType !=null and courseType != ''\">and bl.course_type = #{courseType} </if> " +
" <if test= \" viewRange !=null and viewRange != ''\">and bl.view_range = #{viewRange} </if> " +
" <if test= \" lessonType !=null and lessonType != ''\">and bl.lesson_type = #{lessonType} </if> " +
" <if test= \" recommend !=null and recommend != ''\">and bl.recommend = #{recommend} </if> " +
" <if test= \" lecturerName !=null and lecturerName != ''\">and bl.lesson_name = CONCAT('%',#{lecturerName},'%') </if> " +
" <if test= \" lecturerName !=null and lecturerName != ''\">and bl.lesson_name like CONCAT('%',#{lecturerName},'%') </if> " +
" order by bl.release_date desc" +
"</script>")
@ResultMap(value = "BaseResultMap")
......@@ -141,7 +154,6 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_lesson bl on br.lesson_id = bl.business_id " +
" 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_course bc on bc.business_id = bl.course_type " +
" 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 " +
......@@ -199,5 +211,43 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bls.business_id = #{lessonId} " +
"</script>")
List<QueryLabelResDTO> queryLabelByLessonId(String lessonId);
@Select(" <script> select 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_course bc on bc.business_id = bl.course_type " +
" 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 bl.release_state = 2 " +
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') " +
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> " +
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.person_number desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryHomeBLesson(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds);
/**
* 根据课程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 = '4'",
" </set>",
"where business_id=#{businessId}",
"</script>"})
int closeLesson(BLesson model);
}
......@@ -13,20 +13,19 @@ public class AddLessonDTO {
@ApiModelProperty(value = "课程id")
private String businessId;
@NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程编号")
private String code;
@NotBlank
@ApiModelProperty(value = "课程名称")
@ApiModelProperty(value = "课程名称",required = true)
@Length(min = 1,max = 200,message = "长度最小为1,最大为150")
private String lessonName;
@ApiModelProperty(value = "默认封面图片url")
private String defaultUrl;
@ApiModelProperty(value = "课程分类")
@ApiModelProperty(value = "课程分类",required = true)
@NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseType;
......@@ -41,7 +40,7 @@ public class AddLessonDTO {
private String viewRange;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@ApiModelProperty(value = "课程类型(0:课程 1:培训)",required = true)
@NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonType;
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.persistence.Transient;
@Data
public class LessonTrainDTO {
@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 = "创建人姓名")
@Transient
private String createByName;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String lessonType;
}
......@@ -75,7 +75,7 @@ public class BLesson extends IdEntity<BLesson> {
private Date releaseDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String lessonType;
@ApiModelProperty(value = "评论数")
......@@ -106,11 +106,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private String lecturerName;
@ApiModelProperty(value = "是否学完")
@Transient
private String isLearnOver;
@ApiModelProperty(value = "标签集合")
@ApiModelProperty(value = "接收标签集合 用‘,’分隔")
@Transient
private String labels;
......@@ -118,8 +114,12 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private String createByName;
@ApiModelProperty(value = "标签集合")
@ApiModelProperty(value = "返回标签集合")
@Transient
private List<QueryLabelResDTO> labelList;
@ApiModelProperty(value = "分类名")
@Transient
private String courseName;
}
package org.rcisoft.business.blesson.service;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.blesson.dto.AddLessonDTO;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import java.io.IOException;
import java.util.List;
/**
......@@ -88,16 +84,31 @@ public interface BLessonService{
PersistModel persist(AddLessonDTO model);
/**
* 课程信息excel导入
* @param hwb
* 逻辑删除
* @param id
* @return
*/
PersistModel importExcel(HSSFWorkbook hwb) throws IOException;
PersistModel removeBLesson(String id);
/**
* 逻辑删除
* 首页条件查询全部课程
* @return
*/
List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse);
/**
* 关闭课程
* @param id
* @return
*/
PersistModel removeBLesson(String id);
PersistModel closeBLesson(String id);
/**
* 课程培训条件查询
* @param pageUtil
* @param lessonTrainDTO
* @return
*/
List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO);
}
......@@ -4,20 +4,18 @@ 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.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.AddLessonDTO;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.business.blesson.util.recursion;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,7 +23,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -42,6 +39,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
private BLessonRepository bLessonRepository;
@Autowired
private BCourseRepository bCourseRepository;
@Autowired
private Global global;
......@@ -152,118 +152,6 @@ public class BLessonServiceImpl implements BLessonService {
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel importExcel(HSSFWorkbook hwb) throws IOException {
ArrayList<BLesson> lessons = new ArrayList<BLesson>();
ArrayList<String> repeatCode = new ArrayList<String>();
List<String> errorCode = new ArrayList<>();
ArrayList<String> direction = new ArrayList<String>();
List<String> isChinese = new ArrayList<>();
List<String> isNegative = new ArrayList<>();
List<String> currentlyCode = new ArrayList<>();
String innerRepeatResult = "";
String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
if (values.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
}
// for(String[] value:values){ //将数据封装到entity
// BLesson bLesson = null;
// String classCode = value[0];
//
// //判断编号是否含有中文
// if(TestChinese.isChinese(classCode)){
// isChinese.add(value[0]);
// continue;
// };
//
// //判断1:班级编号是否满足<15位;
// if(classCode.length()>15){
// //该用户不满足要求,记入valuesShort中
// errorCode.add(value[0]);
// continue;
// }
//
// if(Integer.parseInt(value[4])<0||Integer.parseInt(value[3])<0){
// //该用户不满足要求,记入valuesShort中
// isNegative.add(value[0]);
// continue;
// }
// if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) {
// repeatCode.add(value[0]);
// continue;
// }
// BDirection b_direction = bDirectionRepository.selectOne(new BDirection(value[2]));
// if (b_direction == null) {
// if (!direction.contains(value[2]))
// direction.add(value[2]);
// continue;
// }
// bLesson= new BLesson(value[0],value[1],value[3],value[4]);
// bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
// UserUtil.setCurrentPersistOperation(bLesson);
// //表中去重
// if(currentlyCode.contains(bLesson.getCode())){
// innerRepeatResult += "编号 " + value[1] + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
// continue;
// }
// if(!lessons.contains(bLesson)){
// currentlyCode.add(bLesson.getCode());
// lessons.add(bLesson);
//
// BLessonDirection bDirection = new BLessonDirection();
// bDirection.setDirectionId(b_direction.getBusinessId());
// bDirection.setBusinessId(IdGen.uuid());
// bDirection.setLessionId(bLesson.getBusinessId());
// bDirectionRepository.insertBLessonDirection(bDirection);
// }
// }
String result ="";
if(lessons.size()>0){
int line = bLessonRepository.insertList(lessons);
if (line>0) {
result+="成功导入"+lessons.size()+"门课程。";
}else{
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR);
}
}
if(isNegative.size()>0){
result+="以下课程的学时或学分不能为负数:"+ JSON.toJSONString(isNegative)+"。";
}
if(isChinese.size()>0){
result+="以下编号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(repeatCode.size()>0){
result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。";
}
if(errorCode.size()>0){
result+="以下课程编号超过15位:"+ JSON.toJSONString(errorCode)+"。";
}
if(direction.size()>0){
result+="以下课程方向编号不存在:"+ JSON.toJSONString(direction)+"。";
}
if (lessons.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST.getCode(),result);
}
return new PersistModel(1,result + innerRepeatResult);
}
public PersistModel importPic(HSSFWorkbook hwb) throws IOException
{
return null;
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel removeBLesson(String id) {
......@@ -283,6 +171,30 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) {
List<String> sonCourseIds = null;
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO,sonCourseIds);
}
@Override
public PersistModel closeBLesson(String id) {
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.closeLesson(bLesson);
//int line = bLessonRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
public List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO) {
return null;
}
private Map<String,Object> queryParamHandler(BLesson model){
Map param = new HashMap<String, Object>();
if(model.getLessonName()!=null)
......
package org.rcisoft.business.blesson.util;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class recursion {
/**
* 查找当前分类下 多级子分类
* @param fatherId
* @param allCourse
* @return
*/
public static List<String> FindSons(String fatherId, List<AllCourseDTO> allCourse){
List<String> sonList = new ArrayList<>();
for(AllCourseDTO course:allCourse){
if(course.getPid() != null && !("00000000".equals(course.getPid())) && course.getPid().equals(fatherId)){
sonList.add(course.getBusinessId());
sonList.addAll(recursion.FindSons(course.getBusinessId(),allCourse));
}
}
return sonList;
}
}
package org.rcisoft.business.blessonperson.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@Api(tags = "9 学生-课程")
@RestController
@RequestMapping("/BLessonPerson")
@Slf4j
......@@ -32,7 +34,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
@Autowired
private BLessonPersonService bLessonPersonService;
@ApiOperation(value="退出课程", notes="根据ID停用一条记录")
@ApiOperation(value="901 退出课程", notes="根据ID停用一条记录")
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit")
public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) {
......@@ -43,7 +45,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
businessId);
}
@ApiOperation(value="分页查询我学习", notes="分页查询我学习")
@ApiOperation(value="902 分页查询我学习", notes="分页查询我学习")
@GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId();
......
......@@ -25,7 +25,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.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.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
" order by blp.update_date desc</script>")
......
......@@ -16,6 +16,7 @@ import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.menu.entity.SysMenu;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -49,8 +50,8 @@ public class SysUserController extends PaginationController<SysUser> {
@ApiImplicitParam(name = "flag", value = "用户启用状态 0未启用 1启用", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "roleName", value = "用户角色", required = false, dataType = "varchar")})
@GetMapping(value = "/queryUsers")
public GridModel queryUsers(CurUser curUser, @Valid SysUser sysUser, BindingResult br) {
userServiceImpl.queryUsersByPagination(getPaginationUtility(), sysUser);
public GridModel queryUsers(CurUser curUser, @Valid QuerySysUserDTO dto, BindingResult br) {
userServiceImpl.queryUsersByPagination(getPaginationUtility(), dto);
GridModel gridModel = getGridModelResponse();
return gridModel;
}
......@@ -67,16 +68,16 @@ public class SysUserController extends PaginationController<SysUser> {
id);
}
@ApiOperation(value = "703 删除用户", notes = "删除用户")
@ApiImplicitParam(name = "businessId", value = "用户id", required = true, dataType = "varchar", paramType = "path")
@PostMapping(value = "/delete")
public Result roleDelete(CurUser curUser, @Valid String businessId, BindingResult br) {
int line = userServiceImpl.removeUser(businessId);
return Result.builder(new PersistModel(line),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
// @ApiOperation(value = "703 删除用户", notes = "删除用户")
// @ApiImplicitParam(name = "businessId", value = "用户id", required = true, dataType = "varchar", paramType = "path")
// @PostMapping(value = "/delete")
// public Result roleDelete(CurUser curUser, @Valid String businessId, BindingResult br) {
// int line = userServiceImpl.removeUser(businessId);
// return Result.builder(new PersistModel(line),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// businessId);
// }
@ApiOperation(value = "704 停用用户", notes = "停用用户")
@ApiImplicitParam(name = "businessId", value = "用户Id(批量操作时 id用,隔开)", required = true, dataType = "varchar", paramType = "path")
......
......@@ -3,6 +3,7 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.entity.UserRole;
import org.springframework.stereotype.Repository;
......@@ -15,8 +16,7 @@ import java.util.List;
@Repository
public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("<script>select su.* ,sr.role_name as role_name from s_user as su " +
@Select("<script>select su.* ,sr.role_name 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 " +
"where su.del_flag = 0" +
......@@ -24,7 +24,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"<if test=\"roleName!=null and roleName != ''\"> and sr.role_name = #{roleName}</if>" +
"<if test=\"flag!=null and flag != ''\"> and su.flag = #{flag}</if></script>")
@ResultMap(value = "BaseResultMap")
List<SysUser> queryUsers(SysUser sysUser);
List<SysUser> queryUsers(QuerySysUserDTO dto);
@Select("<script>SELECT sr.role_name 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 " +
"WHERE su.del_flag = 0 " +
"AND su.business_id = #{businessId}</script>")
List<String> queryRoleByUserId(@Param("businessId") String businessId);
@Update("<script> update s_user set flag = '1' where business_id in" +
"<foreach item='item' index='index' collection='businessId' open='(' separator=',' close=')'> #{item} </foreach> " +
......
package org.rcisoft.sys.user.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@Data
public class QuerySysUserDTO {
@ApiModelProperty(value = "用户名(模糊查询条件)")
private String name;
@ApiModelProperty(value = "用户启用状态 0未启用 1启用")
private String flag;
@ApiModelProperty(value = "用户角色")
private String roleName;
@ApiModelProperty(value = "部门(暂时不用)")
private String dept;
}
......@@ -55,9 +55,6 @@ public class SysUser extends IdEntity<SysUser> {
@Transient
private String roleId;
@Transient
private String roleName;
@Transient
private String agencyName;
......
......@@ -6,6 +6,7 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.menu.entity.SysMenu;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.entity.SysUser;
import java.util.List;
......@@ -18,7 +19,7 @@ public interface SysUserService {
String checkPassword(String userId);
List<SysUser> queryUsersByPagination(PageUtil pageUtil, SysUser sysUser);
List<SysUser> queryUsersByPagination(PageUtil pageUtil, QuerySysUserDTO dto);
int removeUser(String id);
......
......@@ -10,6 +10,7 @@ import org.rcisoft.sys.menu.dao.SysMenuRepository;
import org.rcisoft.sys.menu.entity.SysMenu;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.entity.UserRole;
import org.rcisoft.sys.user.service.SysUserService;
......@@ -39,8 +40,8 @@ public class SysUserServiceImpl implements SysUserService {
private Global global;
@Override
public List<SysUser> queryUsersByPagination(PageUtil pageUtil, SysUser sysUser) {
return sysUserMapper.queryUsers(sysUser);
public List<SysUser> queryUsersByPagination(PageUtil pageUtil, QuerySysUserDTO dto) {
return sysUserMapper.queryUsers(dto);
}
@Override
......
......@@ -14,7 +14,7 @@ server:
druid:
# url: jdbc:mysql://127.0.0.1:3306/edu_db0917?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
#url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: root
......
......@@ -24,4 +24,12 @@
<resultMap id="ChildListResultMap" type="org.rcisoft.business.bcourse.dto.QueryCourseResDTO" extends="BaseResultMapDTO">
<association column="business_id" property="childList" select="org.rcisoft.business.bcourse.dao.BCourseRepository.queryCoursesByPid"></association>
</resultMap>
<resultMap id="AllCourseResultMap" type="org.rcisoft.business.bcourse.dto.AllCourseDTO">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="c_name" jdbcType="VARCHAR" property="cName"/>
<result column="pid" jdbcType="VARCHAR" property="pid"/>
<result column="course_level" jdbcType="VARCHAR" property="courseLevel"/>
</resultMap>
</mapper>
\ No newline at end of file
......@@ -17,7 +17,11 @@
<result column="FLAG" property="flag" jdbcType="VARCHAR" />
<result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
<!-- <result column="role_name" property="roleName" jdbcType="VARCHAR" />-->
<collection property="roleList" ofType="org.rcisoft.sys.user.entity.SysUser"
javaType="java.util.ArrayList" select="org.rcisoft.sys.user.dao.SysUserMapper.queryRoleByUserId"
column="business_id">
</collection>
</resultMap>
<select id="selectByTeacherCode" parameterType="java.util.List" resultMap="BaseResultMap">
......
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