| | |
| | | aliyun-oss: |
| | | endpoint: yourEndpoint |
| | | access-key-id: yourAccessKeyId |
| | | access-key-secret: yourAccessKeySecret |
| | | bucket-name: yourBucketName |
| | | bucket-url: yourBucketUrl |
| | | base-path: yourBasePath |
| | | autocode: |
| | | server-model: /model/%s |
| | | server-router: /router/%s |
| | | server: /server |
| | | server-api: /api/v1/%s |
| | | server-plug: /plugin/%s |
| | | server-initialize: /initialize |
| | | root: D:\basic.com\gin-vue-admin |
| | | web-table: /view |
| | | web: /web/src |
| | | server-service: /service/%s |
| | | server-request: /model/%s/request/ |
| | | web-api: /api |
| | | web-form: /view |
| | | transfer-restart: true |
| | | aws-s3: |
| | | bucket: xxxxx-10005608 |
| | | region: ap-shanghai |
| | | endpoint: "" |
| | | secret-id: your-secret-id |
| | | secret-key: your-secret-key |
| | | base-url: https://gin.vue.admin |
| | | path-prefix: srm |
| | | s3-force-path-style: false |
| | | disable-ssl: false |
| | | captcha: |
| | | key-long: 6 |
| | | img-width: 240 |
| | | img-height: 80 |
| | | open-captcha: 0 |
| | | open-captcha-timeout: 3600 |
| | | cors: |
| | | mode: strict-whitelist |
| | | whitelist: |
| | |
| | | prefix: "" |
| | | port: "3306" |
| | | config: charset=utf8mb4&parseTime=True&loc=Local |
| | | db-name: aps_srm |
| | | db-name: aps_server2 |
| | | username: root |
| | | password: c++java123 |
| | | path: 192.168.20.119 |
| | |
| | | PaidAmount decimal.Decimal `json:"paidAmount" form:"paidAmount" gorm:"type:decimal(12,2);not null;default '';comment:已付金额"` //已付金额 |
| | | } |
| | | |
| | | func (Purchase) TableName() string { |
| | | return "srm_purchase" |
| | | } |
| | | |
| | | type OrderStatus int |
| | | |
| | | const ( |
| | |
| | | Total decimal.Decimal `json:"total" form:"total" gorm:"type:decimal(12,2);not null;default 0.00;comment:采购总价"` // 采购总价 |
| | | Remark string `json:"remark" form:"remark" gorm:"type:varchar(1000);not null; default '';comment:描述"` //描述 |
| | | } |
| | | |
| | | func (PurchaseProducts) TableName() string { |
| | | return "srm_purchase_products" |
| | | } |
| | |
| | | Sort int `json:"sort" form:"sort" gorm:"type:int(11);not null;default 0;comment:排序"` // 排序 |
| | | Pin bool `json:"pin" form:"pin" gorm:"type:tinyint(1);not null;default 0;comment:采购名称"` // 是否置顶 |
| | | } |
| | | |
| | | func (PurchaseType) TableName() string { |
| | | return "srm_purchase_type" |
| | | } |
| | |
| | | |
| | | // TableName Contract 表名 |
| | | func (Contract) TableName() string { |
| | | return "contract" |
| | | return "srm_contract" |
| | | } |
| | |
| | | |
| | | // TableName Industry 表名 |
| | | func (Industry) TableName() string { |
| | | return "industry" |
| | | return "srm_industry" |
| | | } |
| | |
| | | |
| | | // TableName Member 表名 |
| | | func (Member) TableName() string { |
| | | return "member" |
| | | return "srm_member" |
| | | } |
| | |
| | | |
| | | // TableName Product 表名 |
| | | func (Product) TableName() string { |
| | | return "product" |
| | | return "srm_product" |
| | | } |
| | |
| | | |
| | | // TableName Supplier 表名 |
| | | func (Supplier) TableName() string { |
| | | return "supplier" |
| | | return "srm_supplier" |
| | | } |
| | |
| | | |
| | | // TableName SupplierType 表名 |
| | | func (SupplierType) TableName() string { |
| | | return "supplier_type" |
| | | return "srm_supplier_type" |
| | | } |
| | |
| | | var ids []uint |
| | | var purchaseList = make([]*purchase.Purchase, 0) |
| | | if info.Keyword != "" { |
| | | db.Distinct("purchases.id").Joins("left join purchase_products on purchase_products.purchase_id = purchases.id"). |
| | | Joins("left join Product on Product.Id = purchase_products.product_id"). |
| | | Joins("left join supplier on supplier.Id = purchases.supplier_id"). |
| | | Where("purchases.name like ?", "%"+info.Keyword+"%"). |
| | | Or("Product.name like ?", "%"+info.Keyword+"%"). |
| | | Or("supplier.name like ?", "%"+info.Keyword+"%") |
| | | db.Distinct("srm_purchase.id").Joins("left join srm_purchase_products on srm_purchase_products.purchase_id = srm_purchase.id"). |
| | | Joins("left join srm_product on srm_product.Id = srm_purchase_products.product_id"). |
| | | Joins("left join srm_supplier on srm_supplier.Id = srm_purchase.supplier_id"). |
| | | Where("srm_purchase.name like ?", "%"+info.Keyword+"%"). |
| | | Or("srm_product.name like ?", "%"+info.Keyword+"%"). |
| | | Or("srm_supplier.name like ?", "%"+info.Keyword+"%") |
| | | err = db.Limit(limit).Offset(offset).Find(&ids).Error |
| | | if err != nil { |
| | | return purchaseList, total, err |
| | |
| | | // 如果有条件搜索 下方会自动创建搜索语句 |
| | | //搜索框合一添加查询条件 |
| | | if info.Keyword != "" { |
| | | db = db.Where("Product.name LIKE ?", "%"+info.Keyword+"%").Joins("Supplier").Or("Supplier.name LIKE ?", "%"+info.Keyword+"%") |
| | | db = db.Where("srm_product.name LIKE ?", "%"+info.Keyword+"%").Joins("srm_supplier").Or("srm_supplier.name LIKE ?", "%"+info.Keyword+"%") |
| | | } |
| | | if info.StartCreatedAt != nil && info.EndCreatedAt != nil { |
| | | db = db.Where("created_at BETWEEN ? AND ?", info.StartCreatedAt, info.EndCreatedAt) |
| | |
| | | } |
| | | |
| | | if info.SupplierNumber != "" { |
| | | db = db.Joins("Supplier").Where("Supplier.number LIKE ?", "%"+info.SupplierNumber+"%") |
| | | db = db.Joins("srm_supplier").Where("srm_supplier.number LIKE ?", "%"+info.SupplierNumber+"%") |
| | | } |
| | | |
| | | if info.DeliveryTime != 0 { |
| | |
| | | db = db.Where("number LIKE ?", "%"+info.Number+"%") |
| | | } |
| | | if info.SupplierType != "" { |
| | | db = db.Where("supplier_type LIKE ?", "%"+info.SupplierType+"%") |
| | | db = db.Where("srm_supplier_type LIKE ?", "%"+info.SupplierType+"%") |
| | | } |
| | | if info.Industry != "" { |
| | | db = db.Where("industry LIKE ?", "%"+info.Industry+"%") |