1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package model
- import (
- "kpt-pasture/http/util"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- )
- type WorkOrder struct {
- Id int64 `json:"id"`
- Name string `json:"name"`
- CategoryId pasturePb.WorkOrderCategory_Kind `json:"categoryId"`
- CategoryName string `json:"categoryName"`
- Priority pasturePb.Priority_Kind `json:"priority"`
- ExecTime string `json:"execTime"`
- SubscribeUnit pasturePb.WorkOrderSubscribeUnit_Kind `json:"subscribeUnit"`
- ExecPersons string `json:"execPersons"`
- ExecDepartmental string `json:"execDepartmental"`
- IsShow pasturePb.IsShow_Kind `json:"isShow"`
- Photos string `json:"photos"`
- Remarks string `json:"remarks"`
- OperationId int64 `json:"operationId"`
- OperationName string `json:"operationName"`
- CreatedAt int64 `json:"createdAt"`
- UpdatedAt int64 `json:"updatedAt"`
- }
- func (w *WorkOrder) TableName() string {
- return "work_order"
- }
- func NewWorkOrder(req *pasturePb.WorkOrderList, systemUser *SystemUser, workOrderCategoryMap map[pasturePb.WorkOrderCategory_Kind]string) *WorkOrder {
- return &WorkOrder{
- Name: req.Name,
- CategoryId: req.CategoryId,
- CategoryName: workOrderCategoryMap[req.CategoryId],
- Priority: req.Priority,
- ExecTime: req.ExecTime,
- SubscribeUnit: req.SubscribeUnit,
- ExecPersons: util.Int32SliceToString(req.ExecPersons, ","),
- ExecDepartmental: util.Int32SliceToString(req.ExecDepartmental, ","),
- IsShow: req.IsShow,
- Photos: "",
- Remarks: req.Remarks,
- OperationId: systemUser.Id,
- OperationName: systemUser.Name,
- }
- }
|