package com.njcn.rdms.module.project.dal.mysql.workreport.weekly;

import com.njcn.rdms.framework.mybatis.core.mapper.BaseMapperX;
import com.njcn.rdms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.njcn.rdms.module.project.dal.dataobject.workreport.weekly.WeeklyReportTravelSegmentDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface WeeklyReportTravelSegmentMapper extends BaseMapperX<WeeklyReportTravelSegmentDO> {

    default List<WeeklyReportTravelSegmentDO> selectListByWeeklyReportId(Long weeklyReportId) {
        return selectList(new LambdaQueryWrapperX<WeeklyReportTravelSegmentDO>()
                .eq(WeeklyReportTravelSegmentDO::getWeeklyReportId, weeklyReportId)
                .orderByAsc(WeeklyReportTravelSegmentDO::getSort)
                .orderByAsc(WeeklyReportTravelSegmentDO::getId));
    }

    default int deleteByWeeklyReportId(Long weeklyReportId) {
        return delete(new LambdaQueryWrapperX<WeeklyReportTravelSegmentDO>()
                .eq(WeeklyReportTravelSegmentDO::getWeeklyReportId, weeklyReportId));
    }
}
