package com.education.business.service.education.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.education.model.entity.HomeworkGoalInfo;
import com.education.business.service.education.HomeworkGoalInfoService;
import com.education.business.mapper.education.HomeworkGoalInfoMapper;
import org.springframework.stereotype.Service;

/**
* @author harri
* @description 针对表【homework_goal_info(作业与导向目标关联表)】的数据库操作Service实现
* @createDate 2025-07-15 20:01:51
*/
public class HomeworkGoalInfoServiceImpl extends ServiceImpl<HomeworkGoalInfoMapper, HomeworkGoalInfo>
 {
    public boolean removeHomeworkGoalInfo(Integer homeworkInfoId, Integer goalInfoId) {
        //todo select homework goal info and delete it
        Wrapper<HomeworkGoalInfo> queryWrapper = Wrappers.lambdaQuery(HomeworkGoalInfo.class)
                .eq(HomeworkGoalInfo::getHomeworkInfoId, homeworkInfoId)
                .eq(HomeworkGoalInfo::getGoalInfoId, goalInfoId);
        HomeworkGoalInfo homeworkGoalInfo = baseMapper.selectOne(queryWrapper);
        if (homeworkGoalInfo != null){
            super.removeById(homeworkGoalInfo.getId());
        }
        return true;
    }
}




