Commit e0e7c1d7 authored by YangZhaoJun1's avatar YangZhaoJun1

2.0

parent 8210a1c5
...@@ -435,4 +435,29 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -435,4 +435,29 @@ public class BChapterController extends PaginationController<BChapter> {
port = 8000 + random.nextInt(1000);*/ port = 8000 + random.nextInt(1000);*/
return port.toString(); return port.toString();
} }
@ApiOperation(value="更改章节状态", notes="根据章节ID更改章节状态")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "pid", value = "父节点ID", required = true, dataType = "varchar")})
@PostMapping(value = "/updateChapterState")
public Result updateChapterState(BChapter bChapter){
int data = bChapterService.updateChapterState(bChapter);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bChapter);
}
@ApiOperation(value="更改章节状态", notes="根据开课ID更改章节状态")
@ApiImplicitParam(name = "slId", value = "开课ID", required = true, dataType = "varchar")
@PostMapping(value = "/updateAllChapterState")
public Result updateAllChapterState(String slId){
int data = bChapterService.updateAllChapterState(slId);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
slId);
}
} }
...@@ -168,5 +168,24 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -168,5 +168,24 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"where del_flag = 0 and flag = 1 " + "where del_flag = 0 and flag = 1 " +
"and business_id = #{pid}</script>") "and business_id = #{pid}</script>")
String selectChapterNameByPid(String pid); String selectChapterNameByPid(String pid);
@Select("<script>select state from b_chapter " +
"where del_flag = 0 and flag = 1 " +
"and business_id = #{businessId}</script>")
String selectStateById(String businessId);
@Update("<script>update b_chapter set state = #{state} where business_id = #{businessId}</script>")
int updateStateById(BChapter bChapter);
@Update("<script>update b_chapter set state = #{state} where pid = #{businessId}</script>")
int updateStateByPid(BChapter bChapter);
@Select("<script>select DISTINCT state from b_chapter " +
"where del_flag = 0 and flag = 1 " +
"and sl_id = #{slId}</script>")
List<String> selectStateBySlId(String slId);
@Update("<script>update b_chapter set state = #{state} where sl_id = #{slId}</script>")
int updateAllStateBySlId(@Param("slId") String slId, @Param("state") String state);
} }
...@@ -50,8 +50,13 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -50,8 +50,13 @@ public class BChapter extends IdEntity<BChapter> {
/*课程或开课 0:开课 1:课程*/ /*课程或开课 0:开课 1:课程*/
private String lessonOrSl; private String lessonOrSl;
/*状态 0关闭 1开启*/
private String state;
/*课程ID*/ /*课程ID*/
private String lessonId; private String lessonId;
private String classHour;
@Transient @Transient
private List<BChapterRepository> childList; private List<BChapterRepository> childList;
......
package org.rcisoft.business.bchapter.enums;
import lombok.Getter;
/**
* Created by Administrator on 2017/12/20.
*/
@Getter
public enum StateEnum {
OPEN("1"),
CLOSE("0"),
;
StateEnum(String code) {
this.code = code;
}
private String code;
}
...@@ -93,4 +93,8 @@ public interface BChapterService{ ...@@ -93,4 +93,8 @@ public interface BChapterService{
void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token); void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token);
int addBslFormLesson(String bLseeonId, String lessonCode, String businessId); int addBslFormLesson(String bLseeonId, String lessonCode, String businessId);
int updateChapterState(BChapter bChapter);
int updateAllChapterState(String slId);
} }
package org.rcisoft.business.bchapter.service.impl; package org.rcisoft.business.bchapter.service.impl;
import com.sun.org.apache.xerces.internal.xs.datatypes.ObjectList;
import org.rcisoft.business.bchapter.dao.BChapterRepository; import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.dto.QueryScoreListDTO; import org.rcisoft.business.bchapter.dto.QueryScoreListDTO;
import org.rcisoft.business.bchapter.dto.ScoreInfoDTO; import org.rcisoft.business.bchapter.dto.ScoreInfoDTO;
...@@ -7,6 +8,7 @@ import org.rcisoft.business.bchapter.dto.StuScoreDTO; ...@@ -7,6 +8,7 @@ import org.rcisoft.business.bchapter.dto.StuScoreDTO;
import org.rcisoft.business.bchapter.entity.BChapter; import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bchapter.enums.ChapterLevelEnum; import org.rcisoft.business.bchapter.enums.ChapterLevelEnum;
import org.rcisoft.business.bchapter.enums.HasMarkEnum; import org.rcisoft.business.bchapter.enums.HasMarkEnum;
import org.rcisoft.business.bchapter.enums.StateEnum;
import org.rcisoft.business.bchapter.service.BChapterService; import org.rcisoft.business.bchapter.service.BChapterService;
import org.rcisoft.business.bchapter.vo.StudentChapterScoreVO; import org.rcisoft.business.bchapter.vo.StudentChapterScoreVO;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
...@@ -194,6 +196,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -194,6 +196,8 @@ public class BChapterServiceImpl implements BChapterService {
sl_chapter.setChapterUrl(lessonList.get(i).getChapterUrl()); sl_chapter.setChapterUrl(lessonList.get(i).getChapterUrl());
sl_chapter.setMdFile(lessonList.get(i).getMdFile()); sl_chapter.setMdFile(lessonList.get(i).getMdFile());
sl_chapter.setIsTest(lessonList.get(i).getIsTest()); sl_chapter.setIsTest(lessonList.get(i).getIsTest());
sl_chapter.setClassHour(lessonList.get(i).getClassHour());
sl_chapter.setState(StateEnum.CLOSE.getCode());
sl_chapter.setLessonOrSl("0"); sl_chapter.setLessonOrSl("0");
UserUtil.setCurrentPersistOperation(sl_chapter); UserUtil.setCurrentPersistOperation(sl_chapter);
if(lessonList.get(i).getPid().equals("-1")){ if(lessonList.get(i).getPid().equals("-1")){
...@@ -212,4 +216,29 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -212,4 +216,29 @@ public class BChapterServiceImpl implements BChapterService {
} }
return bChapterRepository.insertChapterList(chapterList); return bChapterRepository.insertChapterList(chapterList);
} }
@Override
public int updateChapterState(BChapter bChapter) {
String state = bChapterRepository.selectStateById(bChapter.getBusinessId());
bChapter.setState(StateEnum.OPEN.getCode());
if(state.equals(StateEnum.OPEN.getCode())){
bChapter.setState(StateEnum.CLOSE.getCode());
}
int result = bChapterRepository.updateStateById(bChapter);
if(bChapter.getPid().equals("-1")){
result=bChapterRepository.updateStateByPid(bChapter);
}
return result;
}
@Override
public int updateAllChapterState(String slId) {
List<String> list = bChapterRepository.selectStateBySlId(slId);
String state = StateEnum.OPEN.getCode();
if (list.size() == 1 && list.get(0).equals(state)) {
state = StateEnum.CLOSE.getCode();
}
int result = bChapterRepository.updateAllStateBySlId(slId, state);
return result;
}
} }
package org.rcisoft.business.bdirection.controller;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.bdirection.entity.BDirection;
import org.rcisoft.business.bdirection.service.BDirectionService;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by on 2017-12-19 13:45:42.
*/
@RestController
@RequestMapping("/BDirection")
public class BDirectionController extends PaginationController<BDirection> {
@Autowired
private BDirectionService bDirectionService;
@ApiOperation(value="添加/编辑课程方向", notes="businessId为空时是添加方法,不为空时是修改方法")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "编号", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "名称", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
@PreAuthorize("hasRole('ROLE_1001')")
public Result add(BDirection bDirection) {
PersistModel data = bDirectionService.persist(bDirection);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDirection);
}
@ApiOperation(value="删除课程方向", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/remove")
@PreAuthorize("hasRole('ROLE_1001')")
public Result remove(String id) {
PersistModel data = bDirectionService.removeDirection(id);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="唯一查找", notes="根据ID查找一条记录")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@GetMapping("/one")
public Result queryOne(String businessId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDirectionService.selectOne(businessId));
}
@ApiOperation(value="根据条件分页查询", notes="根据URL中的参数分页查询")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "remarks", value = "备注", required = false, dataType = "varchar")})
@GetMapping("/queryBLessonDirectionsByPagination")
public GridModel queryBLessonDirectionsByPagination(BDirection param) {
param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bDirectionService.queryDirectionsByPagination(getPaginationUtility(),param);
GridModel gridModel = getGridModelResponse();
return gridModel;
}
@ApiOperation(value="根据条件查询", notes="根据URL中的参数查询全部")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "编号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "varchar")})
@GetMapping("/queryBLessonDirections")
public Result queryBLessonDirections(BDirection param) {
param.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDirectionService.queryDirections(param));
}
}
package org.rcisoft.business.bdirection.dao;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.bdirection.entity.BDirection;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* Created with on 2017-12-19 13:45:42.
*/
@Repository
public interface BDirectionRepository extends BaseMapper<BDirection> {
@Select("<script>select * from b_direction where 1=1 " +
"<if test=\"name!=null and name != ''\">\n" +
" AND name LIKE CONCAT('%',#{name},'%')\n" +
"</if>\n" +
"<if test=\"code!=null and code != ''\">\n" +
" AND code LIKE CONCAT('%',#{code},'%')\n" +
"</if></script>")
@ResultMap(value = "BaseResultMap" )
List<BDirection> queryDirections(BDirection param);
@Select("<script>select * from b_direction where code = #{code}</script>")
@ResultMap(value = "BaseResultMap")
BDirection queryBLessonByCode(String code);
@Select("<script>select count(*) from b_lesson_direction where direction_id = #{id}</script>")
int selectslNumById(String id);
}
package org.rcisoft.business.bdirection.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* Created with on 2017-12-19 13:45:42.
*/
@Entity
@Table(name = "b_direction")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BDirection extends IdEntity<BDirection> {
private static final long serialVersionUID = -7918359689093194816L;
private String code;
private String name;
}
package org.rcisoft.business.bdirection.service;
import org.rcisoft.business.bdirection.entity.BDirection;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import java.util.List;
/**
* Created by on 2017-12-19 13:45:42.
*/
public interface BDirectionService {
/**
* 根据bLesson对象查询
*/
BDirection selectOne(String businessId);
/**
* 根据条件分页查找
* @param pageUtil
* @param model
* @return
*/
List<BDirection> queryDirectionsByPagination(PageUtil pageUtil, BDirection model);
/**
* 根据条件查找全部
* @param model
* @return
*/
List<BDirection> queryDirections(BDirection model);
/**
* 插入/修改
* @param model
* @return
*/
PersistModel persist(BDirection model);
/**
* 逻辑删除
* @param id
* @return
*/
PersistModel removeDirection(String id);
}
package org.rcisoft.business.bdirection.service.impl;
import org.rcisoft.business.bdirection.dao.BDirectionRepository;
import org.rcisoft.business.bdirection.entity.BDirection;
import org.rcisoft.business.bdirection.service.BDirectionService;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by on 2017-12-19 13:45:42.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
public class BDirectionServiceImpl implements BDirectionService {
@Autowired
private BDirectionRepository bDirectionRepository;
@Override
public BDirection selectOne(String businessId){
return bDirectionRepository.selectByPrimaryKey(businessId);
}
@Override
public List<BDirection> queryDirectionsByPagination(PageUtil pageUtil, BDirection model) {
return bDirectionRepository.queryDirections(model);
}
@Override
public List<BDirection> queryDirections(BDirection model) {
return bDirectionRepository.queryDirections(model);
}
@Override
public PersistModel persist(BDirection model){
int line = 0;
if(model.getBusinessId()==null) {
if (bDirectionRepository.queryBLessonByCode(model.getCode()) != null)
throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
UserUtil.setCurrentPersistOperation(model);
line = bDirectionRepository.insertSelective(model);
}else
UserUtil.setCurrentMergeOperation(model);
line = bDirectionRepository.updateByPrimaryKeySelective(model);
return new PersistModel(line);
}
@Override
public PersistModel removeDirection(String id) {
if(bDirectionRepository.selectslNumById(id)>0) {
throw new ServiceException(ResultServiceEnums.DIRECTION_IS_USED);
}
int line = bDirectionRepository.deleteByPrimaryKey(id);
return new PersistModel(line);
}
}
...@@ -3,7 +3,9 @@ package org.rcisoft.business.blesson.dao; ...@@ -3,7 +3,9 @@ package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
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.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonDirection;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -22,7 +24,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -22,7 +24,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @param param * @param param
* @return * @return
*/ */
@Select("<script>select * from b_lesson b "+ @Select("<script>select b.*, bd.name as directionName from b_lesson b " +
"left join b_lesson_direction bld on bld.lession_id = b.business_id " +
"left join b_direction bd on bd.business_id = bld.direction_id "+
"where b.del_flag != 1" + "where b.del_flag != 1" +
"<if test=\"name!=null\">and b.`lesson_name` like #{name}</if>"+ "<if test=\"name!=null\">and b.`lesson_name` like #{name}</if>"+
"<if test=\"code!=null\">and b.`code` like #{code}</if></script>") "<if test=\"code!=null\">and b.`code` like #{code}</if></script>")
...@@ -40,5 +44,14 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -40,5 +44,14 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</foreach></script>") "</foreach></script>")
int insertList(List<BLesson> bLessons); int insertList(List<BLesson> bLessons);
@Insert("<script>INSERT INTO b_lesson_direction (business_id,lession_id,direction_id,sl_id) VALUES " +
"(#{businessId},#{lessionId},#{directionId},#{slId})</script>")
int insertLessonDirection(BLessonDirection model);
@Update("<script>update b_lesson_direction set direction_id = #{directionId} where lession_id = #{lessionId}</script>")
int updateDirectionByLessonId(BLessonDirection direction);
@Update("<script>update b_lesson_direction set direction_id = #{directionId} where sl_id = #{slId}</script>")
int updateDirectionBySlId(BLessonDirection direction);
} }
...@@ -8,6 +8,7 @@ import org.rcisoft.core.entity.IdEntity; ...@@ -8,6 +8,7 @@ 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 java.util.Date; import java.util.Date;
/** /**
...@@ -29,6 +30,16 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -29,6 +30,16 @@ public class BLesson extends IdEntity<BLesson> {
/*默认封面图片url*/ /*默认封面图片url*/
private String defaultUrl; private String defaultUrl;
private String classHour;//课时
private String credits;//学分
@Transient
private String directionId;//课程方向ID
@Transient
private String directionName;//课程方向名称
public BLesson(String code) { public BLesson(String code) {
this.code = code; this.code = code;
} }
......
package org.rcisoft.business.blesson.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* Created by Administrator on 2017/12/20.
*/
@Entity
@Table(name = "b_lesson_direction")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BLessonDirection {
private String businessId;
private String lessionId;
private String directionId;
private String slId;
}
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
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.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonDirection;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.bsl.dao.BSlRepository; import org.rcisoft.business.bsl.dao.BSlRepository;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
...@@ -13,6 +14,7 @@ import org.rcisoft.core.exception.ServiceException; ...@@ -13,6 +14,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -71,16 +73,25 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -71,16 +73,25 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BLesson model,String token){ public PersistModel persist(BLesson model,String token){
int line = 0; int line = 0;
BLessonDirection direction = new BLessonDirection();
direction.setDirectionId(model.getDirectionId());
if(model.getBusinessId()==null) { if(model.getBusinessId()==null) {
if (bLessonRepository.queryBLessonByCode(model.getCode()) != null) if (bLessonRepository.queryBLessonByCode(model.getCode()) != null)
throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST); throw new ServiceException(ResultServiceEnums.INSERT_DATA_EXIST);
model.setCommonBusinessId();
model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
line = bLessonRepository.insertSelective(model); line = bLessonRepository.insertSelective(model);
}else
//添加课程方向信息
direction.setBusinessId(IdGen.uuid());
direction.setLessionId(model.getBusinessId());
bLessonRepository.insertLessonDirection(direction);
}else {
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bLessonRepository.updateByPrimaryKeySelective(model); line = bLessonRepository.updateByPrimaryKeySelective(model);
direction.setLessionId(model.getBusinessId());
bLessonRepository.updateDirectionByLessonId(direction);
}
//FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户"); //FamilyLogger.sysInfo(UserUtils.getUser().getBusinessId(),UserUtils.getUser().getLoginName()+"新增了ID为"+user.getBusinessId()+"的用户");
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -312,4 +312,21 @@ public class BSlController extends PaginationController<BSl> { ...@@ -312,4 +312,21 @@ public class BSlController extends PaginationController<BSl> {
} }
@ApiOperation(value="根据 学号/工号 分页获取 历史学习课程/历史授课", notes="传学号代表查学生历史学习,传教师工号代表查教师历史授课,不能同时传")
@ApiImplicitParams({@ApiImplicitParam(name = "lessonName", value = "课程名称关键字", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "term", value = "学期名称关键字", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "studentCode", value = "学生学号", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "teacherCode", value = "教师工号", required = false, dataType = "varchar")})
@GetMapping(value = "/historySlByCode")
public GridModel historySlByCode(String lessonName,String term,String studentCode,String teacherCode) {
if((studentCode!=null&&!studentCode.equals(""))&&(teacherCode!=null&&!studentCode.equals(""))){
throw new ServiceException(ResultServiceEnums.PARAMER_ERROR);
}
bSlService.historySlByCodeByPagination(getPaginationUtility(),lessonName,term,studentCode,teacherCode);
GridModel gridModel = getGridModelResponse();
return gridModel;
}
} }
...@@ -21,9 +21,11 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -21,9 +21,11 @@ public interface BSlRepository extends BaseMapper<BSl> {
* @param param * @param param
* @return * @return
*/ */
@Select("<script>SELECT sl.business_id,sl.code,sl.lesson_code,lesson.lesson_name as lessonName,sl.teacher_code,u.name as teacherName,sl.is_online as isOnline,sl.sl_cover_url,sl.sl_notes,sl.is_recommend,sl.recommend_date,sl.recommend_order,sl.recommend_course FROM b_sl sl\n" + @Select("<script>SELECT bd.name as directionName,sl.business_id,sl.code,sl.lesson_code,lesson.lesson_name as lessonName,sl.teacher_code,u.name as teacherName,sl.is_online as isOnline,sl.sl_cover_url,sl.sl_notes,sl.is_recommend,sl.recommend_date,sl.recommend_order,sl.recommend_course FROM b_sl sl\n" +
"LEFT JOIN b_lesson lesson ON sl.lesson_code=lesson.code \n" + "LEFT JOIN b_lesson lesson ON sl.lesson_code=lesson.code \n" +
"LEFT JOIN s_user u ON sl.teacher_code=u.login_name \n" + "LEFT JOIN s_user u ON sl.teacher_code=u.login_name \n" +
"left join b_lesson_direction bld on bld.sl_id = sl.business_id " +
"left join b_direction bd on bd.business_id = bld.direction_id " +
" <where>" + " <where>" +
" sl.del_flag = '0' and sl.flag = '1'"+ " sl.del_flag = '0' and sl.flag = '1'"+
" <if test=\"isOnline !=NULL and isOnline !=''\">AND sl.is_online like CONCAT('%',#{isOnline},'%')</if>" + " <if test=\"isOnline !=NULL and isOnline !=''\">AND sl.is_online like CONCAT('%',#{isOnline},'%')</if>" +
...@@ -209,5 +211,28 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -209,5 +211,28 @@ public interface BSlRepository extends BaseMapper<BSl> {
@Select("<script>SELECT count(*) from b_sl where teacher_code = #{0} and business_id = #{1} </script>") @Select("<script>SELECT count(*) from b_sl where teacher_code = #{0} and business_id = #{1} </script>")
int queryBslTeacher(String teacherCode, String businessId); int queryBslTeacher(String teacherCode, String businessId);
@Select("<script>select *, bl.lesson_name as lessonName from b_sl sl left join b_r_sl_student stu on sl.code = stu.sl_code " +
"left join b_term bt on sl.term_code = bt.code " +
"left join b_lesson bl on sl.lesson_code = bl.code " +
"where sl.del_flag != '1' and sl.flag = '1' " +
"<if test=\"lessonName!=null and lessonName != ''\">" +
" AND bl.lesson_name LIKE CONCAT('%',#{lessonName},'%') " +
"</if>" +
"<if test=\"term!=null and term != ''\">" +
" AND bt.name LIKE CONCAT('%',#{term},'%') " +
"</if>" +
"<if test=\"studentCode!=null and studentCode != ''\">" +
" AND stu.student_code = #{studentCode} " +
"</if>" +
"<if test=\"teacherCode!=null and teacherCode != ''\">" +
" AND sl.teacher_code = #{teacherCode} " +
"</if>" +
"</script>")
@ResultMap(value = "BaseResultMap" )
List<BSl> historySlByCodeByPagination(@Param("lessonName") String lessonName,
@Param("term") String term,
@Param("studentCode")String studentCode,
@Param("teacherCode")String teacherCode);
} }
...@@ -21,6 +21,8 @@ import java.util.Date; ...@@ -21,6 +21,8 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
public class BSl extends IdEntity<BSl> { public class BSl extends IdEntity<BSl> {
private static final long serialVersionUID = 263672387949424361L;
public BSl(String code, String lessonCode, String teacherCode, String termCode) { public BSl(String code, String lessonCode, String teacherCode, String termCode) {
this.code = code; this.code = code;
this.lessonCode = lessonCode; this.lessonCode = lessonCode;
...@@ -51,6 +53,10 @@ public class BSl extends IdEntity<BSl> { ...@@ -51,6 +53,10 @@ public class BSl extends IdEntity<BSl> {
private String gitLabProjectName; //gitlab项目名 private String gitLabProjectName; //gitlab项目名
private String classHour;//课时
private String credits;//学分
@Transient @Transient
private String teacherName;// 教师姓名 private String teacherName;// 教师姓名
...@@ -63,6 +69,12 @@ public class BSl extends IdEntity<BSl> { ...@@ -63,6 +69,12 @@ public class BSl extends IdEntity<BSl> {
@Transient @Transient
private String studyNum;//在学人数 private String studyNum;//在学人数
@Transient
private String directionId;//课程方向ID
@Transient
private String directionName;//课程方向名称
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
......
...@@ -118,4 +118,5 @@ public interface BSlService{ ...@@ -118,4 +118,5 @@ public interface BSlService{
int queryBslTeacher(String teacherCode, String businessId); int queryBslTeacher(String teacherCode, String businessId);
List<BSl> historySlByCodeByPagination(PageUtil pageUtil, String lessonName, String term, String studentCode, String teacherCode);
} }
...@@ -7,6 +7,7 @@ import org.rcisoft.business.bchapter.entity.BChapter; ...@@ -7,6 +7,7 @@ import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bchapter.service.BChapterService; import org.rcisoft.business.bchapter.service.BChapterService;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
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.brslstudent.dao.BRSlStudentRepository; import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
import org.rcisoft.business.brslstudent.entity.BRSlStudent; import org.rcisoft.business.brslstudent.entity.BRSlStudent;
import org.rcisoft.business.bsl.dao.BSlRepository; import org.rcisoft.business.bsl.dao.BSlRepository;
...@@ -26,6 +27,7 @@ import org.rcisoft.core.exception.ServiceException; ...@@ -26,6 +27,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -85,6 +87,8 @@ public class BSlServiceImpl implements BSlService { ...@@ -85,6 +87,8 @@ public class BSlServiceImpl implements BSlService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(BSl model,String token) throws UnsupportedEncodingException { public PersistModel persist(BSl model,String token) throws UnsupportedEncodingException {
int line = 0; int line = 0;
BLessonDirection direction = new BLessonDirection();
direction.setDirectionId(model.getDirectionId());
if(model.getBusinessId()!=null){ if(model.getBusinessId()!=null){
BSl bSl = bSlRepository.selectByPrimaryKey(model.getBusinessId()); BSl bSl = bSlRepository.selectByPrimaryKey(model.getBusinessId());
if(bSl==null) if(bSl==null)
...@@ -96,6 +100,10 @@ public class BSlServiceImpl implements BSlService { ...@@ -96,6 +100,10 @@ public class BSlServiceImpl implements BSlService {
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bSlRepository.updateByPrimaryKeySelective(model); line = bSlRepository.updateByPrimaryKeySelective(model);
direction.setSlId(model.getBusinessId());
bLessonRepository.updateDirectionBySlId(direction);
} }
else { else {
String lecode = model.getLessonCode(); String lecode = model.getLessonCode();
...@@ -120,6 +128,10 @@ public class BSlServiceImpl implements BSlService { ...@@ -120,6 +128,10 @@ public class BSlServiceImpl implements BSlService {
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
int data = bSlRepository.insertSelective(model); int data = bSlRepository.insertSelective(model);
int result = bChapterService.addBslFormLesson(bLesson.getBusinessId(),model.getLessonCode(), model.getBusinessId()); int result = bChapterService.addBslFormLesson(bLesson.getBusinessId(),model.getLessonCode(), model.getBusinessId());
//添加课程方向信息
direction.setBusinessId(IdGen.uuid());
direction.setSlId(model.getBusinessId());
bLessonRepository.insertLessonDirection(direction);
if(data!=0&&result!=0){ if(data!=0&&result!=0){
line= data; line= data;
} }
...@@ -334,6 +346,11 @@ public class BSlServiceImpl implements BSlService { ...@@ -334,6 +346,11 @@ public class BSlServiceImpl implements BSlService {
return bSlRepository.queryBslTeacher(teacherCode,businessId); return bSlRepository.queryBslTeacher(teacherCode,businessId);
} }
@Override
public List<BSl> historySlByCodeByPagination(PageUtil pageUtil, String lessonName, String term, String studentCode, String teacherCode) {
return bSlRepository.historySlByCodeByPagination(lessonName,term,studentCode,teacherCode);
}
private Map<String,Object> getParames(BSl model){ private Map<String,Object> getParames(BSl model){
Map param = new HashMap<String,Object>(); Map param = new HashMap<String,Object>();
......
...@@ -111,10 +111,11 @@ public class BStudentController extends PaginationController<BStudent> { ...@@ -111,10 +111,11 @@ public class BStudentController extends PaginationController<BStudent> {
} }
@ApiOperation(value="根据条件分页查询", notes="根据开课编号分页查询学生信息") @ApiOperation(value="根据条件分页查询", notes="根据开课编号分页查询学生信息")
@ApiImplicitParam(name = "slCode", value = "开课编号", required = true, dataType = "varchar") @ApiImplicitParams({@ApiImplicitParam(name = "slCode", value = "开课编号", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "班级名称", required = false, dataType = "varchar")})
@GetMapping(value = "/queryStudentBySlCode") @GetMapping(value = "/queryStudentBySlCode")
public GridModel queryStudentBySlCode(String slCode) { public GridModel queryStudentBySlCode(String slCode, String className) {
List<BStudent> bStudents = bStudentService.queryStudentBySlByPagination(getPaginationUtility(),slCode); List<BStudent> bStudents = bStudentService.queryStudentBySlByPagination(getPaginationUtility(),slCode,className);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return gridModel; return gridModel;
} }
......
...@@ -62,15 +62,21 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -62,15 +62,21 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
List<BStudent> queryStudentByClassCode(@Param("classCode") String classCode); List<BStudent> queryStudentByClassCode(@Param("classCode") String classCode);
@Select("<script>SELECT\n" + @Select("<script>SELECT\n" +
"\tt3.`code`,t4.`name`\n" + "\tt3.*,t4.`name`,t6.class_name as className\n" +
"FROM\n" + "FROM\n" +
"b_r_sl_student t2\n" + "b_r_sl_student t2\n" +
"LEFT JOIN b_student t3 ON t2.student_code = t3.`code`\n" + "LEFT JOIN b_student t3 ON t2.student_code = t3.`code`\n" +
"LEFT JOIN s_user t4 ON t3.`code` = t4.login_name\n" + "LEFT JOIN s_user t4 ON t3.`code` = t4.login_name\n" +
"LEFT JOIN b_r_class_student t5 on t5.student_code = t3.code " +
"LEFT JOIN b_class t6 on t6.code = t5.class_code " +
"WHERE\n" + "WHERE\n" +
"\tt2.sl_code = #{slCode}</script>") "\tt2.sl_code = #{slCode}" +
"<if test=\"className!=null and className != ''\">\n" +
" AND t6.class_name LIKE CONCAT('%',#{className},'%')\n" +
"</if>" +
"order by className asc,code asc</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BStudent> queryStudentBySlCode(@Param("slCode") String slCode); List<BStudent> queryStudentBySlCode(@Param("slCode") String slCode, @Param("className") String className);
@Insert("<script>INSERT INTO b_student" + @Insert("<script>INSERT INTO b_student" +
"(create_date,update_date,create_by,update_by,remarks,del_flag,flag,business_id,code)VALUES" + "(create_date,update_date,create_by,update_by,remarks,del_flag,flag,business_id,code)VALUES" +
......
...@@ -63,5 +63,8 @@ public class BStudent extends IdEntity<BStudent> { ...@@ -63,5 +63,8 @@ public class BStudent extends IdEntity<BStudent> {
@Transient @Transient
private String headPic; private String headPic;
@Transient
private String className;
} }
...@@ -70,7 +70,7 @@ public interface BStudentService{ ...@@ -70,7 +70,7 @@ public interface BStudentService{
* @param code * @param code
* @return * @return
*/ */
List<BStudent> queryStudentBySlByPagination(PageUtil pageUtil, String code); List<BStudent> queryStudentBySlByPagination(PageUtil pageUtil, String code, String className);
/** /**
* 获取推荐学生 * 获取推荐学生
......
...@@ -266,8 +266,8 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -266,8 +266,8 @@ public class BStudentServiceImpl implements BStudentService {
} }
@Override @Override
public List<BStudent> queryStudentBySlByPagination(PageUtil pageUtil, String code) { public List<BStudent> queryStudentBySlByPagination(PageUtil pageUtil, String code, String className) {
return bStudentRepository.queryStudentBySlCode(code); return bStudentRepository.queryStudentBySlCode(code,className);
} }
@Override @Override
......
...@@ -91,7 +91,7 @@ public class BTermServiceImpl implements BTermService { ...@@ -91,7 +91,7 @@ public class BTermServiceImpl implements BTermService {
{ {
if(bTerm.get(0).getIsStart().equals(BTermEnum.UN_START.getCode())) { if(bTerm.get(0).getIsStart().equals(BTermEnum.UN_START.getCode())) {
bTerm.get(0).setIsStart(BTermEnum.START.getCode()); bTerm.get(0).setIsStart(BTermEnum.START.getCode());
bTermRepository.updateUnStart(bTerm.get(0).getBusinessId()); //bTermRepository.updateUnStart(bTerm.get(0).getBusinessId());
} }
else { else {
bTerm.get(0).setIsStart(BTermEnum.UN_START.getCode()); bTerm.get(0).setIsStart(BTermEnum.UN_START.getCode());
......
...@@ -79,6 +79,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -79,6 +79,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/auth/**").permitAll() //登录注册等请求过滤 .antMatchers("/auth/**").permitAll() //登录注册等请求过滤
.antMatchers("/code/**").permitAll() //登录注册等请求过滤 .antMatchers("/code/**").permitAll() //登录注册等请求过滤
.antMatchers("/excelUtil/**").permitAll()//excel类 .antMatchers("/excelUtil/**").permitAll()//excel类
.antMatchers("/**WithoutAuth").permitAll()
.antMatchers( .antMatchers(
"/", "/",
"/*.html", "/*.html",
......
...@@ -123,6 +123,8 @@ public enum ResultServiceEnums { ...@@ -123,6 +123,8 @@ public enum ResultServiceEnums {
TEACHER_HAS_NOT_SL(68,"教师未教这门课程,不能开始实验"), TEACHER_HAS_NOT_SL(68,"教师未教这门课程,不能开始实验"),
STUDENT_HAS_NOT_SL(69,"该学生并未选择这门课程,不能开始实验"), STUDENT_HAS_NOT_SL(69,"该学生并未选择这门课程,不能开始实验"),
DIRECTION_IS_USED(70,"该方向已被课程关联,删除失败"),
; ;
private Integer code; private Integer code;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="md_file" jdbcType="LONGVARCHAR" property="mdFile"/> <result column="md_file" jdbcType="LONGVARCHAR" property="mdFile"/>
<result column="lesson_or_sl" jdbcType="VARCHAR" property="lessonOrSl"/> <result column="lesson_or_sl" jdbcType="VARCHAR" property="lessonOrSl"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/> <result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
<result column="state" jdbcType="VARCHAR" property="state"/>
</resultMap> </resultMap>
<resultMap id="SupperChildListResultMap" type="org.rcisoft.business.bchapter.entity.BChapter" extends="BaseResultMap"> <resultMap id="SupperChildListResultMap" type="org.rcisoft.business.bchapter.entity.BChapter" extends="BaseResultMap">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.bdirection.dao.BDirectionRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bdirection.entity.BDirection">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -13,5 +13,7 @@ ...@@ -13,5 +13,7 @@
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/> <result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/> <result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/> <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="class_hour" jdbcType="VARCHAR" property="classHour"/>
<result column="credits" jdbcType="VARCHAR" property="credits"/>
</resultMap> </resultMap>
</mapper> </mapper>
\ No newline at end of file
...@@ -23,5 +23,7 @@ ...@@ -23,5 +23,7 @@
<result column="git_lab_project_name" jdbcType="VARCHAR" property="gitLabProjectName"/> <result column="git_lab_project_name" jdbcType="VARCHAR" property="gitLabProjectName"/>
<result column="sl_cover_url" jdbcType="VARCHAR" property="slCoverUrl"/> <result column="sl_cover_url" jdbcType="VARCHAR" property="slCoverUrl"/>
<result column="sl_notes" jdbcType="LONGVARCHAR" property="slNotes"/> <result column="sl_notes" jdbcType="LONGVARCHAR" property="slNotes"/>
<result column="class_hour" jdbcType="VARCHAR" property="classHour"/>
<result column="credits" jdbcType="VARCHAR" property="credits"/>
</resultMap> </resultMap>
</mapper> </mapper>
\ No newline at end of file
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