package org.jeecg.modules.stm.survey.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.stm.survey.entity.SurveyTpl;
import org.jeecg.modules.stm.survey.mapper.SurveyTplMapper;
import org.jeecg.modules.stm.survey.service.ISurveyTplService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.jeecg.modules.stm.utils.UserUtil;

/**
 * @Description: 调查问卷模板
 * @Author: jeecg-boot
 * @Date:   2023-11-13
 * @Version: V1.0
 */
@Service
public class SurveyTplServiceImpl extends ServiceImpl<SurveyTplMapper, SurveyTpl> implements ISurveyTplService {
    public Integer getSurveyTplCode(){
        QueryWrapper<SurveyTpl> wapper = new QueryWrapper();
        wapper.orderByDesc("ind");
        wapper.last("limit 1");
        SurveyTpl noUpper = super.getBaseMapper().selectOne(wapper);
        if(noUpper==null) {
            return UserUtil.getSurveyTplCode(null);
        } else {
            return UserUtil.getSurveyTplCode(null);
        }
    }
}
