package com.sqx.modules.material.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.Result;
import com.sqx.modules.material.dao.MaterialRecordMapper;
import com.sqx.modules.material.entity.Material;
import com.sqx.modules.material.entity.MaterialRecord;
import com.sqx.modules.material.service.MaterialRecordService;
import jodd.util.StringUtil;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【material_record(物料包历史记录表)】的数据库操作Service实现
* @createDate 2024-02-27 14:34:21
*/
@Service
public class MaterialRecordServiceImpl extends ServiceImpl<MaterialRecordMapper, MaterialRecord> implements MaterialRecordService {


    @Override
    public Result selectPage(Integer page, Integer limit, MaterialRecord materialRecord) {
        IPage<MaterialRecord> page1 = new Page(page, limit);
        IPage<MaterialRecord> materialIPage = baseMapper.selectMaterialRecordList(page1,materialRecord);
        return Result.success().put("data", materialIPage);
    }

    @Override
    public Result addMaterialRecord(MaterialRecord materialRecord) {
        int i = baseMapper.insert(materialRecord);
        if (i > 0){
            return Result.success().put("data", i);
        }
        return Result.error("添加失败");
    }
}




