ExerciseCourseTreeMappingServiceImpl.java 1.65 KB
package com.meishu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.meishu.dto.exercise.QueryCourseTreeExerciseDTO;
import com.meishu.dto.exercise.UpdateStatusDTO;
import com.meishu.model.CourseTreeDO;
import com.meishu.model.ExerciseCourseTreeMappingDO;
import com.meishu.mapper.ExerciseCourseTreeMappingMapper;
import com.meishu.service.ExerciseCourseTreeMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.meishu.util.ConstantUtils;
import com.meishu.vo.exercise.QueryCourseTreeExerciseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 课程知识树--题目字典表 服务实现类
 * </p>
 *
 * @author Tuyp
 * @since 2021-05-24
 */
@Service
public class ExerciseCourseTreeMappingServiceImpl extends ServiceImpl<ExerciseCourseTreeMappingMapper, ExerciseCourseTreeMappingDO> implements ExerciseCourseTreeMappingService {

    @Autowired
    private ExerciseCourseTreeMappingMapper exerciseCourseTreeMappingMapper;

    public String updateStatus(UpdateStatusDTO updateStatusDTO){

        List<Long> ids = updateStatusDTO.getIds();
        for (Long lg : ids){
            ExerciseCourseTreeMappingDO exerciseCourseTreeMappingDO = this.baseMapper.selectById(lg);
            exerciseCourseTreeMappingDO.setStatus(updateStatusDTO.getStatus());
            this.baseMapper.updateById(exerciseCourseTreeMappingDO);
        }
        return ConstantUtils.SET_SUCCESS;
    }

}