feat:完善项目
This commit is contained in:
@ -50,3 +50,56 @@ func (*Config) Area(c *gin.Context) {
|
||||
data := config.NewInstance()(getSession()(c).(*service.Session)).Area(form.Key)
|
||||
APIResponse(nil, data)(c)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/config/breakdown 故障信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName ConfigBreakdown
|
||||
* @apiGroup Config
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {String} [title="''"] 标题名称
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
* @apiSuccess (200) {String} data.title 标题名称
|
||||
* @apiSuccess (200) {String} data.remark 备注信息
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "remark": "",
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Config) Breakdown(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
PageForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := config.NewBreakdown()(getSession()(c).(*service.Session)).List(form.Title, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Config) BreakdownAdd() {
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,40 @@ type roleForm struct {
|
||||
* @apiDefine Role 角色管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @api {get} /api/v1/role/list 角色列表
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName RoleList
|
||||
* @apiGroup Role
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 具体信息
|
||||
* @apiSuccess (200) {String} data.id 角色ID
|
||||
* @apiSuccess (200) {String} data.name 角色名称
|
||||
* @apiSuccess (200) {Array} data.children="[]" 子集
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "EgmJ4Ga7LQ",
|
||||
* "name": "分管领导",
|
||||
* "children": [
|
||||
* {
|
||||
* "id": "7K1Jx6VYod",
|
||||
* "name": "区域支队",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Role) List(c *gin.Context) {
|
||||
data, err := role.NewInstance()(getSession()(c).(*service.Session)).List()
|
||||
APIResponse(err, data)(c)
|
||||
@ -74,7 +108,7 @@ func (a *Role) Delete(c *gin.Context) {
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 具体信息
|
||||
* @apiSuccess (200) {Number} data.id 菜单ID
|
||||
* @apiSuccess (200) {String} data.id 菜单ID
|
||||
* @apiSuccess (200) {Number} data.parent_id 父级ID
|
||||
* @apiSuccess (200) {String} data.name 菜单名称
|
||||
* @apiSuccess (200) {Number} data.kind 类型(1:目录,2:菜单)
|
||||
@ -129,7 +163,7 @@ func (a *Role) Menu(c *gin.Context) {
|
||||
* @apiHeader {string} x-token token
|
||||
*
|
||||
* @apiParam {Number} role_id 角色ID
|
||||
* @apiParam {Array.Number} menu_ids 菜单ID
|
||||
* @apiParam {Array.String} menu_ids 菜单ID
|
||||
*
|
||||
* @apiSuccess (200) {Number} code=200 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg="ok" 成功提示
|
||||
@ -145,12 +179,20 @@ func (a *Role) Menu(c *gin.Context) {
|
||||
func (a *Role) MenuBind(c *gin.Context) {
|
||||
form := &struct {
|
||||
RoleID uint64 `json:"role_id" form:"role_id" binding:"required"`
|
||||
MenuIDs []uint64 `json:"menu_ids" form:"menu_ids" binding:"required"`
|
||||
MenuIDs []string `json:"menu_ids" form:"menu_ids" binding:"required"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.MenuIDs)
|
||||
menuIDs := make([]uint64, 0)
|
||||
|
||||
handle := new(IDStringForm)
|
||||
|
||||
for _, v := range form.MenuIDs {
|
||||
handle.ID = v
|
||||
menuIDs = append(menuIDs, handle.Convert())
|
||||
}
|
||||
err := role.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, menuIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
@ -1,7 +1,80 @@
|
||||
package api
|
||||
|
||||
type Work struct{}
|
||||
import (
|
||||
"ArmedPolice/app/controller/work"
|
||||
"ArmedPolice/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
/**
|
||||
* @apiDefine Work 工单管理
|
||||
*/
|
||||
|
||||
type Work struct{}
|
||||
|
||||
/**
|
||||
* @api {post} /api/v1/work/list 工单信息
|
||||
* @apiVersion 1.0.0
|
||||
* @apiName WorkList
|
||||
* @apiGroup Work
|
||||
*
|
||||
* @apiHeader {string} x-token token
|
||||
* @apiHeader {string} Content-Type=application/json 传输方式
|
||||
*
|
||||
* @apiParam {String} [material_id=0] 装备ID
|
||||
* @apiParam {String} [kind=0] 工单类型
|
||||
* @apiParam {Number} current 当前页
|
||||
* @apiParam {Number} page_size 页展示数
|
||||
*
|
||||
* @apiSuccess (200) {Number} code 成功响应状态码!
|
||||
* @apiSuccess (200) {String} msg 成功提示
|
||||
* @apiSuccess (200) {Array} data 数据信息
|
||||
* @apiSuccess (200) {String} data.id ID
|
||||
* @apiSuccess (200) {String} data.title 标题名称
|
||||
* @apiSuccess (200) {String} data.material_code 装备编码
|
||||
* @apiSuccess (200) {String} data.material_title 装备名称
|
||||
* @apiSuccess (200) {String} data.breakdown_title 故障信息
|
||||
* @apiSuccess (200) {Number} data.priority 紧急状态(1:普通,2:紧急,3:非常紧急)
|
||||
* @apiSuccess (200) {Number} data.status 状态(0:进行中,1:已完成)
|
||||
* @apiSuccess (200) {Time} data.created_at 创建时间
|
||||
*
|
||||
* @apiSuccessExample {json} Success response:
|
||||
* HTTPS 200 OK
|
||||
* {
|
||||
* "code": 200
|
||||
* "msg": "ok"
|
||||
* "data": [
|
||||
* {
|
||||
* "id": "m9Qa2ZaOvE",
|
||||
* "title": "刹车盘",
|
||||
* "material_code": "装备编码",
|
||||
* "material_title": "装备名称",
|
||||
* "breakdown_title": "发动机,刹车盘",
|
||||
* "priority": 1,
|
||||
* "status": 0,
|
||||
* "created_at": "2021-11-05T14:24:07+08:00",
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
func (*Work) Instance(c *gin.Context) {
|
||||
form := &struct {
|
||||
MaterialID uint64 `json:"material_id" form:"material_id"`
|
||||
Kind int `json:"kind" form:"kind"`
|
||||
PageForm
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := work.NewInstance()(getSession()(c).(*service.Session)).List(form.MaterialID, form.Kind, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Work) Launch(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (*Work) Examine(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
@ -46,10 +46,12 @@ func initModel() {
|
||||
&synchronized{iModel: model.NewSysUserRole()},
|
||||
// 日志管理
|
||||
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
||||
&synchronized{iModel: model.NewSysBreakdown()},
|
||||
// 功能信息
|
||||
&synchronized{iModel: model.NewManageSupplier()},
|
||||
&synchronized{iModel: model.NewManageMaterial()}, &synchronized{iModel: model.NewManageMaterialSupplier()},
|
||||
&synchronized{iModel: model.NewManageMaterialPurchase()}, &synchronized{iModel: model.NewManageMaterialWarehouse()},
|
||||
&synchronized{iModel: model.NewWorkInstance()},
|
||||
)
|
||||
}
|
||||
func initCacheMode() {
|
||||
|
18
app/common/model/sys_breakdown.go
Normal file
18
app/common/model/sys_breakdown.go
Normal file
@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
// SysBreakdown 故障信息数据模型
|
||||
type SysBreakdown struct {
|
||||
Model
|
||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:标题" json:"title"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注 " json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *SysBreakdown) TableName() string {
|
||||
return "sys_breakdown"
|
||||
}
|
||||
|
||||
func NewSysBreakdown() *SysBreakdown {
|
||||
return &SysBreakdown{}
|
||||
}
|
@ -3,7 +3,6 @@ package model
|
||||
// SysRole 角色管理数据模型
|
||||
type SysRole struct {
|
||||
Model
|
||||
ModelTenant
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:角色备注" json:"remark"`
|
||||
|
16
app/common/model/work_detail.go
Normal file
16
app/common/model/work_detail.go
Normal file
@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
// WorkDetail 工单详细信息
|
||||
type WorkDetail struct {
|
||||
Model
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *WorkDetail) TableName() string {
|
||||
return "work_detail"
|
||||
}
|
||||
|
||||
func NewWorkDetail() *WorkDetail {
|
||||
return &WorkDetail{}
|
||||
}
|
@ -1,14 +1,57 @@
|
||||
package model
|
||||
|
||||
// WorkInstance 工单数据模型
|
||||
type WorkInstance struct {
|
||||
Model
|
||||
Title string `json:"title"`
|
||||
ModelTenant
|
||||
OrderNo string `gorm:"column:order_no;type:varchar(30);default:null;comment:工单单号" json:"order_no"`
|
||||
Kind int `gorm:"column:kind;type:tinyint(1);default:0;comment:工单类型" json:"kind"`
|
||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:工单标题" json:"title"`
|
||||
MaterialID uint64 `gorm:"column:material_id;type:int(11);default:0;comment:装备ID" json:"material_id"`
|
||||
PlateNumber string `gorm:"column:plate_number;type:varchar(10);default:null;comment:车牌号" json:"plate_number"`
|
||||
Breakdown string `gorm:"column:breakdown;type:varchar(150);default:null;comment:故障" json:"breakdown"`
|
||||
Priority WorkInstancePriority `gorm:"column:priority;type:tinyint(1);default:1;comment:工单优先级" json:"priority"`
|
||||
Progress int `gorm:"column:progress;type:tinyint(1);default:1;comment:工单进度" json:"progress"`
|
||||
Status WorkInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:工单状态" json:"status"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// WorkInstanceKind 工单类型
|
||||
type WorkInstanceKind int
|
||||
|
||||
const (
|
||||
// WorkInstanceKindForOutside 外修
|
||||
WorkInstanceKindForOutside WorkInstanceKind = iota + 1
|
||||
// WorkInstanceKindForWithin 内修
|
||||
WorkInstanceKindForWithin
|
||||
)
|
||||
|
||||
// WorkInstancePriority 工单优先级
|
||||
type WorkInstancePriority int
|
||||
|
||||
const (
|
||||
// WorkInstancePriorityForCommonly 一般
|
||||
WorkInstancePriorityForCommonly WorkInstancePriority = iota + 1
|
||||
// WorkInstancePriorityForUrgent 紧急
|
||||
WorkInstancePriorityForUrgent
|
||||
// WorkInstancePriorityForVeryUrgent 非常紧急
|
||||
WorkInstancePriorityForVeryUrgent
|
||||
)
|
||||
|
||||
// WorkInstanceStatus 工单状态
|
||||
type WorkInstanceStatus int
|
||||
|
||||
const (
|
||||
// WorkInstanceStatusForOngoing 进行中
|
||||
WorkInstanceStatusForOngoing WorkInstanceStatus = iota
|
||||
// WorkInstanceStatusForComplete 已完成
|
||||
WorkInstanceStatusForComplete
|
||||
)
|
||||
|
||||
func (m *WorkInstance) TableName() string {
|
||||
return "manage_instance"
|
||||
return "work_instance"
|
||||
}
|
||||
|
||||
func NewWorkInstance() *WorkInstance {
|
||||
|
19
app/common/model/work_progress.go
Normal file
19
app/common/model/work_progress.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
// WorkProgress 工单进度数据模型
|
||||
type WorkProgress struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
WorkID uint64 `gorm:"column:work_id;type:int(11);default:0;comment:工单ID" json:"-"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *WorkProgress) TableName() string {
|
||||
return "work_progress"
|
||||
}
|
||||
|
||||
func NewWorkProgress() *WorkProgress {
|
||||
return &WorkProgress{}
|
||||
}
|
@ -1,11 +1,27 @@
|
||||
package model
|
||||
|
||||
// WorkSchedule 工单流程数据模型
|
||||
type WorkSchedule struct {
|
||||
Model
|
||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:标题" json:"title"`
|
||||
Stage int `orm:"column:stage;type:tinyint(1);default:1;comment:阶段" json:"stage"`
|
||||
Step int `orm:"column:step;type:tinyint(1);default:1;comment:步骤(1:阶段-1:步骤)" json:"step"`
|
||||
Target WorkScheduleTarget `orm:"column:target;type:tinyint(1);default:1;comment:对象类型" json:"target"`
|
||||
TargetValue string `orm:"column:target_value;type:tinyint(1);default:1;comment:对象信息" json:"target_value"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// WorkScheduleTarget 工单对象类型
|
||||
type WorkScheduleTarget int
|
||||
|
||||
const (
|
||||
// WorkScheduleTargetForPerson 个人
|
||||
WorkScheduleTargetForPerson int = iota + 1
|
||||
// WorkScheduleTargetForRole 角色
|
||||
WorkScheduleTargetForRole
|
||||
)
|
||||
|
||||
func (m *WorkSchedule) TableName() string {
|
||||
return "work_schedule"
|
||||
}
|
||||
|
58
app/controller/config/breakdown.go
Normal file
58
app/controller/config/breakdown.go
Normal file
@ -0,0 +1,58 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
model2 "ArmedPolice/app/common/model"
|
||||
"ArmedPolice/app/controller/basic"
|
||||
"ArmedPolice/app/model"
|
||||
"ArmedPolice/app/service"
|
||||
)
|
||||
|
||||
type Breakdown struct{ *service.Session }
|
||||
|
||||
type BreakdownHandle func(session *service.Session) *Breakdown
|
||||
|
||||
type BreakdownInfo struct {
|
||||
basic.CommonIDString
|
||||
*model2.SysBreakdown
|
||||
}
|
||||
|
||||
func (c *Breakdown) List(title string, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mSysBreakdown := model.NewSysBreakdown()
|
||||
|
||||
out := make([]*model2.SysBreakdown, 0)
|
||||
|
||||
where := &model2.ModelWhereOrder{
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}
|
||||
if title != "" {
|
||||
where.Where = model2.NewWhereLike("title", title)
|
||||
}
|
||||
var count int64
|
||||
|
||||
if err := model2.Pages(mSysBreakdown.SysBreakdown, &out, page, pageSize, &count, where); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*BreakdownInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &BreakdownInfo{
|
||||
CommonIDString: basic.CommonIDString{ID: v.GetEncodeID()},
|
||||
SysBreakdown: v,
|
||||
})
|
||||
}
|
||||
return &basic.PageDataResponse{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func (c *Breakdown) Form(id uint64, title, remark string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Breakdown) Delete(id uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewBreakdown() BreakdownHandle {
|
||||
return func(session *service.Session) *Breakdown {
|
||||
return &Breakdown{session}
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package work
|
||||
|
||||
import (
|
||||
model2 "ArmedPolice/app/common/model"
|
||||
"ArmedPolice/app/controller/basic"
|
||||
"ArmedPolice/app/model"
|
||||
"ArmedPolice/app/service"
|
||||
)
|
||||
|
||||
@ -9,8 +11,47 @@ type Instance struct{ *service.Session }
|
||||
|
||||
type InstanceHandle func(session *service.Session) *Instance
|
||||
|
||||
func (c *Instance) List() (*basic.ReturnPages, error) {
|
||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
||||
type (
|
||||
// InstanceInfo 基本信息
|
||||
InstanceInfo struct {
|
||||
basic.CommonIDString
|
||||
*model.WorkInstanceInfo
|
||||
}
|
||||
)
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(materialID uint64, kind, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mWorkInstance := model.NewWorkInstance()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if materialID > 0 {
|
||||
where = append(where, model2.NewWhere("w.material_id", materialID))
|
||||
}
|
||||
if kind > 0 {
|
||||
where = append(where, model2.NewWhere("w.kind", kind))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mWorkInstance.Instances(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*InstanceInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mWorkInstance.ID = v.ID
|
||||
|
||||
list = append(list, &InstanceInfo{
|
||||
CommonIDString: basic.CommonIDString{ID: mWorkInstance.GetEncodeID()}, WorkInstanceInfo: v,
|
||||
})
|
||||
}
|
||||
return &basic.PageDataResponse{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
func (c *Instance) ToDo() {
|
||||
|
||||
}
|
||||
|
||||
func (c *Instance) Form() error {
|
||||
|
11
app/model/sys_breakdown.go
Normal file
11
app/model/sys_breakdown.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "ArmedPolice/app/common/model"
|
||||
|
||||
type SysBreakdown struct {
|
||||
*model.SysBreakdown
|
||||
}
|
||||
|
||||
func NewSysBreakdown() *SysBreakdown {
|
||||
return &SysBreakdown{}
|
||||
}
|
54
app/model/work_instance.go
Normal file
54
app/model/work_instance.go
Normal file
@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"ArmedPolice/app/common/model"
|
||||
"ArmedPolice/serve/orm"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type WorkInstance struct {
|
||||
*model.WorkInstance
|
||||
}
|
||||
|
||||
// WorkInstanceInfo 基本信息
|
||||
type WorkInstanceInfo struct {
|
||||
ID uint64 `json:"-"`
|
||||
Title string `json:"title"`
|
||||
MaterialCode string `json:"material_code"`
|
||||
MaterialTitle string `json:"material_title"`
|
||||
BreakdownTitle string `json:"breakdown_title"`
|
||||
Priority int `json:"priority"`
|
||||
Status int `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// Instances 基本信息
|
||||
func (m *WorkInstance) Instances(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*WorkInstanceInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS w").
|
||||
Select("w.id", "w.title", "m.code AS material_code", "m.title AS material_title", "w.priority",
|
||||
"GROUP_CONCAT(b.title) AS breakdown_title", "w.status", "w.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS m ON w.material_id = m.id", model.NewManageMaterial().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS b ON FIND_IN_SET(b.id, w.breakdown)", model.NewSysBreakdown().TableName())).
|
||||
Where("w.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Group("w.id")
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, wo := range where {
|
||||
db = db.Where(wo.Condition, wo.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*WorkInstanceInfo, 0)
|
||||
|
||||
if err := db.Order("w.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewWorkInstance() *WorkInstance {
|
||||
return &WorkInstance{model.NewWorkInstance()}
|
||||
}
|
@ -23,12 +23,12 @@
|
||||
"sampleUrl": "http://127.0.0.1:8010",
|
||||
"order": [
|
||||
"Account",
|
||||
"Captcha",
|
||||
"Upload",
|
||||
"Config",
|
||||
"User",
|
||||
"Menu",
|
||||
"Role",
|
||||
"Captcha",
|
||||
"Upload",
|
||||
"Manage"
|
||||
]
|
||||
},
|
||||
|
@ -57,6 +57,7 @@ func (this *Router) registerAPI() {
|
||||
{
|
||||
_api := new(api.Config)
|
||||
configV1.GET("/area", _api.Area)
|
||||
configV1.POST("/breakdown", _api.Breakdown)
|
||||
}
|
||||
// Tenant 租户单位管理
|
||||
tenantV1 := v1.Group("/tenant")
|
||||
@ -89,7 +90,7 @@ func (this *Router) registerAPI() {
|
||||
roleV1 := v1.Group("/role")
|
||||
{
|
||||
_api := new(api.Role)
|
||||
roleV1.POST("/list", _api.List)
|
||||
roleV1.GET("/list", _api.List)
|
||||
roleV1.POST("/add", _api.Add)
|
||||
roleV1.POST("/menu", _api.Edit)
|
||||
roleV1.POST("/delete", _api.Delete)
|
||||
@ -110,6 +111,12 @@ func (this *Router) registerAPI() {
|
||||
manageV1.POST("/material/edit", _api.MaterialEdit)
|
||||
manageV1.POST("/material/delete", _api.MaterialDelete)
|
||||
}
|
||||
// Work 工单管理
|
||||
workV1 := v1.Group("/work")
|
||||
{
|
||||
_api := new(api.Work)
|
||||
workV1.POST("/list", _api.Instance)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Router) Init() *gin.Engine {
|
||||
|
Reference in New Issue
Block a user