Commit 16a4119b authored by YangZhaoJun1's avatar YangZhaoJun1

接口修改

parent 11a661e7
...@@ -162,6 +162,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -162,6 +162,7 @@ public class BLessonController extends PaginationController<BLesson> {
@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 = "directionId", value = "课程方向ID", 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 = "/queryBLessonsByPagination") @GetMapping(value = "/queryBLessonsByPagination")
......
...@@ -24,13 +24,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -24,13 +24,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @param param * @param param
* @return * @return
*/ */
@Select("<script>select b.*, bd.name as directionName, bd.business_id as directionId, bd.code as directionCode " + @Select("<script>select b.*, bd.name as directionName, bd.business_id as directionId, bd.code as directionCode," +
"IFNULL((SELECT SUM(bc.class_hour) from b_chapter bc where bc.lesson_id = b.business_id),0) as chapterClassHour " +
"from b_lesson b " + "from b_lesson b " +
"left join b_lesson_direction bld on bld.lession_id = b.business_id " + "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 "+ "left join b_direction bd on bd.business_id = bld.direction_id "+
"where b.del_flag != 1 and b.flag = 1 " + "where b.del_flag != 1 and b.flag = 1 " +
"<if test=\"name!=null\">and b.`lesson_name` like #{name}</if>"+ "<if test=\"name!=null and name != ''\">and b.`lesson_name` like #{name}</if>"+
"<if test=\"code!=null\">and b.`code` like #{code}</if></script>") "<if test=\"directionId!=null and directionId != ''\">and bld.directionId = #{directionId}</if>"+
"<if test=\"code!=null and code != ''\">and b.`code` like #{code}</if></script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryBLessons(Map<String, Object> param); List<BLesson> queryBLessons(Map<String, Object> param);
...@@ -41,9 +43,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -41,9 +43,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
BLesson queryBLessonByCode(String code); BLesson queryBLessonByCode(String code);
@Insert("<script>INSERT INTO b_lesson" + @Insert("<script>INSERT INTO b_lesson" +
"(create_date,update_date,del_flag,flag,business_id,code,lesson_name,default_url,create_by)VALUES" + "(create_date,update_date,del_flag,flag,business_id,code,lesson_name,default_url,create_by,class_hour,credits)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" + "<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"( #{item.createDate},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code},#{item.lessonName},#{item.defaultUrl},#{item.createBy})" + "( #{item.createDate},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code},#{item.lessonName},#{item.defaultUrl},#{item.createBy},#{item.classHour},#{item.credits})" +
"</foreach></script>") "</foreach></script>")
int insertList(List<BLesson> bLessons); int insertList(List<BLesson> bLessons);
......
...@@ -42,6 +42,9 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -42,6 +42,9 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String directionCode;//课程方向编号 private String directionCode;//课程方向编号
@Transient
private String chapterClassHour;//目前已添加总学时
public BLesson(String code) { public BLesson(String code) {
this.code = code; this.code = code;
} }
......
...@@ -107,7 +107,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -107,7 +107,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> errorCode = new ArrayList<>(); List<String> errorCode = new ArrayList<>();
ArrayList<String> direction = new ArrayList<String>(); ArrayList<String> direction = new ArrayList<String>();
String[] headers = {"课程编号","课程名称","课程方向","课时","学分"}; String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据
......
...@@ -208,6 +208,7 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -208,6 +208,7 @@ public class BTeacherServiceImpl implements BTeacherService {
BTeacher teacher = bTeacherRepository.selectOne(bTeacher); BTeacher teacher = bTeacherRepository.selectOne(bTeacher);
UserUtil.setCurrentMergeOperation(bTeacher); UserUtil.setCurrentMergeOperation(bTeacher);
sysUserMapper.deleteByCode(teacher.getCode()); sysUserMapper.deleteByCode(teacher.getCode());
bTeacher.setDeleted();
int line = bTeacherRepository.logicalDelete(bTeacher); int line = bTeacherRepository.logicalDelete(bTeacher);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
......
...@@ -74,7 +74,7 @@ public class TQuestionController extends PaginationController<TQuestion> { ...@@ -74,7 +74,7 @@ public class TQuestionController extends PaginationController<TQuestion> {
} }
@ApiOperation(value="批量删除", notes="根据ID批量删除") @ApiOperation(value="批量删除", notes="根据ID批量删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id数组", value = "businessId数组", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "idInfoList", value = "businessId数组", required = true, dataType = "varchar")})
@PostMapping("/removeByIds") @PostMapping("/removeByIds")
@PreAuthorize("hasRole('ROLE_1002')") @PreAuthorize("hasRole('ROLE_1002')")
public Result deletes( String idInfoList ) { public Result deletes( String idInfoList ) {
...@@ -97,12 +97,11 @@ public class TQuestionController extends PaginationController<TQuestion> { ...@@ -97,12 +97,11 @@ public class TQuestionController extends PaginationController<TQuestion> {
@PostMapping("/update") @PostMapping("/update")
@PreAuthorize("hasRole('ROLE_1002')") @PreAuthorize("hasRole('ROLE_1002')")
public Result update(TQuestion tQuestion) { public Result update(TQuestion tQuestion) {
tQuestion.setToken(getToken());
PersistModel data = tQuestionServiceImpl.merge(tQuestion); PersistModel data = tQuestionServiceImpl.merge(tQuestion);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
tQuestion); tQuestion);
} }
@ApiOperation(value="唯一查找", notes="根据ID查找一条记录") @ApiOperation(value="唯一查找", notes="根据ID查找一条记录")
...@@ -128,7 +127,9 @@ public class TQuestionController extends PaginationController<TQuestion> { ...@@ -128,7 +127,9 @@ public class TQuestionController extends PaginationController<TQuestion> {
} }
@ApiOperation(value="根据条件查询(不分页)", notes="根据URL中的参数查询全部") @ApiOperation(value="根据条件查询(不分页)", notes="根据URL中的参数查询全部")
@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar") @ApiImplicitParams({@ApiImplicitParam(name = "slId", value = "课程ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "qtype", value = "题型", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "qtitle", value = "题干关键字", required = false, dataType = "varchar")})
@GetMapping(value = "/queryTQuestions") @GetMapping(value = "/queryTQuestions")
@PreAuthorize("hasRole('ROLE_1002')") @PreAuthorize("hasRole('ROLE_1002')")
public Result queryTQuestion(TQuestion tQuestion) { public Result queryTQuestion(TQuestion tQuestion) {
......
...@@ -25,7 +25,7 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> { ...@@ -25,7 +25,7 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> {
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> " + "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "<if test=\"qtype != null and qtype != '' \">and qtype = #{qtype} </if>" + "<if test=\"qtype != null and qtype != '' \">and qtype = #{qtype} </if>"
+ "<if test=\"qtitle != null and qtitle != '' \">and qtitle LIKE CONCAT ('%',#{qtitle},'%')</if>" + "<if test=\"qtitle != null and qtitle != '' \">and qtitle LIKE CONCAT ('%',#{qtitle},'%')</if>"
+ "</script>") + "order by update_date desc</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<TQuestion> queryTQuestions(TQuestion tQuestion); List<TQuestion> queryTQuestions(TQuestion tQuestion);
......
...@@ -99,8 +99,8 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -99,8 +99,8 @@ public class TQuestionServiceImpl implements TQuestionService {
public PersistModel merge(TQuestion tQuestion){ public PersistModel merge(TQuestion tQuestion){
UserUtil.setCurrentMergeOperation(tQuestion); UserUtil.setCurrentMergeOperation(tQuestion);
int line = tQuestionRepository.updateByPrimaryKeySelective(tQuestion); int line = tQuestionRepository.updateByPrimaryKeySelective(tQuestion);
log.info(UserUtil.getUserInfoProp(tQuestion.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+ /*log.info(UserUtil.getUserInfoProp(tQuestion.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
tQuestion.getBusinessId()+"的信息"); tQuestion.getBusinessId()+"的信息");*/
return new PersistModel(line); return new PersistModel(line);
} }
...@@ -126,6 +126,8 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -126,6 +126,8 @@ public class TQuestionServiceImpl implements TQuestionService {
@Override @Override
public List<TQuestion> queryTQuestions(TQuestion tQuestion) { public List<TQuestion> queryTQuestions(TQuestion tQuestion) {
tQuestion.setStart();
tQuestion.setNotDeleted();
List<TQuestion> questions = tQuestionRepository.queryTQuestions(tQuestion); List<TQuestion> questions = tQuestionRepository.queryTQuestions(tQuestion);
if(questions.size()>0){ if(questions.size()>0){
for(TQuestion question : questions) { for(TQuestion question : questions) {
......
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