平台物料分类

This commit is contained in:
suyl
2021-04-27 10:54:33 +08:00
parent 14f3c29c04
commit 7279c48a10
5 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
package dao
import (
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
)
func GetVendorMatterCategory(db *DaoDB, vendorID int) (vendorMatterCat []*model.VendorMatterCategory, err error) {
sql := `
SELECT * FROM vendor_matter_catgory WHERE deleted_at = ? AND vendor_id = ?
`
sqlParams := []interface{}{utils.DefaultTimeValue, vendorID}
err = GetRows(db, &vendorMatterCat, sql, sqlParams)
return vendorMatterCat, err
}

17
business/model/matter.go Normal file
View File

@@ -0,0 +1,17 @@
package model
type VendorMatterCategory struct {
ModelIDCULD
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
CategoryID int `orm:"column(category_id)" json:"categoryID"`
CategoryName string `json:"categoryName"`
ParentID int `orm:"column(parent_id)" json:"parentID"`
Level int `json:"level"`
}
func (v *VendorMatterCategory) TableUnique() [][]string {
return [][]string{
[]string{"VendorID", "CategoryID"},
}
}

View File

@@ -596,3 +596,17 @@ func (c *JobController) GetUnionJobOrderInfo() {
return retVal, "", err
})
}
// @Title 查询平台物料分类
// @Description 查询平台物料分类
// @Param token header string true "认证token"
// @Param vendorID query int true "平台ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetVendorMatterCategory [get]
func (c *JobController) GetVendorMatterCategory() {
c.callGetVendorMatterCategory(func(params *tJobGetVendorMatterCategoryParams) (retVal interface{}, errCode string, err error) {
retVal, err = dao.GetVendorMatterCategory(dao.GetDB(), params.VendorID)
return retVal, "", err
})
}

View File

@@ -39,6 +39,7 @@ func Init() {
orm.RegisterModel(&model.OperateEvent{})
orm.RegisterModel(&model.NewConfig{}, &legacymodel.Config{})
orm.RegisterModel(&model.AddressDistinguish{})
orm.RegisterModel(&model.VendorMatterCategory{}) //平台物流分类(手动添的)
// create table
orm.RunSyncdb("default", false, true)
}

View File

@@ -619,6 +619,15 @@ func init() {
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
beego.ControllerComments{
Method: "GetVendorMatterCategory",
Router: "/GetVendorMatterCategory",
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:JobController"],
beego.ControllerComments{
Method: "SubmitJob",