This commit is contained in:
范俊成 2023-10-18 10:06:16 +08:00
parent c1758443ca
commit 998b2a85f3
3 changed files with 5 additions and 2 deletions

View File

@ -92,6 +92,8 @@ func UpdateCategory(c *gin.Context) {
Name: req.Name,
Pid: req.Pid,
}
//修改分类后需要同步修改编号
if old.Pid != category.Pid {
category.Number, err = models.GenerateNumber(old.CooperativeBusinessId, req.Pid)
if err != nil {

View File

@ -123,8 +123,8 @@ func SupplierUpdate(c *gin.Context) {
}
type SupplierListRequest struct {
Number string `json:"number"`
Name string `json:"name"`
Number string `json:"number"` //供应商编号
Name string `json:"name"` //供应商名称
}
// SupplierList 供应商列表

View File

@ -68,6 +68,7 @@ func GenerateNumber(cid uint32, pid uint32) (string, error) {
}
}
// GetCategoryById 通过id获取分类
func GetCategoryById(id uint32) (*Category, error) {
var c *Category
err := orm.Eloquent.Model(c).Where("id", id).First(c).Error