l3能源成本分摊(部分完成留存)
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.WmsEnergyAreaLink;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.ems.domain.bo.WmsEnergyAreaLinkBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface IWmsEnergyAreaLinkService {
|
||||
|
||||
/**
|
||||
* 查询单条
|
||||
*/
|
||||
WmsEnergyAreaLinkVo queryById(Long linkId);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<WmsEnergyAreaLinkVo> queryPageList(WmsEnergyAreaLinkBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询全部列表
|
||||
*/
|
||||
List<WmsEnergyAreaLinkVo> queryList(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean insertByBo(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Boolean updateByBo(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
Boolean deleteById(Long linkId);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
Boolean deleteByIds(Collection<Long> linkIds);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.klp.ems.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 com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.WmsEnergyAreaLinkBo;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.ems.domain.WmsEnergyAreaLink;
|
||||
import com.klp.ems.mapper.WmsEnergyAreaLinkMapper;
|
||||
import com.klp.ems.service.IWmsEnergyAreaLinkService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsEnergyAreaLinkServiceImpl implements IWmsEnergyAreaLinkService {
|
||||
|
||||
private final WmsEnergyAreaLinkMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询单条
|
||||
*/
|
||||
@Override
|
||||
public WmsEnergyAreaLinkVo queryById(Long linkId) {
|
||||
return baseMapper.selectVoById(linkId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsEnergyAreaLinkVo> queryPageList(WmsEnergyAreaLinkBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsEnergyAreaLinkVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsEnergyAreaLinkVo> queryList(WmsEnergyAreaLinkBo bo) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsEnergyAreaLinkBo bo) {
|
||||
WmsEnergyAreaLink add = BeanUtil.toBean(bo, WmsEnergyAreaLink.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setLinkId(add.getLinkId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsEnergyAreaLinkBo bo) {
|
||||
WmsEnergyAreaLink update = BeanUtil.toBean(bo, WmsEnergyAreaLink.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteById(Long linkId) {
|
||||
return baseMapper.deleteById(linkId) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteByIds(Collection<Long> linkIds) {
|
||||
return baseMapper.deleteBatchIds(linkIds) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
private LambdaQueryWrapper<WmsEnergyAreaLink> buildQueryWrapper(WmsEnergyAreaLinkBo bo) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getEnergyTypeId() != null, WmsEnergyAreaLink::getEnergyTypeId, bo.getEnergyTypeId());
|
||||
lqw.eq(bo.getMeterId() != null, WmsEnergyAreaLink::getMeterId, bo.getMeterId());
|
||||
lqw.eq(bo.getWarehouseId() != null, WmsEnergyAreaLink::getWarehouseId, bo.getWarehouseId());
|
||||
lqw.eq(bo.getIsEnabled() != null, WmsEnergyAreaLink::getIsEnabled, bo.getIsEnabled());
|
||||
lqw.orderByDesc(WmsEnergyAreaLink::getLinkId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据有效性验证
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsEnergyAreaLink entity) {
|
||||
if (StringUtils.isBlank(entity.getRemark())) {
|
||||
entity.setRemark("");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user