package com.yida.data.form.apply.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.dto.apply.ApplyFormFillSelectPageDTO;
import com.yida.data.customForm.vo.apply.ApplyFormFillSelectPageVO;
import com.yida.data.customForm.vo.apply.ApplyFormSelectPageVO;
import com.yida.data.form.apply.mapper.CoreApplyFormFillUserMapper;
import com.yida.data.form.apply.service.CoreApplyFormFillUserService;
import com.yida.data.common.core.entity.applyForm.CoreApplyFormFillUser;
import com.yida.data.customForm.dto.apply.H5ApplyFormSelectPageDTO;
import com.yida.data.customForm.vo.apply.MyApplyFormPageVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 申请表单填报用户信息表 Service
 *
 * @author ZYJ
 * @date 2023/11/22
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class CoreApplyFormFillUserServiceImpl extends ServiceImpl<CoreApplyFormFillUserMapper, CoreApplyFormFillUser>
        implements CoreApplyFormFillUserService {

    @Override
    public IPage<MyApplyFormPageVO> selectUserFillForm(H5ApplyFormSelectPageDTO dto, List<Long> userIds) {
        return baseMapper.selectUserFillForm(dto.toPage(), dto, userIds);
    }

    @Override
    public IPage<ApplyFormFillSelectPageVO> listApplyFormFillPage(ApplyFormFillSelectPageDTO dto) {
        // TODO: 2023/12/7 此处暂时只有学校角色
        dto.setDeptId(FebsUtil.getDeptId());
        IPage<ApplyFormFillSelectPageVO> page = baseMapper.listApplyFormFillPage(dto.toPage(), dto);
        page.getRecords().forEach(vo -> {
            // 处理部门数据
        });
        return page;
    }
}
