feat:完善项目
This commit is contained in:
3
app/api/manage.go
Normal file
3
app/api/manage.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
type Manage struct{}
|
3
app/api/menu.go
Normal file
3
app/api/menu.go
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
type Menu struct{}
|
@ -2,7 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"ArmedPolice/app/common/model"
|
"ArmedPolice/app/common/model"
|
||||||
"ArmedPolice/app/controller/supplier"
|
"ArmedPolice/app/controller/manage"
|
||||||
"ArmedPolice/app/service"
|
"ArmedPolice/app/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
@ -29,7 +29,7 @@ func (*Supplier) Material(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data, err := supplier.NewInstance()(getSession()(c).(*service.Session)).
|
data, err := manage.NewSupplier()(getSession()(c).(*service.Session)).
|
||||||
List(form.Name, form.Mobile, model.ManageSupplierKindForMaterial, form.Page, form.PageSize)
|
List(form.Name, form.Mobile, model.ManageSupplierKindForMaterial, form.Page, form.PageSize)
|
||||||
APIResponse(err, data)
|
APIResponse(err, data)
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ func (*Supplier) MaterialAdd(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Form(&supplier.InstanceParams{
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Form(&manage.SupplierParams{
|
||||||
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||||
Kind: model.ManageSupplierKindForMaterial,
|
Kind: model.ManageSupplierKindForMaterial,
|
||||||
})
|
})
|
||||||
@ -57,7 +57,7 @@ func (*Supplier) MaterialEdit(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Form(&supplier.InstanceParams{
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Form(&manage.SupplierParams{
|
||||||
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||||
Kind: model.ManageSupplierKindForMaterial,
|
Kind: model.ManageSupplierKindForMaterial,
|
||||||
})
|
})
|
||||||
@ -71,7 +71,7 @@ func (*Supplier) MaterialDelete(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||||
APIResponse(err)
|
APIResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ func (*Supplier) Repair(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data, err := supplier.NewInstance()(getSession()(c).(*service.Session)).
|
data, err := manage.NewSupplier()(getSession()(c).(*service.Session)).
|
||||||
List(form.Name, form.Mobile, model.ManageSupplierKindForRepair, form.Page, form.PageSize)
|
List(form.Name, form.Mobile, model.ManageSupplierKindForRepair, form.Page, form.PageSize)
|
||||||
APIResponse(err, data)
|
APIResponse(err, data)
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ func (*Supplier) RepairAdd(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Form(&supplier.InstanceParams{
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Form(&manage.SupplierParams{
|
||||||
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||||
Kind: model.ManageSupplierKindForRepair,
|
Kind: model.ManageSupplierKindForRepair,
|
||||||
})
|
})
|
||||||
@ -113,7 +113,7 @@ func (*Supplier) RepairEdit(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Form(&supplier.InstanceParams{
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Form(&manage.SupplierParams{
|
||||||
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
ID: form.Convert(), Name: form.Name, Mobile: form.Mobile, Address: form.Address, Remark: form.Remark,
|
||||||
Kind: model.ManageSupplierKindForRepair,
|
Kind: model.ManageSupplierKindForRepair,
|
||||||
})
|
})
|
||||||
@ -127,6 +127,6 @@ func (*Supplier) RepairDelete(c *gin.Context) {
|
|||||||
APIFailure(err.(error))(c)
|
APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := supplier.NewInstance()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
err := manage.NewSupplier()(getSession()(c).(*service.Session)).Delete(form.Convert())
|
||||||
APIResponse(err)
|
APIResponse(err)
|
||||||
}
|
}
|
||||||
|
1
app/api/tenant.go
Normal file
1
app/api/tenant.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package api
|
@ -1,8 +1,13 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
|
// ManageEquipment 装备型号数据模型
|
||||||
type ManageEquipment struct {
|
type ManageEquipment struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
|
Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"`
|
||||||
|
Image
|
||||||
|
Config string `gorm:"column:config;type:varchar(255);default:null;comment:配置" json:"config"`
|
||||||
|
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注" json:"remark"`
|
||||||
ModelDeleted
|
ModelDeleted
|
||||||
ModelAt
|
ModelAt
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package supplier
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
model2 "ArmedPolice/app/common/model"
|
model2 "ArmedPolice/app/common/model"
|
||||||
@ -9,18 +9,18 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Instance struct{ *service.Session }
|
type Supplier struct{ *service.Session }
|
||||||
|
|
||||||
type InstanceHandle func(session *service.Session) *Instance
|
type SupplierHandle func(session *service.Session) *Supplier
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// InstanceInfo 基本信息
|
// SupplierInfo 基本信息
|
||||||
InstanceInfo struct {
|
SupplierInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
*model2.ManageSupplier
|
*model2.ManageSupplier
|
||||||
}
|
}
|
||||||
// InstanceParams 参数信息
|
// SupplierParams 参数信息
|
||||||
InstanceParams struct {
|
SupplierParams struct {
|
||||||
ID uint64
|
ID uint64
|
||||||
Name, Mobile, Address, Remark string
|
Name, Mobile, Address, Remark string
|
||||||
Kind model2.ManageSupplierKind
|
Kind model2.ManageSupplierKind
|
||||||
@ -28,7 +28,7 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// List 列表信息
|
// List 列表信息
|
||||||
func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.PageDataResponse, error) {
|
func (c *Supplier) List(name, mobile string, kind model2.ManageSupplierKind, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||||
mManageSupplier := model.NewManageSupplier()
|
mManageSupplier := model.NewManageSupplier()
|
||||||
|
|
||||||
out := make([]*model2.ManageSupplier, 0)
|
out := make([]*model2.ManageSupplier, 0)
|
||||||
@ -62,10 +62,10 @@ func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, pag
|
|||||||
if err := model2.Pages(mManageSupplier.ManageSupplier, &out, page, pageSize, &count, where...); err != nil {
|
if err := model2.Pages(mManageSupplier.ManageSupplier, &out, page, pageSize, &count, where...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
list := make([]*InstanceInfo, 0)
|
list := make([]*SupplierInfo, 0)
|
||||||
|
|
||||||
for _, v := range out {
|
for _, v := range out {
|
||||||
list = append(list, &InstanceInfo{
|
list = append(list, &SupplierInfo{
|
||||||
ID: v.GetEncodeID(), ManageSupplier: v,
|
ID: v.GetEncodeID(), ManageSupplier: v,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func (c *Instance) List(name, mobile string, kind model2.ManageSupplierKind, pag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Form 数据处理
|
// Form 数据处理
|
||||||
func (c *Instance) Form(params *InstanceParams) error {
|
func (c *Supplier) Form(params *SupplierParams) error {
|
||||||
mManageSupplier := model.NewManageSupplier()
|
mManageSupplier := model.NewManageSupplier()
|
||||||
|
|
||||||
if params.ID > 0 {
|
if params.ID > 0 {
|
||||||
@ -103,7 +103,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete 删除操作
|
// Delete 删除操作
|
||||||
func (c *Instance) Delete(id uint64) error {
|
func (c *Supplier) Delete(id uint64) error {
|
||||||
mManageSupplier := model.NewManageSupplier()
|
mManageSupplier := model.NewManageSupplier()
|
||||||
mManageSupplier.ID = id
|
mManageSupplier.ID = id
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ func (c *Instance) Delete(id uint64) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInstance() InstanceHandle {
|
func NewSupplier() SupplierHandle {
|
||||||
return func(session *service.Session) *Instance {
|
return func(session *service.Session) *Supplier {
|
||||||
return &Instance{session}
|
return &Supplier{session}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,16 +11,17 @@ type Instance struct{ *service.Session }
|
|||||||
|
|
||||||
type InstanceHandle func(session *service.Session) *Instance
|
type InstanceHandle func(session *service.Session) *Instance
|
||||||
|
|
||||||
func (c *Instance) List(name string, page, pageSize int) (*basic.ReturnPages, error) {
|
func (c *Instance) List(name string, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||||
mSysTenant := model.NewSysTenant()
|
mSysTenant := model.NewSysTenant()
|
||||||
|
|
||||||
out := make([]*model2.SysTenant, 0)
|
out := make([]*model2.SysTenant, 0)
|
||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
|
|
||||||
model2.Pages(mSysTenant.SysTenant, &out, page, pageSize, &count)
|
if err := model2.Pages(mSysTenant.SysTenant, &out, page, pageSize, &count); err != nil {
|
||||||
|
return nil, err
|
||||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
}
|
||||||
|
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Instance) Form() error {
|
func (c *Instance) Form() error {
|
||||||
|
@ -9,8 +9,8 @@ type Role struct{ *service.Session }
|
|||||||
|
|
||||||
type RoleHandle func(session *service.Session) *Role
|
type RoleHandle func(session *service.Session) *Role
|
||||||
|
|
||||||
func (c *Role) List() (*basic.ReturnPages, error) {
|
func (c *Role) List() (*basic.PageDataResponse, error) {
|
||||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Role) Form() error {
|
func (c *Role) Form() error {
|
||||||
|
@ -19,8 +19,8 @@ type {{.StrutName}} struct{ *service.Session }
|
|||||||
|
|
||||||
type {{.StrutName}}Handle func(session *service.Session) *{{.StrutName}}
|
type {{.StrutName}}Handle func(session *service.Session) *{{.StrutName}}
|
||||||
|
|
||||||
func (c *{{.StrutName}}) List() (*basic.ReturnPages, error) {
|
func (c *{{.StrutName}}) List() (*basic.PageDataResponse, error) {
|
||||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *{{.StrutName}}) Form() error {
|
func (c *{{.StrutName}}) Form() error {
|
||||||
|
Reference in New Issue
Block a user