
package com.jeelowcode.module.biz.service.impl;

import com.jeelowcode.core.framework.service.IFrameSqlService;
import com.jeelowcode.framework.plus.SqlHelper;
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
import com.jeelowcode.module.biz.service.IDrillPlanService;
import com.jeelowcode.module.biz.service.IExamPlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * demo
 */
@Slf4j
@Service
public class ExamPlanServiceImpl implements IExamPlanService {


    @Autowired
    private IFrameSqlService sqlService;

    @Override
    public Map<String, Object> getExamPlanById(long id) {
        SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
        wrapper.setTableName("lc_exam_plan");
        wrapper.setWhere(where->{
            where.eq("id",id);
        });
        Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
        return dataMap;
    }

    @Override
    public Map<String, Object> getExamTaskById(long id) {
        SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
        wrapper.setTableName("lc_exam_record");
        wrapper.setWhere(where->{
            where.eq("id",id);
        });
        Map<String, Object> dataMap = sqlService.getDataOneByPlus(wrapper);
        return dataMap;
    }

    @Override
    public List<Map<String, Object>> getExamTaskByPlanId(Long examPlanId) {
        SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
        wrapper.setTableName("lc_exam_record");
        wrapper.setWhere(where->{
            where.eq("examId",examPlanId);
            where.eq("is_deleted",0);
        });
        List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
        return dataMapList;
    }


}
