feat: 一些优化
This commit is contained in:
parent
1e2e8cdb88
commit
0233a1f387
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.pojo.qo.StorageSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.StorageVO;
|
||||
import com.nflg.wms.repository.entity.WmsBin;
|
||||
import com.nflg.wms.repository.entity.WmsStorage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -33,4 +34,6 @@ public interface WmsStorageMapper extends BaseMapper<WmsStorage> {
|
|||
List<StorageVO> searchNonSync();
|
||||
|
||||
StorageVO getInfo(Long id);
|
||||
|
||||
List<WmsBin> getBins(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -9,6 +10,7 @@ import com.nflg.wms.common.pojo.qo.StorageSearchQO;
|
|||
import com.nflg.wms.common.pojo.vo.StorageVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsBin;
|
||||
import com.nflg.wms.repository.entity.WmsStorage;
|
||||
import com.nflg.wms.repository.mapper.WmsStorageMapper;
|
||||
import com.nflg.wms.repository.service.IAuditLogService;
|
||||
|
|
@ -22,6 +24,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -110,6 +113,12 @@ public class WmsStorageServiceImpl extends ServiceImpl<WmsStorageMapper, WmsStor
|
|||
|
||||
@Override
|
||||
public StorageVO getInfo(Long id) {
|
||||
return baseMapper.getInfo(id);
|
||||
StorageVO vo = baseMapper.getInfo(id);
|
||||
List<WmsBin> binds = baseMapper.getBins(id);
|
||||
if (CollectionUtil.isNotEmpty(binds)) {
|
||||
vo.setBinNos(binds.stream().map(WmsBin::getNo).collect(Collectors.joining(",")));
|
||||
vo.setBinIds(binds.stream().map(WmsBin::getId).collect(Collectors.toList()));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,10 +102,17 @@
|
|||
</select>
|
||||
|
||||
<select id="getInfo" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
|
||||
SELECT s.*,wh.no AS "warehouseNo",get_binnos(s.id) AS "binNos",di.code AS "factory_no"
|
||||
SELECT s.*,wh.no AS "warehouseNo",di.code AS "factory_no"
|
||||
FROM wms_storage s
|
||||
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
|
||||
left join dictionary_item di on wh.factory_id = di."id"
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getBins" resultType="com.nflg.wms.repository.entity.WmsBin">
|
||||
SELECT b.id,b."no"
|
||||
FROM wms_storage_bin sb
|
||||
INNER JOIN wms_bin b ON sb.bin_id=b."id"
|
||||
WHERE sb.storage_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue