liujiandao
2023-11-14 e095ef6b1d80cd361d9e1478bd86f00b28063996
数据库迁移到aps库
13个文件已修改
82 ■■■■■ 已修改文件
config.yaml 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/purchase/purchase.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/purchase/purchase_products.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/purchase/purchase_type.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/contract.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/industry.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/member.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/product.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/supplier.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/test/supplier_type.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/purchase/purchase.go 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/test/product.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/test/supplier.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
config.yaml
@@ -1,41 +1,3 @@
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:
@@ -84,7 +46,7 @@
  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
model/purchase/purchase.go
@@ -39,6 +39,10 @@
    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 (
model/purchase/purchase_products.go
@@ -16,3 +16,7 @@
    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"
}
model/purchase/purchase_type.go
@@ -11,3 +11,7 @@
    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"
}
model/test/contract.go
@@ -16,5 +16,5 @@
// TableName Contract 表名
func (Contract) TableName() string {
    return "contract"
    return "srm_contract"
}
model/test/industry.go
@@ -13,5 +13,5 @@
// TableName Industry 表名
func (Industry) TableName() string {
    return "industry"
    return "srm_industry"
}
model/test/member.go
@@ -14,5 +14,5 @@
// TableName Member 表名
func (Member) TableName() string {
    return "member"
    return "srm_member"
}
model/test/product.go
@@ -24,5 +24,5 @@
// TableName Product 表名
func (Product) TableName() string {
    return "product"
    return "srm_product"
}
model/test/supplier.go
@@ -28,5 +28,5 @@
// TableName Supplier 表名
func (Supplier) TableName() string {
    return "supplier"
    return "srm_supplier"
}
model/test/supplier_type.go
@@ -13,5 +13,5 @@
// TableName SupplierType 表名
func (SupplierType) TableName() string {
    return "supplier_type"
    return "srm_supplier_type"
}
service/purchase/purchase.go
@@ -130,12 +130,12 @@
    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
service/test/product.go
@@ -56,7 +56,7 @@
    // 如果有条件搜索 下方会自动创建搜索语句
    //搜索框合一添加查询条件
    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)
@@ -100,7 +100,7 @@
    }
    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 {
service/test/supplier.go
@@ -64,7 +64,7 @@
        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+"%")