Commit 8163778c authored by 覃振观's avatar 覃振观 👶

23-12-9: 产品模块实体调整。

parent b868d9de
...@@ -65,7 +65,8 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -65,7 +65,8 @@ public class ProductApplicationImpl implements ProductApplication {
@Override @Override
public Map<String, Object> queryDetailAll(int productId) { public Map<String, Object> queryDetailAll(int productId) {
Map<String, Object> resultMap = new HashMap<>(200); Map<String, Object> resultMap = new HashMap<>(200);
ProductDetail productDetail = detailRepository.findByProductIdEquals((long)productId); String strProductId = Long.toString(productId);
ProductDetail productDetail = detailRepository.findByProductId(strProductId);
// EntityManager manager = JPAUtils.getEntityManger(); // EntityManager manager = JPAUtils.getEntityManger();
// manager.getTransaction().begin(); // manager.getTransaction().begin();
// manager.flush(); // manager.flush();
...@@ -78,7 +79,7 @@ public class ProductApplicationImpl implements ProductApplication { ...@@ -78,7 +79,7 @@ public class ProductApplicationImpl implements ProductApplication {
ArrayList<ProductCategory> categorys = (ArrayList<ProductCategory>)categoryRepository.findAll(); ArrayList<ProductCategory> categorys = (ArrayList<ProductCategory>)categoryRepository.findAll();
// --------------------------------- 详情查询 --------------------------------- // --------------------------------- 详情查询 ---------------------------------
String strProductId = Long.toString(productId);
ArrayList<ProductMaterial> material = (ArrayList<ProductMaterial>) materialRepository.findByProductId(strProductId); ArrayList<ProductMaterial> material = (ArrayList<ProductMaterial>) materialRepository.findByProductId(strProductId);
ArrayList<ProductLoss> loss = (ArrayList<ProductLoss>) lossRepository.findByProductId(strProductId); ArrayList<ProductLoss> loss = (ArrayList<ProductLoss>) lossRepository.findByProductId(strProductId);
Set<Object> entitys = new HashSet<>(); Set<Object> entitys = new HashSet<>();
......
package com.huigou.topsun.product.domain;
import java.io.Serializable;
import javax.persistence.*;
import lombok.Data;
/**
* 产品
* @TableName product
*/
@Table(name="product")
@Data
@Entity
public class Product implements Serializable {
/**
* 产品ID
*/
@Id
@Column(name = "product_id")
private String productId;
/**
* 产品名称
*/
@Column(name = "product_name")
private String productName;
/**
* 产品类别
*/
@Column(name = "product_category_id")
private String productCategoryId;
/**
* 产品状态(码表status)
*/
@Column(name = "product_status")
private String productStatus;
/**
* 产品计量单位
*/
@Column(name = "product_unit")
private String productUnit;
/**
* 样品编号
*/
@Column(name = "product_sample_code")
private String productSampleCode;
/**
* 品牌名称
*/
@Column(name = "brand_name")
private String brandName;
/**
* 产品类型(product_type)
*/
@Column(name = "product_type")
private String productType;
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Product other = (Product) that;
return (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
&& (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
&& (this.getProductCategoryId() == null ? other.getProductCategoryId() == null : this.getProductCategoryId().equals(other.getProductCategoryId()))
&& (this.getProductStatus() == null ? other.getProductStatus() == null : this.getProductStatus().equals(other.getProductStatus()))
&& (this.getProductUnit() == null ? other.getProductUnit() == null : this.getProductUnit().equals(other.getProductUnit()))
&& (this.getProductSampleCode() == null ? other.getProductSampleCode() == null : this.getProductSampleCode().equals(other.getProductSampleCode()))
&& (this.getBrandName() == null ? other.getBrandName() == null : this.getBrandName().equals(other.getBrandName()))
&& (this.getProductType() == null ? other.getProductType() == null : this.getProductType().equals(other.getProductType()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
result = prime * result + ((getProductCategoryId() == null) ? 0 : getProductCategoryId().hashCode());
result = prime * result + ((getProductStatus() == null) ? 0 : getProductStatus().hashCode());
result = prime * result + ((getProductUnit() == null) ? 0 : getProductUnit().hashCode());
result = prime * result + ((getProductSampleCode() == null) ? 0 : getProductSampleCode().hashCode());
result = prime * result + ((getBrandName() == null) ? 0 : getBrandName().hashCode());
result = prime * result + ((getProductType() == null) ? 0 : getProductType().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", productId=").append(productId);
sb.append(", productName=").append(productName);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", productStatus=").append(productStatus);
sb.append(", productUnit=").append(productUnit);
sb.append(", productSampleCode=").append(productSampleCode);
sb.append(", brandName=").append(brandName);
sb.append(", productType=").append(productType);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
...@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -9,5 +9,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Description: * @Description:
*/ */
public interface ProductDetailRepository extends JpaRepository<ProductDetail,String> { public interface ProductDetailRepository extends JpaRepository<ProductDetail,String> {
ProductDetail findByProductIdEquals(Long productId); ProductDetail findByProductId(String productId);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment