package jnpf.personnels.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.model.personnels.dto.staff.field.FtbPersonnelsRegistrationFormTypeDto;
import jnpf.model.personnels.po.FtbPersonnelsRegistrationFormType;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.personnels.mapper.FtbPersonnelsRegistrationFormFieldOptionMapper;
import jnpf.model.personnels.po.FtbPersonnelsRegistrationFormFieldOption;
import jnpf.personnels.service.FtbPersonnelsRegistrationFormFieldOptionService;
@Service
public class FtbPersonnelsRegistrationFormFieldOptionServiceImpl extends ServiceImpl<FtbPersonnelsRegistrationFormFieldOptionMapper, FtbPersonnelsRegistrationFormFieldOption> implements FtbPersonnelsRegistrationFormFieldOptionService {

    @Override
    public List<FtbPersonnelsRegistrationFormFieldOption> queryOptionsByFieldId(String fieldId) {
        QueryWrapper<FtbPersonnelsRegistrationFormFieldOption> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(FtbPersonnelsRegistrationFormFieldOption::getEnabledMark, 0)
                .eq(FtbPersonnelsRegistrationFormFieldOption::getFormFieldId, fieldId)
                .orderByAsc(FtbPersonnelsRegistrationFormFieldOption::getCreatorTime);
        List<FtbPersonnelsRegistrationFormFieldOption> optionList = baseMapper.selectList(wrapper);
        if(CollectionUtil.isNotEmpty(optionList)) {
            return optionList;
        }
        return new ArrayList<>();
    }
}
