完善仓库管理

This commit is contained in:
2024-02-26 19:45:12 +08:00
parent c94de52790
commit 45b4ce94a3
5 changed files with 56 additions and 0 deletions

View File

@@ -13,4 +13,12 @@ public class WarehouseDto extends OrgCommonDto {
private String contact;
private String contactPhone;
private Double goodsCount;
private Double goodsNumber;
private Double goodsAmount;
}

View File

@@ -6,6 +6,8 @@ import jakarta.persistence.Entity;
import lombok.Data;
import org.hibernate.annotations.Formula;
@Data
@Entity
public class WarehouseEntity extends OrgCommonEntity {
@@ -19,4 +21,16 @@ public class WarehouseEntity extends OrgCommonEntity {
private String contactPhone;
@Formula("(select count(1) from t_warehouse_goods_summary s where s.warehouse_id = id)")
private Double goodsCount;
@Formula("(select sum(s.number) from t_warehouse_goods_summary s where s.warehouse_id = id)")
private Double goodsNumber;
@Formula("(select sum(s.number * s.price) from t_warehouse_goods_summary s where s.warehouse_id = id)")
private Double goodsAmount;
}

View File

@@ -7,11 +7,14 @@ import cn.lihongjie.coal.warehouseGoodsUnit.entity.WarehouseGoodsUnitEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import lombok.Data;
import org.hibernate.annotations.Comment;
import java.util.List;
@Data
@Entity
public class WarehouseGoodsEntity extends OrgCommonEntity {
@@ -52,4 +55,11 @@ public class WarehouseGoodsEntity extends OrgCommonEntity {
private Double price5;
// 不同的规格
@OneToMany(mappedBy = "parent")
private List<WarehouseGoodsEntity> children;
@ManyToOne
private WarehouseGoodsEntity parent;
}

View File

@@ -5,8 +5,19 @@ import cn.lihongjie.coal.warehouse.dto.WarehouseDto;
import lombok.Data;
import org.hibernate.annotations.Formula;
@Data
public class WarehouseShelveDto extends OrgCommonDto {
private WarehouseDto warehouse;
@Formula("(select count(1) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsCount;
@Formula("(select sum(s.number) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsNumber;
@Formula("(select sum(s.number * s.price) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsAmount;
}

View File

@@ -8,6 +8,8 @@ import jakarta.persistence.ManyToOne;
import lombok.Data;
import org.hibernate.annotations.Formula;
@Data
@Entity
public class WarehouseShelveEntity extends OrgCommonEntity {
@@ -18,4 +20,15 @@ public class WarehouseShelveEntity extends OrgCommonEntity {
@Formula("(select count(1) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsCount;
@Formula("(select sum(s.number) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsNumber;
@Formula("(select sum(s.number * s.price) from t_warehouse_goods_summary s where s.shelve_id = id)")
private Double goodsAmount;
}