Ryan
2025-03-20 4235b508143509b4f8aa85c8b561313f131b1d4b
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
@@ -2,7 +2,11 @@
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;
@@ -96,16 +100,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;
    }
}