112 lines
3.9 KiB
Java
112 lines
3.9 KiB
Java
|
|
package com.klp.service.impl;
|
||
|
|
|
||
|
|
import cn.hutool.core.bean.BeanUtil;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
import com.klp.common.core.domain.PageQuery;
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
import com.klp.domain.bo.WmsCoilWarehouseOperationLogBo;
|
||
|
|
import com.klp.domain.vo.WmsCoilWarehouseOperationLogVo;
|
||
|
|
import com.klp.domain.WmsCoilWarehouseOperationLog;
|
||
|
|
import com.klp.mapper.WmsCoilWarehouseOperationLogMapper;
|
||
|
|
import com.klp.service.IWmsCoilWarehouseOperationLogService;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
import java.util.Collection;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 钢卷库区操作记录Service业务层处理
|
||
|
|
*
|
||
|
|
* @author klp
|
||
|
|
* @date 2026-03-05
|
||
|
|
*/
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@Service
|
||
|
|
public class WmsCoilWarehouseOperationLogServiceImpl implements IWmsCoilWarehouseOperationLogService {
|
||
|
|
|
||
|
|
private final WmsCoilWarehouseOperationLogMapper baseMapper;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询钢卷库区操作记录
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public WmsCoilWarehouseOperationLogVo queryById(Long logId){
|
||
|
|
return baseMapper.selectVoById(logId);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询钢卷库区操作记录列表
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public TableDataInfo<WmsCoilWarehouseOperationLogVo> queryPageList(WmsCoilWarehouseOperationLogBo bo, PageQuery pageQuery) {
|
||
|
|
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = buildQueryWrapper(bo);
|
||
|
|
Page<WmsCoilWarehouseOperationLogVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||
|
|
return TableDataInfo.build(result);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询钢卷库区操作记录列表
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public List<WmsCoilWarehouseOperationLogVo> queryList(WmsCoilWarehouseOperationLogBo bo) {
|
||
|
|
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = buildQueryWrapper(bo);
|
||
|
|
return baseMapper.selectVoList(lqw);
|
||
|
|
}
|
||
|
|
|
||
|
|
private LambdaQueryWrapper<WmsCoilWarehouseOperationLog> buildQueryWrapper(WmsCoilWarehouseOperationLogBo bo) {
|
||
|
|
Map<String, Object> params = bo.getParams();
|
||
|
|
LambdaQueryWrapper<WmsCoilWarehouseOperationLog> lqw = Wrappers.lambdaQuery();
|
||
|
|
lqw.eq(bo.getCoilId() != null, WmsCoilWarehouseOperationLog::getCoilId, bo.getCoilId());
|
||
|
|
lqw.eq(bo.getActualWarehouseId() != null, WmsCoilWarehouseOperationLog::getActualWarehouseId, bo.getActualWarehouseId());
|
||
|
|
lqw.eq(bo.getOperationType() != null, WmsCoilWarehouseOperationLog::getOperationType, bo.getOperationType());
|
||
|
|
lqw.eq(bo.getInOutType() != null, WmsCoilWarehouseOperationLog::getInOutType, bo.getInOutType());
|
||
|
|
return lqw;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增钢卷库区操作记录
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Boolean insertByBo(WmsCoilWarehouseOperationLogBo bo) {
|
||
|
|
WmsCoilWarehouseOperationLog add = BeanUtil.toBean(bo, WmsCoilWarehouseOperationLog.class);
|
||
|
|
validEntityBeforeSave(add);
|
||
|
|
boolean flag = baseMapper.insert(add) > 0;
|
||
|
|
if (flag) {
|
||
|
|
bo.setLogId(add.getLogId());
|
||
|
|
}
|
||
|
|
return flag;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改钢卷库区操作记录
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Boolean updateByBo(WmsCoilWarehouseOperationLogBo bo) {
|
||
|
|
WmsCoilWarehouseOperationLog update = BeanUtil.toBean(bo, WmsCoilWarehouseOperationLog.class);
|
||
|
|
validEntityBeforeSave(update);
|
||
|
|
return baseMapper.updateById(update) > 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 保存前的数据校验
|
||
|
|
*/
|
||
|
|
private void validEntityBeforeSave(WmsCoilWarehouseOperationLog entity){
|
||
|
|
//TODO 做一些数据校验,如唯一约束
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 批量删除钢卷库区操作记录
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||
|
|
if(isValid){
|
||
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||
|
|
}
|
||
|
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||
|
|
}
|
||
|
|
}
|