From 6ab6e517d224d8318a9a4ee189671a35bc2fbd2a Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期五, 01 三月 2024 11:02:47 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/silk/silkServer

---
 controllers/fineness.go         |   50 +++++
 models/fineness.go              |   31 ++-
 controllers/request/fineness.go |   26 +-
 docs/swagger.yaml               |   97 ++++++++++
 docs/docs.go                    |  151 ++++++++++++++++
 docs/swagger.json               |  151 ++++++++++++++++
 models/fineness_item.go         |    9 +
 router/router.go                |    1 
 8 files changed, 477 insertions(+), 39 deletions(-)

diff --git a/controllers/fineness.go b/controllers/fineness.go
index a9068e3..6760b3b 100644
--- a/controllers/fineness.go
+++ b/controllers/fineness.go
@@ -2,6 +2,7 @@
 
 import (
 	"github.com/gin-gonic/gin"
+	"gorm.io/gorm"
 	"silkserver/controllers/request"
 	"silkserver/extend/code"
 	"silkserver/extend/util"
@@ -35,12 +36,23 @@
 		util.ResponseFormat(c, code.RequestParamError, err.Error())
 		return
 	}
-	if err := models.NewFinenessRegisterSearch().Create(&params); err != nil {
-		util.ResponseFormat(c, code.SaveFail, "鎻掑叆澶辫触")
-		return
+	err := models.WithTransaction(func(db *gorm.DB) error {
+		search := models.NewFinenessRegisterSearch().SetOrm(db)
+
+		if params.ID != 0 {
+			if err := models.NewFinenessItemSearch().SetOrm(db).SetFinenessRegisterID(params.ID).Delete(); err != nil {
+				return err
+			}
+			return search.Save(&params)
+		} else {
+			return search.Create(&params)
+		}
+	})
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "淇濆瓨澶辫触")
 	}
 
-	util.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛")
+	util.ResponseFormat(c, code.Success, "淇濆瓨鎴愬姛")
 }
 
 func (slf FinenessController) ParamsCheck(params models.FinenessRegister) (err error) {
@@ -67,7 +79,35 @@
 		return
 	}
 
-	util.ResponseFormatList(c, code.Success, list, int(total))
+	util.ResponseFormatList(c, code.Success, list, total)
+}
+
+// Info
+// @Tags      绾ゅ害鐧昏
+// @Summary   绾ゅ害鐧昏璇︽儏
+// @Produce   application/json
+// @Param     id  path string true  "瀛楀吀淇℃伅"
+// @Success   200 {object} util.ResponseList{data=models.FinenessRegister} "鎴愬姛"
+// @Router    /api-jl/v1/fineness/register/{id} [get]
+func (slf FinenessController) Info(c *gin.Context) {
+	idStr := c.Param("id")
+	if idStr == "0" || idStr == "" {
+		util.ResponseFormat(c, code.RequestParamError, "绌虹殑璁板綍id")
+		return
+	}
+
+	id := convertx.StringToUInt(idStr)
+	if id == 0 {
+		util.ResponseFormat(c, code.RequestParamError, "绌虹殑璁板綍id")
+		return
+	}
+
+	info, err := models.NewFinenessRegisterSearch().SetID(id).SetPreload().First()
+	if err != nil {
+		util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
+		return
+	}
+	util.ResponseFormat(c, code.Success, info)
 }
 
 // Delete
diff --git a/controllers/request/fineness.go b/controllers/request/fineness.go
index 6005044..e8121f9 100644
--- a/controllers/request/fineness.go
+++ b/controllers/request/fineness.go
@@ -1,18 +1,22 @@
 package request
 
-import "github.com/shopspring/decimal"
+import (
+	"github.com/shopspring/decimal"
+)
 
 type AddFinenessRegister struct {
-	Number        string         `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`        //缂栧彿
-	FinishDate    string         `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`  //钀戒笣鏃堕棿
-	Workshop      string         `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`          //杞﹂棿
-	WorkshopGroup string         `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍
-	Market        string         `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`        //搴勫彛
-	Spec          string         `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`          //瑙勬牸
-	StartCircle   uint8          `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁�
-	EndCircle     uint8          `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"`   //缁撴潫鍥炴暟
-	FinenessList  []FinenessItem `json:"finenessList"`
-	Sum           FinenessItem   `json:"sum"`
+	ID            uint            `json:"id"`                                                             //id 娣诲姞鏃朵紶0
+	Number        string          `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`          //缂栧彿
+	FinishDate    string          `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`  //钀戒笣鏃堕棿
+	Workshop      string          `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`            //杞﹂棿
+	WorkshopGroup string          `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"`   //杞︾粍
+	Market        string          `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`          //搴勫彛
+	Spec          string          `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`            //瑙勬牸
+	StartCircle   uint8           `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁�
+	EndCircle     uint8           `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"`   //缁撴潫鍥炴暟
+	FinenessList  []FinenessItem  `json:"finenessList"`
+	SumFineness   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"`
+	SumQuantity   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"`
 }
 
 type FinenessItem struct {
diff --git a/docs/docs.go b/docs/docs.go
index 33d264f..b085057 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -93,6 +93,44 @@
             }
         },
         "/api-jl/v1/fineness/register/{id}": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绾ゅ害鐧昏"
+                ],
+                "summary": "绾ゅ害鐧昏璇︽儏",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "瀛楀吀淇℃伅",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.ResponseList"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.FinenessRegister"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            },
             "delete": {
                 "produces": [
                     "application/json"
@@ -275,6 +313,66 @@
                     }
                 }
             }
+        },
+        "/api-jl/v1/system/getPriceStandardList": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯"
+                ],
+                "summary": "鑾峰彇鐢熶笣瀹氫环鏍囧噯",
+                "parameters": [
+                    {
+                        "description": "鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.RawSilkPriceStandard"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-jl/v1/system/savePriceStandard": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯"
+                ],
+                "summary": "淇濆瓨鐢熶笣瀹氫环鏍囧噯",
+                "parameters": [
+                    {
+                        "description": "鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.RawSilkPriceStandard"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
         }
     },
     "definitions": {
@@ -426,11 +524,49 @@
                     "description": "寮�濮嬪洖鏁�",
                     "type": "integer"
                 },
+                "sumFineness": {
+                    "type": "number"
+                },
+                "sumQuantity": {
+                    "type": "number"
+                },
                 "updatedAt": {
                     "type": "string"
                 },
                 "workshopGroup": {
                     "description": "杞︾粍",
+                    "type": "string"
+                }
+            }
+        },
+        "models.RawSilkPriceStandard": {
+            "type": "object",
+            "properties": {
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "marketNumber": {
+                    "type": "string"
+                },
+                "notes": {
+                    "type": "string"
+                },
+                "payStandard": {
+                    "type": "number"
+                },
+                "rawSilkGradeNumber": {
+                    "type": "string"
+                },
+                "unit": {
+                    "type": "string"
+                },
+                "updatedAt": {
                     "type": "string"
                 }
             }
@@ -477,6 +613,10 @@
                     "description": "钀戒笣鏃堕棿",
                     "type": "string"
                 },
+                "id": {
+                    "description": "id 娣诲姞鏃朵紶0",
+                    "type": "integer"
+                },
                 "market": {
                     "description": "搴勫彛",
                     "type": "string"
@@ -497,8 +637,11 @@
                     "description": "寮�濮嬪洖鏁�",
                     "type": "integer"
                 },
-                "sum": {
-                    "$ref": "#/definitions/request.FinenessItem"
+                "sumFineness": {
+                    "type": "number"
+                },
+                "sumQuantity": {
+                    "type": "number"
                 },
                 "workshopGroup": {
                     "description": "杞︾粍",
@@ -579,9 +722,7 @@
                 "pageSize": {
                     "type": "integer"
                 },
-                "total": {
-                    "type": "integer"
-                }
+                "total": {}
             }
         }
     }
diff --git a/docs/swagger.json b/docs/swagger.json
index a6d7a47..f41e17b 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -81,6 +81,44 @@
             }
         },
         "/api-jl/v1/fineness/register/{id}": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绾ゅ害鐧昏"
+                ],
+                "summary": "绾ゅ害鐧昏璇︽儏",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "瀛楀吀淇℃伅",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.ResponseList"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.FinenessRegister"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            },
             "delete": {
                 "produces": [
                     "application/json"
@@ -263,6 +301,66 @@
                     }
                 }
             }
+        },
+        "/api-jl/v1/system/getPriceStandardList": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯"
+                ],
+                "summary": "鑾峰彇鐢熶笣瀹氫环鏍囧噯",
+                "parameters": [
+                    {
+                        "description": "鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.RawSilkPriceStandard"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/api-jl/v1/system/savePriceStandard": {
+            "post": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯"
+                ],
+                "summary": "淇濆瓨鐢熶笣瀹氫环鏍囧噯",
+                "parameters": [
+                    {
+                        "description": "鍙傛暟",
+                        "name": "object",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/models.RawSilkPriceStandard"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "$ref": "#/definitions/util.Response"
+                        }
+                    }
+                }
+            }
         }
     },
     "definitions": {
@@ -414,11 +512,49 @@
                     "description": "寮�濮嬪洖鏁�",
                     "type": "integer"
                 },
+                "sumFineness": {
+                    "type": "number"
+                },
+                "sumQuantity": {
+                    "type": "number"
+                },
                 "updatedAt": {
                     "type": "string"
                 },
                 "workshopGroup": {
                     "description": "杞︾粍",
+                    "type": "string"
+                }
+            }
+        },
+        "models.RawSilkPriceStandard": {
+            "type": "object",
+            "properties": {
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "marketNumber": {
+                    "type": "string"
+                },
+                "notes": {
+                    "type": "string"
+                },
+                "payStandard": {
+                    "type": "number"
+                },
+                "rawSilkGradeNumber": {
+                    "type": "string"
+                },
+                "unit": {
+                    "type": "string"
+                },
+                "updatedAt": {
                     "type": "string"
                 }
             }
@@ -465,6 +601,10 @@
                     "description": "钀戒笣鏃堕棿",
                     "type": "string"
                 },
+                "id": {
+                    "description": "id 娣诲姞鏃朵紶0",
+                    "type": "integer"
+                },
                 "market": {
                     "description": "搴勫彛",
                     "type": "string"
@@ -485,8 +625,11 @@
                     "description": "寮�濮嬪洖鏁�",
                     "type": "integer"
                 },
-                "sum": {
-                    "$ref": "#/definitions/request.FinenessItem"
+                "sumFineness": {
+                    "type": "number"
+                },
+                "sumQuantity": {
+                    "type": "number"
                 },
                 "workshopGroup": {
                     "description": "杞︾粍",
@@ -567,9 +710,7 @@
                 "pageSize": {
                     "type": "integer"
                 },
-                "total": {
-                    "type": "integer"
-                }
+                "total": {}
             }
         }
     }
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 24d7128..5a82bcc 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -102,10 +102,35 @@
       startCircle:
         description: 寮�濮嬪洖鏁�
         type: integer
+      sumFineness:
+        type: number
+      sumQuantity:
+        type: number
       updatedAt:
         type: string
       workshopGroup:
         description: 杞︾粍
+        type: string
+    type: object
+  models.RawSilkPriceStandard:
+    properties:
+      createdAt:
+        type: string
+      deletedAt:
+        $ref: '#/definitions/gorm.DeletedAt'
+      id:
+        type: integer
+      marketNumber:
+        type: string
+      notes:
+        type: string
+      payStandard:
+        type: number
+      rawSilkGradeNumber:
+        type: string
+      unit:
+        type: string
+      updatedAt:
         type: string
     type: object
   request.AddDict:
@@ -136,6 +161,9 @@
       finishDate:
         description: 钀戒笣鏃堕棿
         type: string
+      id:
+        description: id 娣诲姞鏃朵紶0
+        type: integer
       market:
         description: 搴勫彛
         type: string
@@ -151,8 +179,10 @@
       startCircle:
         description: 寮�濮嬪洖鏁�
         type: integer
-      sum:
-        $ref: '#/definitions/request.FinenessItem'
+      sumFineness:
+        type: number
+      sumQuantity:
+        type: number
       workshopGroup:
         description: 杞︾粍
         type: string
@@ -205,8 +235,7 @@
         type: integer
       pageSize:
         type: integer
-      total:
-        type: integer
+      total: {}
     type: object
 info:
   contact: {}
@@ -273,6 +302,28 @@
           schema:
             $ref: '#/definitions/util.Response'
       summary: 绾ゅ害鐧昏鍒犻櫎
+      tags:
+      - 绾ゅ害鐧昏
+    get:
+      parameters:
+      - description: 瀛楀吀淇℃伅
+        in: path
+        name: id
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            allOf:
+            - $ref: '#/definitions/util.ResponseList'
+            - properties:
+                data:
+                  $ref: '#/definitions/models.FinenessRegister'
+              type: object
+      summary: 绾ゅ害鐧昏璇︽儏
       tags:
       - 绾ゅ害鐧昏
   /api-jl/v1/system/dict:
@@ -376,4 +427,42 @@
       summary: 鍒犻櫎瀛楀吀
       tags:
       - 绯荤粺璁剧疆/瀛楀吀
+  /api-jl/v1/system/getPriceStandardList:
+    get:
+      parameters:
+      - description: 鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/models.RawSilkPriceStandard'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 鑾峰彇鐢熶笣瀹氫环鏍囧噯
+      tags:
+      - 绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯
+  /api-jl/v1/system/savePriceStandard:
+    post:
+      parameters:
+      - description: 鍙傛暟
+        in: body
+        name: object
+        required: true
+        schema:
+          $ref: '#/definitions/models.RawSilkPriceStandard'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            $ref: '#/definitions/util.Response'
+      summary: 淇濆瓨鐢熶笣瀹氫环鏍囧噯
+      tags:
+      - 绯荤粺璁剧疆/鐢熶笣瀹氫环鏍囧噯
 swagger: "2.0"
diff --git a/models/fineness.go b/models/fineness.go
index 9486840..e8e7238 100644
--- a/models/fineness.go
+++ b/models/fineness.go
@@ -2,6 +2,7 @@
 
 import (
 	"fmt"
+	"github.com/shopspring/decimal"
 	"gorm.io/gorm"
 	"silkserver/pkg/mysqlx"
 )
@@ -10,15 +11,17 @@
 	// FinenessRegister 绾ゅ害鐧昏
 	FinenessRegister struct {
 		gorm.Model
-		Number        string         `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`        //缂栧彿
-		FinishDate    string         `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`  //钀戒笣鏃堕棿
-		Workshop      string         `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`          //杞﹂棿
-		WorkshopGroup string         `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍
-		Market        string         `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`        //搴勫彛
-		Spec          string         `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`          //瑙勬牸
-		StartCircle   uint8          `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁�
-		EndCircle     uint8          `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"`   //缁撴潫鍥炴暟
-		FinenessList  []FinenessItem `gorm:"foreignkey:FinenessRegisterID" json:"finenessList"`
+		Number        string          `gorm:"type:varchar(255);not null;comment:缂栧彿" json:"number"`        //缂栧彿
+		FinishDate    string          `gorm:"type:varchar(255);not null;comment:钀戒笣鏃堕棿" json:"finishDate"`  //钀戒笣鏃堕棿
+		Workshop      string          `gorm:"type:varchar(255);not null;comment:杞﹂棿" json:"name"`          //杞﹂棿
+		WorkshopGroup string          `gorm:"type:varchar(255);not null;comment:杞︾粍" json:"workshopGroup"` //杞︾粍
+		Market        string          `gorm:"type:varchar(255);not null;comment:搴勫彛" json:"market"`        //搴勫彛
+		Spec          string          `gorm:"type:varchar(255);not null;comment:瑙勬牸" json:"spec"`          //瑙勬牸
+		StartCircle   uint8           `gorm:"type:varchar(255);not null;comment:寮�濮嬪洖鏁�" json:"startCircle"` //寮�濮嬪洖鏁�
+		EndCircle     uint8           `gorm:"type:varchar(255);not null;comment:缁撴潫鍥炴暟" json:"endCircle"`   //缁撴潫鍥炴暟
+		FinenessList  []FinenessItem  `gorm:"foreignkey:FinenessRegisterID;references:ID" json:"finenessList"`
+		SumFineness   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣绾ゅ害" json:"sumFineness"`
+		SumQuantity   decimal.Decimal `gorm:"type:decimal(12,2);not null;comment:鍚堣鏁伴噺" json:"sumQuantity"`
 	}
 	FinenessRegisterSearch struct {
 		FinenessRegister
@@ -26,6 +29,7 @@
 		PageNum  int
 		PageSize int
 		Orm      *gorm.DB
+		Preload  bool
 	}
 )
 
@@ -52,6 +56,11 @@
 	return slf
 }
 
+func (slf *FinenessRegisterSearch) SetPreload() *FinenessRegisterSearch {
+	slf.Preload = true
+	return slf
+}
+
 func (slf *FinenessRegisterSearch) SetID(id uint) *FinenessRegisterSearch {
 	slf.ID = id
 	return slf
@@ -77,6 +86,10 @@
 		db = db.Where("number = ?", slf.Number)
 	}
 
+	if slf.Preload {
+		db = db.Model(&FinenessRegister{}).Preload("FinenessList")
+	}
+
 	return db
 }
 
diff --git a/models/fineness_item.go b/models/fineness_item.go
index 13995ee..2db1931 100644
--- a/models/fineness_item.go
+++ b/models/fineness_item.go
@@ -55,6 +55,11 @@
 	return slf
 }
 
+func (slf *FinenessItemSearch) SetFinenessRegisterID(id uint) *FinenessItemSearch {
+	slf.FinenessRegisterID = id
+	return slf
+}
+
 func (slf *FinenessItemSearch) build() *gorm.DB {
 	var db = slf.Orm.Table(slf.TableName())
 
@@ -66,6 +71,10 @@
 		db = db.Order(slf.Order)
 	}
 
+	if slf.FinenessRegisterID != 0 {
+		db = db.Where("fineness_register_id = ?", slf.FinenessRegisterID)
+	}
+
 	return db
 }
 
diff --git a/router/router.go b/router/router.go
index 022f96e..f2ae3a2 100644
--- a/router/router.go
+++ b/router/router.go
@@ -40,6 +40,7 @@
 		finenessApi.GET("register", FinenessController.List)          // 鑾峰彇绾ゅ害鐧昏鍒楄〃
 		finenessApi.DELETE("register/:id", FinenessController.Delete) // 鍒犻櫎绾ゅ害鐧昏
 		finenessApi.POST("register", FinenessController.Add)          // 鏂板绾ゅ害鐧昏
+		finenessApi.GET("register/:id", FinenessController.Info)      // 鑾峰彇绾ゅ害鐧昏璇︽儏
 	}
 
 	// 鐢熶笣绠$悊

--
Gitblit v1.8.0