-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
供应商信息管理,新增供应商信息,主要包括:产品型号,交付时间,产品价格,可交付数量,交易对手方,预付款比例等
- Loading branch information
1 parent
747eda9
commit a1c80ed
Showing
5 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/aiassistant/controller/SupplierProductController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.aiassistant.controller; | ||
|
||
import com.aiassistant.model.SupplierProduct; | ||
import com.aiassistant.service.SupplierProductService; | ||
import com.aiassistant.utils.ResultModel; | ||
import com.aiassistant.utils.ResultPageModel; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/supplierProduct") | ||
public class SupplierProductController { | ||
private final SupplierProductService supplierProductService; | ||
|
||
@Autowired | ||
public SupplierProductController(SupplierProductService supplierProductService) { | ||
this.supplierProductService = supplierProductService; | ||
} | ||
|
||
@PostMapping("/add") | ||
public ResultModel addSupplierProduct(SupplierProduct supplierProduct) { | ||
return supplierProductService.addSupplierProduct(supplierProduct); | ||
} | ||
|
||
@PostMapping("/list") | ||
public ResultPageModel<SupplierProduct> getSupplierProductList() { | ||
return supplierProductService.getSupplierProductList(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/aiassistant/mapper/SupplierProductMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.aiassistant.mapper; | ||
|
||
import com.aiassistant.model.SupplierProduct; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Insert; | ||
import org.apache.ibatis.annotations.Select; | ||
|
||
import java.util.List; | ||
|
||
@Mapper | ||
public interface SupplierProductMapper { | ||
@Insert("insert into supplier_product(product_model,delivery_time,product_price,deliverable_quantity,trading_counterparty,advance_payment_ratio) "+ | ||
"values(#{productModel},#{deliveryTime},#{productPrice},#{deliverableQuantity},#{tradingCounterparty},#{advancePaymentRatio})") | ||
SupplierProduct insertSupplierProduct(SupplierProduct supplierProduct); | ||
|
||
@Select("select * from supplier_product") | ||
List<SupplierProduct> getSupplierProductList(); | ||
|
||
@Select("select * from supplier_product where product_model = #{productModel}") | ||
SupplierProduct selectByProductModel(String productModel); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.aiassistant.model; | ||
|
||
import java.util.Date; | ||
|
||
public class SupplierProduct { | ||
private String productModel; | ||
private Date deliveryTime; | ||
private Double productPrice; | ||
private Integer deliverableQuantity; | ||
private String tradingCounterparty; | ||
private Double advancePaymentRatio; | ||
|
||
public String getProductModel() { | ||
return productModel; | ||
} | ||
|
||
public void setProductModel(String productModel) { | ||
this.productModel = productModel; | ||
} | ||
|
||
public Date getDeliveryTime() { | ||
return deliveryTime; | ||
} | ||
|
||
public void setDeliveryTime(Date deliveryTime) { | ||
this.deliveryTime = deliveryTime; | ||
} | ||
|
||
public Double getProductPrice() { | ||
return productPrice; | ||
} | ||
|
||
public void setProductPrice(Double productPrice) { | ||
this.productPrice = productPrice; | ||
} | ||
|
||
public Integer getDeliverableQuantity() { | ||
return deliverableQuantity; | ||
} | ||
|
||
public void setDeliverableQuantity(Integer deliverableQuantity) { | ||
this.deliverableQuantity = deliverableQuantity; | ||
} | ||
|
||
public String getTradingCounterparty() { | ||
return tradingCounterparty; | ||
} | ||
|
||
public void setTradingCounterparty(String tradingCounterparty) { | ||
this.tradingCounterparty = tradingCounterparty; | ||
} | ||
|
||
public Double getAdvancePaymentRatio() { | ||
return advancePaymentRatio; | ||
} | ||
|
||
public void setAdvancePaymentRatio(Double advancePaymentRatio) { | ||
this.advancePaymentRatio = advancePaymentRatio; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/aiassistant/service/SupplierProductService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.aiassistant.service; | ||
|
||
import com.aiassistant.model.SupplierProduct; | ||
import com.aiassistant.utils.ResultModel; | ||
import com.aiassistant.utils.ResultPageModel; | ||
|
||
public interface SupplierProductService { | ||
ResultModel addSupplierProduct(SupplierProduct supplierProduct); | ||
ResultPageModel<SupplierProduct> getSupplierProductList(); | ||
SupplierProduct getSupplierProductByProductModel(String productModel); | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/aiassistant/service/impl/SupplierProductServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.aiassistant.service.impl; | ||
|
||
import com.aiassistant.mapper.SupplierProductMapper; | ||
import com.aiassistant.model.SupplierProduct; | ||
import com.aiassistant.service.SupplierProductService; | ||
import com.aiassistant.utils.ResultModel; | ||
import com.aiassistant.utils.ResultPageModel; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class SupplierProductServiceImpl implements SupplierProductService { | ||
|
||
private final SupplierProductMapper supplierProductMapper; | ||
|
||
@Autowired | ||
public SupplierProductServiceImpl(SupplierProductMapper supplierProductMapper) { | ||
this.supplierProductMapper = supplierProductMapper; | ||
} | ||
|
||
@Override | ||
public ResultModel addSupplierProduct(SupplierProduct supplierProduct) { | ||
supplierProductMapper.insertSupplierProduct(supplierProduct); | ||
return ResultModel.ofSuccess("Supplier product added successfully"); | ||
} | ||
|
||
@Override | ||
public ResultPageModel<SupplierProduct> getSupplierProductList() { | ||
ResultPageModel<SupplierProduct> resultPageModel = ResultPageModel.of(supplierProductMapper.getSupplierProductList()) | ||
return resultPageModel; | ||
} | ||
|
||
@Override | ||
public SupplierProduct getSupplierProductByProductModel(String productModel) { | ||
return supplierProductMapper.selectByProductModel(productModel); | ||
} | ||
} |