company.go
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type Company struct {
Id int64 `json:"id,omitempty"` // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
Visible int `json:"visible,omitempty"` // 可见的 1:可见 0:不可见
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
}
type CompanyRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Company) (*Company, error)
Update(ctx context.Context, conn transaction.Conn, dm *Company) (*Company, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Company) (*Company, error)
Delete(ctx context.Context, conn transaction.Conn, dm *Company) (*Company, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Company, error)
FindOneByCode(ctx context.Context, conn transaction.Conn, code string) (*Company, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Company, error)
}
func (m *Company) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}
var DefaultCompanyLog = "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20231114/object/1699934114_3r7QHThtbWfEDWh7CAHSzzWytFPzsjF6.png"