作者 tangxvhui

bug 修复

1 package models 1 package models
2 2
3 type AdminPermission struct { 3 type AdminPermission struct {
4 - tableName struct{} `pg:"admin_permission"` 4 + tableName struct{} `pg:"admin_permission,alias:admin_permission"`
5 //id 5 //id
6 Id int `pg:",pk"` 6 Id int `pg:",pk"`
7 //权限名称、菜单名称 7 //权限名称、菜单名称
@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 ) 10 )
11 11
12 type AdminUser struct { 12 type AdminUser struct {
13 - tableName struct{} `pg:"admin_user"` 13 + tableName struct{} `pg:"admin_user,alias:admin_user"`
14 //id 14 //id
15 Id int64 `pg:",pk"` 15 Id int64 `pg:",pk"`
16 //用户账号 16 //用户账号
  1 +package models
  2 +
  3 +import "time"
  4 +
  5 +type Order struct {
  6 + tableName struct{} `pg:"order,alias:order"`
  7 + Id int64 `pg:",pk"`
  8 + //订单类型
  9 + OrderType int
  10 + //订单编号
  11 + OrderCode string
  12 + //订单名称
  13 + OrderName string
  14 + //订单状态
  15 + OrderStatus int
  16 + //数量
  17 + OrderCount int
  18 + //实际数量
  19 + OrderActualCount int
  20 + //订单金额
  21 + OrderAmount int
  22 + //实际订单金额
  23 + OrderActualAmount int
  24 + //订单已支付分红金额(货款)
  25 + OrderPaymentAmount int
  26 + //订单区域信息
  27 + OrderRegionInfo string
  28 + //买家
  29 + Buyer string
  30 + //合伙人id
  31 + PartnerId int64
  32 + //合伙人分红百分比
  33 + PartnerBonusPercent float64
  34 + //业务员分红百分比
  35 + SalesmanBonusPercent float64
  36 + //创建时间
  37 + CreateAt time.Time
  38 + //更新时间
  39 + UpdateAt time.Time
  40 + //最后查看得时间
  41 + LastViewTime time.Time
  42 +}
@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 ) 9 )
10 10
11 type PartnerInfo struct { 11 type PartnerInfo struct {
12 - tableName struct{} `pg:"partner_info"` 12 + tableName struct{} `pg:"partner_info,alias:partner_info"`
13 // 合伙人ID 13 // 合伙人ID
14 Id int64 `pg:",pk"` 14 Id int64 `pg:",pk"`
15 // 合伙人姓名 15 // 合伙人姓名
@@ -122,6 +122,7 @@ func (reponsitory AdminUserRepository) Find(queryOption domain.AdminUserFindQuer @@ -122,6 +122,7 @@ func (reponsitory AdminUserRepository) Find(queryOption domain.AdminUserFindQuer
122 err error 122 err error
123 adminuserReturn = make([]domain.AdminUser, 0) 123 adminuserReturn = make([]domain.AdminUser, 0)
124 ) 124 )
  125 + query = query.Order("admin_user.id DESC")
125 err = query.Select() 126 err = query.Select()
126 if err != nil { 127 if err != nil {
127 return adminuserReturn, err 128 return adminuserReturn, err
@@ -112,6 +112,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer @@ -112,6 +112,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer
112 err error 112 err error
113 partnerReturn = make([]domain.PartnerInfo, 0) 113 partnerReturn = make([]domain.PartnerInfo, 0)
114 ) 114 )
  115 + query = query.Order("partner_info.id DESC")
115 err = query.Select() 116 err = query.Select()
116 if err != nil { 117 if err != nil {
117 return partnerReturn, err 118 return partnerReturn, err