| | |
| | | import ( |
| | | "github.com/gin-gonic/gin" |
| | | "gorm.io/gorm" |
| | | "silkserver/constvar" |
| | | "silkserver/controllers/request" |
| | | "silkserver/extend/code" |
| | | "silkserver/extend/util" |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "查询失败") |
| | | return |
| | | } |
| | | all, err := models.NewDictSearch().SetDictTypes([]constvar.DictType{constvar.DictTypeMarket, constvar.DictTypeWorkshop}).FindAll() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "查询失败") |
| | | return |
| | | } |
| | | for _, register := range list { |
| | | for _, dict := range all { |
| | | if register.MarketId == dict.ID { |
| | | register.MarketName = dict.Name |
| | | break |
| | | } |
| | | } |
| | | } |
| | | util.ResponseFormatList(c, code.Success, list, total) |
| | | } |
| | | |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "marketNumber": { |
| | | "marketId": { |
| | | "type": "integer" |
| | | }, |
| | | "marketName": { |
| | | "type": "string" |
| | | }, |
| | | "notes": { |
| | |
| | | "marketId": { |
| | | "type": "integer" |
| | | }, |
| | | "marketName": { |
| | | "description": "庄口名", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | |
| | | }, |
| | | "workshopId": { |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "marketNumber": { |
| | | "marketId": { |
| | | "type": "integer" |
| | | }, |
| | | "marketName": { |
| | | "type": "string" |
| | | }, |
| | | "notes": { |
| | |
| | | "marketId": { |
| | | "type": "integer" |
| | | }, |
| | | "marketName": { |
| | | "description": "庄口名", |
| | | "type": "string" |
| | | }, |
| | | "number": { |
| | | "type": "string" |
| | | }, |
| | |
| | | }, |
| | | "workshopId": { |
| | | "type": "integer" |
| | | }, |
| | | "workshopName": { |
| | | "description": "车间名", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | $ref: '#/definitions/gorm.DeletedAt' |
| | | id: |
| | | type: integer |
| | | marketNumber: |
| | | marketId: |
| | | type: integer |
| | | marketName: |
| | | type: string |
| | | notes: |
| | | type: string |
| | |
| | | type: string |
| | | marketId: |
| | | type: integer |
| | | marketName: |
| | | description: 庄口名 |
| | | type: string |
| | | number: |
| | | type: string |
| | | oneBack: |
| | |
| | | type: number |
| | | workshopId: |
| | | type: integer |
| | | workshopName: |
| | | description: 车间名 |
| | | type: string |
| | | type: object |
| | | models.YieldRegisterCircle: |
| | | properties: |
| | |
| | | |
| | | DictSearch struct { |
| | | Dict |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Orm *gorm.DB |
| | | Keyword string |
| | | DictTypes []constvar.DictType |
| | | } |
| | | ) |
| | | |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *DictSearch) SetDictTypes(dts []constvar.DictType) *DictSearch { |
| | | slf.DictTypes = dts |
| | | return slf |
| | | } |
| | | |
| | | func (slf *DictSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | |
| | | db = db.Where("name like ? or number like ?", kw, kw) |
| | | } |
| | | |
| | | if len(slf.DictTypes) > 0 { |
| | | db = db.Where("dict_type in (?)", slf.DictTypes) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | |
| | | type ( |
| | | RawSilkPriceStandard struct { |
| | | gorm.Model |
| | | MarketNumber string `json:"marketNumber" gorm:"type:varchar(255);comment:庄口编号"` |
| | | MarketId uint `json:"marketId" gorm:"type:int(11);comment:庄口id"` |
| | | MarketName string `json:"marketName" gorm:"type:varchar(255);comment:庄口名称"` |
| | | RawSilkGrade string `json:"rawSilkGrade" gorm:"type:varchar(255);comment:生丝等级"` |
| | | PayStandard decimal.Decimal `json:"payStandard" gorm:"type:decimal(20,3);comment:薪酬标准"` |
| | | Unit string `json:"unit" gorm:"type:varchar(100);comment:单位"` |
| | |
| | | Total decimal.Decimal `json:"total" gorm:"type:decimal(12,2);comment:总产量"` |
| | | Items []*YieldRegisterItem `json:"items" gorm:"foreignKey:YieldRegisterId"` |
| | | Circles []*YieldRegisterCircle `json:"circles" gorm:"foreignKey:YieldRegisterId"` |
| | | |
| | | MarketName string `json:"marketName" gorm:"-"` //庄口名 |
| | | WorkshopName string `json:"workshopName" gorm:"-"` //车间名 |
| | | |
| | | } |
| | | YieldRegisterSearch struct { |
| | | YieldRegister |