正在显示
12 个修改的文件
包含
140 行增加
和
9 行删除
| @@ -94,6 +94,7 @@ type ( | @@ -94,6 +94,7 @@ type ( | ||
| 94 | Name string `json:"name,optional"` // 模板名称 | 94 | Name string `json:"name,optional"` // 模板名称 |
| 95 | TemplateClass string `json:"templateClass,optional"` // 模板分类 | 95 | TemplateClass string `json:"templateClass,optional"` // 模板分类 |
| 96 | Target *int `json:"target,optional"` // 目标 0 全员 1 指定人 | 96 | Target *int `json:"target,optional"` // 目标 0 全员 1 指定人 |
| 97 | + TargetUser string `json:"targetUser,optional"` // 目标用户 | ||
| 97 | // BelongTos []int `json:"belongTos,optional"` // 归属 | 98 | // BelongTos []int `json:"belongTos,optional"` // 归属 |
| 98 | CompanyId int64 `json:",optional"` // 属于企业时有值 | 99 | CompanyId int64 `json:",optional"` // 属于企业时有值 |
| 99 | UserId int64 `json:",optional"` // 属于个人时有值 | 100 | UserId int64 `json:",optional"` // 属于个人时有值 |
| @@ -122,6 +123,7 @@ type ( | @@ -122,6 +123,7 @@ type ( | ||
| 122 | //UserId int64 `json:",optional"` // 属于个人时有值 | 123 | //UserId int64 `json:",optional"` // 属于个人时有值 |
| 123 | //BelongTo int `json:"belongTo,optional"` // 模板属于: 1:企业 、2:个人 | 124 | //BelongTo int `json:"belongTo,optional"` // 模板属于: 1:企业 、2:个人 |
| 124 | Name string `json:"name"` // 模板名称 | 125 | Name string `json:"name"` // 模板名称 |
| 126 | + Description string `json:"description"` // 描述 | ||
| 125 | TemplateClass string `json:"templateClass"` // 模板分类 | 127 | TemplateClass string `json:"templateClass"` // 模板分类 |
| 126 | Paragraphs []Paragraph `json:"paragraphs"` // 段落列表 | 128 | Paragraphs []Paragraph `json:"paragraphs"` // 段落列表 |
| 127 | Icon string `json:"icon,optional"` // 图标地址 | 129 | Icon string `json:"icon,optional"` // 图标地址 |
| @@ -47,7 +47,7 @@ func (l *MiniArticleTemplateSaveLogic) MiniArticleTemplateSave(req *types.Articl | @@ -47,7 +47,7 @@ func (l *MiniArticleTemplateSaveLogic) MiniArticleTemplateSave(req *types.Articl | ||
| 47 | dm.Operator = domain.Operator{ | 47 | dm.Operator = domain.Operator{ |
| 48 | Id: userToken.UserId, | 48 | Id: userToken.UserId, |
| 49 | Name: user.Name, | 49 | Name: user.Name, |
| 50 | - Type: 2, | 50 | + Type: domain.OperatorTypeUser, |
| 51 | } | 51 | } |
| 52 | if req.BelongTo == int(domain.BelongToCompany) { | 52 | if req.BelongTo == int(domain.BelongToCompany) { |
| 53 | dm.BelongTo = domain.BelongToCompany | 53 | dm.BelongTo = domain.BelongToCompany |
| @@ -36,6 +36,9 @@ func (l *SystemArticleTemplateBatchDeleteLogic) SystemArticleTemplateBatchDelete | @@ -36,6 +36,9 @@ func (l *SystemArticleTemplateBatchDeleteLogic) SystemArticleTemplateBatchDelete | ||
| 36 | if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, int64(id)); err != nil { | 36 | if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, int64(id)); err != nil { |
| 37 | return xerr.NewErrMsgErr("不存在", err) | 37 | return xerr.NewErrMsgErr("不存在", err) |
| 38 | } | 38 | } |
| 39 | + if dm.TemplateClass == domain.DefaultTemplateClass { | ||
| 40 | + return xerr.NewErrMsgErr("默认模板不可删除", nil) | ||
| 41 | + } | ||
| 39 | if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { | 42 | if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { |
| 40 | return err | 43 | return err |
| 41 | } | 44 | } |
| @@ -34,6 +34,9 @@ func (l *SystemArticleTemplateDeleteLogic) SystemArticleTemplateDelete(req *type | @@ -34,6 +34,9 @@ func (l *SystemArticleTemplateDeleteLogic) SystemArticleTemplateDelete(req *type | ||
| 34 | if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, req.Id); err != nil { | 34 | if dm, err = l.svcCtx.ArticleTemplateRepository.FindOne(l.ctx, conn, req.Id); err != nil { |
| 35 | return nil, xerr.NewErrMsgErr("不存在", err) | 35 | return nil, xerr.NewErrMsgErr("不存在", err) |
| 36 | } | 36 | } |
| 37 | + if dm.TemplateClass == domain.DefaultTemplateClass { | ||
| 38 | + return nil, xerr.NewErrMsgErr("默认模板不可删除", nil) | ||
| 39 | + } | ||
| 37 | if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | 40 | if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { |
| 38 | if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { | 41 | if dm, err = l.svcCtx.ArticleTemplateRepository.Delete(l.ctx, conn, dm); err != nil { |
| 39 | return err | 42 | return err |
| @@ -49,7 +49,7 @@ func (l *SystemArticleTemplateSaveLogic) SystemArticleTemplateSave(req *types.Ar | @@ -49,7 +49,7 @@ func (l *SystemArticleTemplateSaveLogic) SystemArticleTemplateSave(req *types.Ar | ||
| 49 | dm.Operator = domain.Operator{ | 49 | dm.Operator = domain.Operator{ |
| 50 | Id: userToken.UserId, | 50 | Id: userToken.UserId, |
| 51 | Name: userMe.User.NickName, | 51 | Name: userMe.User.NickName, |
| 52 | - Type: 1, | 52 | + Type: domain.OperatorTypeAdmin, |
| 53 | } | 53 | } |
| 54 | if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | 54 | if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { |
| 55 | dm, err = l.svcCtx.ArticleTemplateRepository.Insert(l.ctx, conn, dm) | 55 | dm, err = l.svcCtx.ArticleTemplateRepository.Insert(l.ctx, conn, dm) |
| @@ -75,6 +75,7 @@ func NewDomainArticleTemplate(item types.ArticleTemplateItem) *domain.ArticleTem | @@ -75,6 +75,7 @@ func NewDomainArticleTemplate(item types.ArticleTemplateItem) *domain.ArticleTem | ||
| 75 | TargetWhoReview: domain.ArticleTemplateTarget(item.TargetWhoReview), | 75 | TargetWhoReview: domain.ArticleTemplateTarget(item.TargetWhoReview), |
| 76 | WhoRead: item.WhoRead, | 76 | WhoRead: item.WhoRead, |
| 77 | WhoReview: item.WhoReview, | 77 | WhoReview: item.WhoReview, |
| 78 | + Sort: 1, | ||
| 78 | } | 79 | } |
| 79 | } | 80 | } |
| 80 | 81 | ||
| @@ -83,9 +84,19 @@ func NewTypesArticleTemplate(item *domain.ArticleTemplate) types.ArticleTemplate | @@ -83,9 +84,19 @@ func NewTypesArticleTemplate(item *domain.ArticleTemplate) types.ArticleTemplate | ||
| 83 | lo.ForEach(item.Paragraphs, func(p domain.Paragraph, index int) { | 84 | lo.ForEach(item.Paragraphs, func(p domain.Paragraph, index int) { |
| 84 | paragraphs = append(paragraphs, NewTypesParagraph(p)) | 85 | paragraphs = append(paragraphs, NewTypesParagraph(p)) |
| 85 | }) | 86 | }) |
| 87 | + // 目前固定,后期有需要添加描述字段 | ||
| 88 | + var description string | ||
| 89 | + if item.TemplateClass == domain.DefaultTemplateClass { | ||
| 90 | + if item.Name == "演绎式" { | ||
| 91 | + description = "从分析现象开始,查找发生原因,找出解决方案" | ||
| 92 | + } else if item.Name == "归纳式" { | ||
| 93 | + description = "从个别事务中概括出一般性概念、原则或结论" | ||
| 94 | + } | ||
| 95 | + } | ||
| 86 | return types.ArticleTemplateItem{ | 96 | return types.ArticleTemplateItem{ |
| 87 | Id: item.Id, | 97 | Id: item.Id, |
| 88 | Name: item.Name, | 98 | Name: item.Name, |
| 99 | + Description: description, | ||
| 89 | TemplateClass: item.TemplateClass, | 100 | TemplateClass: item.TemplateClass, |
| 90 | Paragraphs: paragraphs, | 101 | Paragraphs: paragraphs, |
| 91 | Icon: item.Icon, | 102 | Icon: item.Icon, |
| @@ -36,8 +36,11 @@ func (l *SystemArticleTemplateSearchLogic) SystemArticleTemplateSearch(req *type | @@ -36,8 +36,11 @@ func (l *SystemArticleTemplateSearchLogic) SystemArticleTemplateSearch(req *type | ||
| 36 | if req.Page > 0 && req.Size > 0 { | 36 | if req.Page > 0 && req.Size > 0 { |
| 37 | queryOptions.WithOffsetLimit(req.Page, req.Size) | 37 | queryOptions.WithOffsetLimit(req.Page, req.Size) |
| 38 | } | 38 | } |
| 39 | - queryOptions.WithKV("name", req.Name).WithKV("templateClass", req.TemplateClass). | ||
| 40 | - WithKV("companyId", req.CompanyId).WithKV("userId", req.UserId) | 39 | + queryOptions.WithKV("name", req.Name). |
| 40 | + WithKV("templateClass", req.TemplateClass). | ||
| 41 | + WithKV("companyId", req.CompanyId). | ||
| 42 | + WithKV("userId", req.UserId). | ||
| 43 | + WithKV("targetUser", req.TargetUser) | ||
| 41 | if req.Target != nil { | 44 | if req.Target != nil { |
| 42 | queryOptions.MustWithKV("target", *req.Target) | 45 | queryOptions.MustWithKV("target", *req.Target) |
| 43 | } | 46 | } |
| @@ -103,6 +103,9 @@ func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) ( | @@ -103,6 +103,9 @@ func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) ( | ||
| 103 | if err != nil { | 103 | if err != nil { |
| 104 | return nil, err | 104 | return nil, err |
| 105 | } | 105 | } |
| 106 | + if err = l.initCompanyTemplate(companyId, resp.UserId, resp.UserName); err != nil { | ||
| 107 | + return nil, err | ||
| 108 | + } | ||
| 106 | return | 109 | return |
| 107 | } | 110 | } |
| 108 | 111 | ||
| @@ -216,3 +219,54 @@ func (l *SystemUserInfoLogic) initSystemData(companyId int64) error { | @@ -216,3 +219,54 @@ func (l *SystemUserInfoLogic) initSystemData(companyId int64) error { | ||
| 216 | } | 219 | } |
| 217 | return nil | 220 | return nil |
| 218 | } | 221 | } |
| 222 | + | ||
| 223 | +// 初始化公司模板数据 | ||
| 224 | +func (l *SystemUserInfoLogic) initCompanyTemplate(companyId int64, uid int64, uname string) error { | ||
| 225 | + var conn = l.svcCtx.DefaultDBConn() | ||
| 226 | + if companyId <= 0 { | ||
| 227 | + return xerr.NewErrMsgErr("公司id不能为0", nil) | ||
| 228 | + } | ||
| 229 | + total, _, err := l.svcCtx.ArticleTemplateRepository.FindCompanyUnscoped(l.ctx, conn, companyId, domain.NewQueryOptions().WithCountOnly().WithKV("templateClass", domain.DefaultTemplateClass)) | ||
| 230 | + if err != nil { | ||
| 231 | + return err | ||
| 232 | + } | ||
| 233 | + if total == 0 { | ||
| 234 | + templateList := []*domain.ArticleTemplate{ | ||
| 235 | + NewDefaultArticleTemplate(companyId, "演绎式", uid, uname, 1), | ||
| 236 | + NewDefaultArticleTemplate(companyId, "归纳式", uid, uname, 2), | ||
| 237 | + } | ||
| 238 | + if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error { | ||
| 239 | + for _, tp := range templateList { | ||
| 240 | + tp, err = l.svcCtx.ArticleTemplateRepository.Insert(l.ctx, conn, tp) | ||
| 241 | + if err != nil { | ||
| 242 | + return err | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + return nil | ||
| 246 | + }, true); err != nil { | ||
| 247 | + return xerr.NewErrMsgErr("初始话公司数据失败", err) | ||
| 248 | + } | ||
| 249 | + } | ||
| 250 | + return nil | ||
| 251 | +} | ||
| 252 | + | ||
| 253 | +func NewDefaultArticleTemplate(companyId int64, name string, operatorId int64, operatorName string, sort int) *domain.ArticleTemplate { | ||
| 254 | + return &domain.ArticleTemplate{ | ||
| 255 | + CompanyId: companyId, | ||
| 256 | + Name: name, | ||
| 257 | + TemplateClass: domain.DefaultTemplateClass, | ||
| 258 | + BelongTo: domain.BelongToCompany, | ||
| 259 | + Paragraphs: []domain.Paragraph{}, | ||
| 260 | + Icon: "", | ||
| 261 | + TargetWhoRead: domain.ArticleTemplateAll, | ||
| 262 | + TargetWhoReview: domain.ArticleTemplateAll, | ||
| 263 | + WhoRead: []int64{}, | ||
| 264 | + WhoReview: []int64{}, | ||
| 265 | + Operator: domain.Operator{ | ||
| 266 | + Id: operatorId, | ||
| 267 | + Name: operatorName, | ||
| 268 | + Type: domain.OperatorTypeAdmin, | ||
| 269 | + }, | ||
| 270 | + Sort: sort, | ||
| 271 | + } | ||
| 272 | +} |
| @@ -1961,6 +1961,7 @@ type ArticleTemplateSearchRequest struct { | @@ -1961,6 +1961,7 @@ type ArticleTemplateSearchRequest struct { | ||
| 1961 | Name string `json:"name,optional"` // 模板名称 | 1961 | Name string `json:"name,optional"` // 模板名称 |
| 1962 | TemplateClass string `json:"templateClass,optional"` // 模板分类 | 1962 | TemplateClass string `json:"templateClass,optional"` // 模板分类 |
| 1963 | Target *int `json:"target,optional"` // 目标 0 全员 1 指定人 | 1963 | Target *int `json:"target,optional"` // 目标 0 全员 1 指定人 |
| 1964 | + TargetUser string `json:"targetUser,optional"` // 目标用户 | ||
| 1964 | CompanyId int64 `json:",optional"` // 属于企业时有值 | 1965 | CompanyId int64 `json:",optional"` // 属于企业时有值 |
| 1965 | UserId int64 `json:",optional"` // 属于个人时有值 | 1966 | UserId int64 `json:",optional"` // 属于个人时有值 |
| 1966 | } | 1967 | } |
| @@ -1990,6 +1991,7 @@ type ArticleTemplateClassItem struct { | @@ -1990,6 +1991,7 @@ type ArticleTemplateClassItem struct { | ||
| 1990 | type ArticleTemplateItem struct { | 1991 | type ArticleTemplateItem struct { |
| 1991 | Id int64 `json:"id,optional"` // 唯一标识 | 1992 | Id int64 `json:"id,optional"` // 唯一标识 |
| 1992 | Name string `json:"name"` // 模板名称 | 1993 | Name string `json:"name"` // 模板名称 |
| 1994 | + Description string `json:"description"` // 描述 | ||
| 1993 | TemplateClass string `json:"templateClass"` // 模板分类 | 1995 | TemplateClass string `json:"templateClass"` // 模板分类 |
| 1994 | Paragraphs []Paragraph `json:"paragraphs"` // 段落列表 | 1996 | Paragraphs []Paragraph `json:"paragraphs"` // 段落列表 |
| 1995 | Icon string `json:"icon,optional"` // 图标地址 | 1997 | Icon string `json:"icon,optional"` // 图标地址 |
| @@ -21,6 +21,7 @@ type ArticleTemplate struct { | @@ -21,6 +21,7 @@ type ArticleTemplate struct { | ||
| 21 | WhoRead []int64 `gorm:"type:jsonb;serializer:json" json:",omitempty"` // 谁可以看 | 21 | WhoRead []int64 `gorm:"type:jsonb;serializer:json" json:",omitempty"` // 谁可以看 |
| 22 | WhoReview []int64 `gorm:"type:jsonb;serializer:json" json:",omitempty"` // 查看、评论人 | 22 | WhoReview []int64 `gorm:"type:jsonb;serializer:json" json:",omitempty"` // 查看、评论人 |
| 23 | Operator domain.Operator `gorm:"type:jsonb;serializer:json" json:",omitempty"` | 23 | Operator domain.Operator `gorm:"type:jsonb;serializer:json" json:",omitempty"` |
| 24 | + Sort int `json:",omitempty"` | ||
| 24 | CreatedAt int64 `json:",omitempty"` | 25 | CreatedAt int64 `json:",omitempty"` |
| 25 | UpdatedAt int64 `json:",omitempty"` | 26 | UpdatedAt int64 `json:",omitempty"` |
| 26 | DeletedAt int64 `json:",omitempty"` | 27 | DeletedAt int64 `json:",omitempty"` |
| @@ -120,7 +120,7 @@ func (repository *ArticleTemplateRepository) Find(ctx context.Context, conn tran | @@ -120,7 +120,7 @@ func (repository *ArticleTemplateRepository) Find(ctx context.Context, conn tran | ||
| 120 | total int64 | 120 | total int64 |
| 121 | ) | 121 | ) |
| 122 | queryFunc := func() (interface{}, error) { | 122 | queryFunc := func() (interface{}, error) { |
| 123 | - tx = tx.Model(&ms).Order("id desc") | 123 | + tx = tx.Model(&ms).Order("id asc") |
| 124 | if v, ok := queryOptions["companyId"]; ok { | 124 | if v, ok := queryOptions["companyId"]; ok { |
| 125 | tx.Where("company_id = ? ", v) | 125 | tx.Where("company_id = ? ", v) |
| 126 | } | 126 | } |
| @@ -133,8 +133,48 @@ func (repository *ArticleTemplateRepository) Find(ctx context.Context, conn tran | @@ -133,8 +133,48 @@ func (repository *ArticleTemplateRepository) Find(ctx context.Context, conn tran | ||
| 133 | if v, ok := queryOptions["templateClass"]; ok { | 133 | if v, ok := queryOptions["templateClass"]; ok { |
| 134 | tx.Where("template_class = ? ", v) | 134 | tx.Where("template_class = ? ", v) |
| 135 | } | 135 | } |
| 136 | - if v, ok := queryOptions["target"]; ok { | ||
| 137 | - tx.Where("target_who_read = ? ", v) | 136 | + //if v, ok := queryOptions["target"]; ok { |
| 137 | + // tx.Where("target_who_read = ? ", v) | ||
| 138 | + //} | ||
| 139 | + if v, ok := queryOptions["targetUser"]; ok { | ||
| 140 | + tx.Where(`id in (select a.id from ( | ||
| 141 | +select id,json_array_elements_text(who_read::json)::integer user_id from article_template | ||
| 142 | +) a where a.user_id in( | ||
| 143 | + select id from "user" where name like ? | ||
| 144 | +))`, fmt.Sprintf("%%%v%%", v)) | ||
| 145 | + } | ||
| 146 | + if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | ||
| 147 | + return dms, tx.Error | ||
| 148 | + } | ||
| 149 | + return dms, nil | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + if _, err := repository.Query(queryFunc); err != nil { | ||
| 153 | + return 0, nil, err | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + for _, item := range ms { | ||
| 157 | + if dm, err := repository.ModelToDomainModel(item); err != nil { | ||
| 158 | + return 0, dms, err | ||
| 159 | + } else { | ||
| 160 | + dms = append(dms, dm) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + return total, dms, nil | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +func (repository *ArticleTemplateRepository) FindCompanyUnscoped(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*domain.ArticleTemplate, error) { | ||
| 167 | + var ( | ||
| 168 | + tx = conn.DB() | ||
| 169 | + ms []*models.ArticleTemplate | ||
| 170 | + dms = make([]*domain.ArticleTemplate, 0) | ||
| 171 | + total int64 | ||
| 172 | + ) | ||
| 173 | + queryFunc := func() (interface{}, error) { | ||
| 174 | + tx = tx.Model(&ms).Unscoped() | ||
| 175 | + tx.Where("company_id = ? ", companyId) | ||
| 176 | + if v, ok := queryOptions["templateClass"]; ok { | ||
| 177 | + tx.Where("template_class = ? ", v) | ||
| 138 | } | 178 | } |
| 139 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 179 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
| 140 | return dms, tx.Error | 180 | return dms, tx.Error |
| @@ -19,6 +19,7 @@ type ArticleTemplate struct { | @@ -19,6 +19,7 @@ type ArticleTemplate struct { | ||
| 19 | WhoRead []int64 `json:",omitempty"` // 谁可以看 | 19 | WhoRead []int64 `json:",omitempty"` // 谁可以看 |
| 20 | WhoReview []int64 `json:",omitempty"` // 查看、评论人 | 20 | WhoReview []int64 `json:",omitempty"` // 查看、评论人 |
| 21 | Operator Operator `json:",omitempty"` // 操作人(企业时有值) | 21 | Operator Operator `json:",omitempty"` // 操作人(企业时有值) |
| 22 | + Sort int `json:",omitempty"` // 排序 | ||
| 22 | CreatedAt int64 `json:",omitempty"` | 23 | CreatedAt int64 `json:",omitempty"` |
| 23 | UpdatedAt int64 `json:",omitempty"` | 24 | UpdatedAt int64 `json:",omitempty"` |
| 24 | DeletedAt int64 `json:",omitempty"` | 25 | DeletedAt int64 `json:",omitempty"` |
| @@ -32,6 +33,8 @@ type ArticleTemplateRepository interface { | @@ -32,6 +33,8 @@ type ArticleTemplateRepository interface { | ||
| 32 | Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTemplate) (*ArticleTemplate, error) | 33 | Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTemplate) (*ArticleTemplate, error) |
| 33 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTemplate, error) | 34 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTemplate, error) |
| 34 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleTemplate, error) | 35 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleTemplate, error) |
| 36 | + // FindCompanyUnscoped 公司存在过的模板 | ||
| 37 | + FindCompanyUnscoped(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*ArticleTemplate, error) | ||
| 35 | } | 38 | } |
| 36 | 39 | ||
| 37 | func (m *ArticleTemplate) Identify() interface{} { | 40 | func (m *ArticleTemplate) Identify() interface{} { |
| @@ -61,6 +64,10 @@ const ( | @@ -61,6 +64,10 @@ const ( | ||
| 61 | type ArticleTemplateTarget int | 64 | type ArticleTemplateTarget int |
| 62 | 65 | ||
| 63 | const ( | 66 | const ( |
| 64 | - ArticleTemplateAll ArticleTarget = 0 //所有人 | ||
| 65 | - ArticleTemplateLimit ArticleTarget = 1 //指定的人 | 67 | + ArticleTemplateAll ArticleTemplateTarget = 0 //所有人 |
| 68 | + ArticleTemplateLimit ArticleTemplateTarget = 1 //指定的人 | ||
| 69 | +) | ||
| 70 | + | ||
| 71 | +const ( | ||
| 72 | + DefaultTemplateClass = "常见论证类" | ||
| 66 | ) | 73 | ) |
| @@ -51,3 +51,8 @@ type Operator struct { | @@ -51,3 +51,8 @@ type Operator struct { | ||
| 51 | Name string `json:"name"` // 人员名字 | 51 | Name string `json:"name"` // 人员名字 |
| 52 | Type int `json:"type"` // 1:系统管理员 2:个人 | 52 | Type int `json:"type"` // 1:系统管理员 2:个人 |
| 53 | } | 53 | } |
| 54 | + | ||
| 55 | +const ( | ||
| 56 | + OperatorTypeAdmin = 1 | ||
| 57 | + OperatorTypeUser = 2 | ||
| 58 | +) |
-
请 注册 或 登录 后发表评论