MrShi
2025-08-19 ff087240b3dee29ce4e14ad0836e76b9fdf312cf
server/src/main/java/com/doumee/service/system/impl/SystemDictServiceImpl.java
@@ -1,5 +1,10 @@
package com.doumee.service.system.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.doumee.core.constants.Constants;
import com.doumee.dao.system.SystemDictDataMapper;
import com.doumee.dao.system.model.SystemDictData;
import com.doumee.dao.system.vo.SystemQrcodeListVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.doumee.core.model.PageData;
@@ -11,11 +16,13 @@
import com.doumee.service.system.SystemDictService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
@@ -28,6 +35,8 @@
    @Autowired
    private SystemDictMapper systemDictMapper;
    @Autowired
    private SystemDictDataMapper systemDictDataMapper;
    @Override
    public Integer create(SystemDict systemDict) {
@@ -88,6 +97,31 @@
        PageHelper.startPage(pageWrap.getPage(), pageWrap.getCapacity());
        return PageData.from(new PageInfo<>(systemDictMapper.selectManageList(pageWrap.getModel(), pageWrap.getOrderByClause())));
    }
    @Override
    public List<SystemQrcodeListVO> qrcodeList(QuerySystemDictDTO pageWrap) {
        List<SystemQrcodeListVO> list = new ArrayList<>();
        SystemDict dict =systemDictMapper.selectOne(new LambdaQueryWrapper<SystemDict>().
                eq(SystemDict::getCode,Constants.QRCODE_URLS)
                .last("limit 1")) ;
        if(dict!=null){
            List<SystemDictData> dataList = systemDictDataMapper.selectList(new LambdaQueryWrapper<SystemDictData>().
                    eq(SystemDictData::getDictId,dict.getId()))   ;
            if(dataList!=null && dataList.size()>0){
                for(SystemDictData data :dataList){
                    SystemQrcodeListVO t = new SystemQrcodeListVO();
                    t.setId(data.getId()+"");
                    t.setName(data.getRemark());
                    t.setUrl(data.getCode());
                    if(StringUtils.equals(data.getLabel(),Constants.SHE_QRCODES_URL)
                            ||StringUtils.equals(data.getLabel(),Constants.DCA_QRCODES_URL)
                            ||StringUtils.equals(data.getLabel(),Constants.DBH_QRCODES_URL)){
                        list.add(t);
                    }
                }
            }
        }
        return list;
    }
    @Override
    public long count(SystemDict systemDict) {