库存管理查询出库列表改正
This commit is contained in:
@@ -33,6 +33,7 @@ public class SysOaOutWarehouseBo extends BaseEntity {
|
||||
/**
|
||||
* 出库后对应的项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空",groups = { AddGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ public class SysOaOutWarehouseBoList extends BaseEntity {
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@NotNull(message = "项目id不能为空", groups = AddGroup.class)
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import java.util.List;
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SysOaOutWarehouseListVo {
|
||||
/**
|
||||
* ID 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 出库后对应的项目id
|
||||
@@ -29,9 +33,25 @@ public class SysOaOutWarehouseListVo {
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 出库表
|
||||
* 出库数量
|
||||
*/
|
||||
private List<SysOaOutWarehouseVo> outWarehouseVoList;
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 物料ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String warehouseName;
|
||||
|
||||
/**
|
||||
* 物料备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,5 +25,8 @@ public interface SysOaOutWarehouseMapper extends BaseMapperPlus<SysOaOutWarehous
|
||||
*/
|
||||
List<SysOaOutWarehouseListVo> defineSelectList(@Param(value = "bo") SysOaOutWarehouseBo bo, @Param(value = "page") PageQuery pageQuery);
|
||||
|
||||
|
||||
/**
|
||||
* 获取分页的Total值
|
||||
*/
|
||||
Long defineQueryTotal(@Param(value = "bo") SysOaOutWarehouseBo bo, @Param(value = "page") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.ruoyi.oa.mapper.SysOaProjectMapper;
|
||||
import com.ruoyi.oa.mapper.SysOaWarehouseMapper;
|
||||
import com.ruoyi.oa.service.ISysOaWarehouseService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.SysOaOutWarehouseBo;
|
||||
@@ -40,6 +41,7 @@ import static cn.hutool.core.bean.BeanUtil.*;
|
||||
* @author liuzongkun999
|
||||
* @date 2024-11-02
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
@@ -82,6 +84,7 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
/**
|
||||
* 查询仓库出库列表
|
||||
*/
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysOaOutWarehouseListVo> queryPageList(SysOaOutWarehouseBo bo, PageQuery pageQuery) {
|
||||
// LambdaQueryWrapper<SysOaOutWarehouse> lqw = buildQueryWrapper(bo);
|
||||
@@ -90,8 +93,8 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
// record.setWarehouseName(warehouseMapper.selectVoById(record.getWarehouseId()).getName());
|
||||
// record.setProjectName(warehouseMapper.selectVoById(record.getProjectId()).getName());
|
||||
// }
|
||||
Long total = baseMapper.defineQueryTotal(bo, pageQuery);
|
||||
|
||||
// TODO 这么写分页失效
|
||||
pageQuery.setPageNum(ObjectUtil.defaultIfNull(pageQuery.getPageNum(), 1));
|
||||
pageQuery.setPageSize(ObjectUtil.defaultIfNull(pageQuery.getPageSize(), Integer.MAX_VALUE));
|
||||
if (pageQuery.getPageNum() <= 0) {
|
||||
@@ -101,12 +104,15 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
pageQuery.setPageSize(Integer.MAX_VALUE);
|
||||
}
|
||||
pageQuery.setPageNum((pageQuery.getPageNum() - 1)*pageQuery.getPageSize());
|
||||
List<SysOaOutWarehouseListVo> result = baseMapper.defineSelectList(bo, pageQuery);
|
||||
// IPage<SysOaOutWarehouseListVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||
// page.setRecords(result);
|
||||
// page.setTotal()
|
||||
|
||||
return TableDataInfo.build(result);
|
||||
List<SysOaOutWarehouseListVo> selectList = baseMapper.defineSelectList(bo, pageQuery);
|
||||
|
||||
IPage<SysOaOutWarehouseListVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||
page.setRecords(selectList);
|
||||
page.setTotal(total);
|
||||
log.info(String.valueOf(total));
|
||||
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,9 +165,11 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
@Override
|
||||
public Boolean insertByBoList(SysOaOutWarehouseBoList boList) {
|
||||
|
||||
// 只进行了插入出库表
|
||||
// 还缺少 检验数量是否足够,以及删除对应库存数量的业务逻辑
|
||||
|
||||
Long projectId = boList.getProjectId();
|
||||
if (projectId == null) {
|
||||
throw new Error("项目ID不能为空,新增出库失败");
|
||||
}
|
||||
List<SysOaOutWarehouseBo2> list = boList.getOutWareHouseList();
|
||||
|
||||
list.forEach((sysOaOutWarehouseBo2 -> {
|
||||
|
||||
@@ -63,5 +63,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="defineQueryTotal" resultType="Long">
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
sys_oa_out_warehouse ware
|
||||
join
|
||||
sys_oa_project project on ware.project_id = project.project_id
|
||||
|
||||
join sys_oa_warehouse warehouse on warehouse.id = ware.warehouse_id
|
||||
<if test="bo != null">
|
||||
<where>
|
||||
<if test="bo.projectName != null and bo.projectName != ''">
|
||||
and project.project_name like concat('%', #{bo.projectName}, '%')
|
||||
</if>
|
||||
<if test="bo.id != null and bo.id != ''">
|
||||
and ware.id = #{bo.id}
|
||||
</if>
|
||||
<if test="bo.projectId != null and bo.projectId != ''">
|
||||
and project.project_id = #{bo.projectId}
|
||||
</if>
|
||||
<if test="bo.amount != null and bo.amount != ''">
|
||||
and ware.amount = #{bo.amount}
|
||||
</if>
|
||||
<if test="bo.remark != null and bo.remark != ''">
|
||||
and ware.remark like concat('%', #{bo.remark}, '%')
|
||||
</if>
|
||||
<if test="bo.warehouseId != null and bo.warehouseId != ''">
|
||||
and ware.warehouse_id = #{bo.warehouseId}
|
||||
</if>
|
||||
<if test="bo.warehouseName != null and bo.warehouseName != ''">
|
||||
and warehouse.name like concat('%', #{bo.warehouseName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user