yangyang
2025-03-21 8edc8701512d6a02492c8f8d38c05a4253650117
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
@@ -2,10 +2,12 @@
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.common.SpringUtils;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.PageParam;
@@ -20,8 +22,6 @@
import com.vincent.rsf.server.manager.service.MatnrService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.entity.Fields;
import com.vincent.rsf.server.system.service.FieldsService;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -99,17 +99,28 @@
    }
    @Override
    public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) {
        PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true));
        List<Matnr> records = page.getRecords();
        for (Matnr record : records) {
            if (!Objects.isNull(record.getFieldsIndex())) {
                Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex());
                record.setExtendFields(fields);
    public IPage<Map<String, Object>> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) {
        IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, pageParam.buildWrapper(true));
        /**获取物料分页信息 */
        List<Map<String, Object>> mapList = reulst.getRecords();
        if (!mapList.isEmpty()) {
            mapList.forEach(map -> {
                if (!Objects.isNull(map.get("fieldsIndex"))) {
                   FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString());
            }
            });
        }
        page.setRecords(records);
        return page;
        List<Matnr> matnrs = JSONArray.parseArray(JSON.toJSONString(mapList), Matnr.class);
//        PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true));
//        List<Matnr> records = page.getRecords();
//        for (Matnr record : records) {
//            if (!Objects.isNull(record.getFieldsIndex())) {
//                Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex());
//                record.setExtendFields(fields);
//            }
//        }
//        page.setRecords(records);
        return reulst;
    }
    /**