| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package model
- import (
- model2 "cold-delivery/common/model"
- "errors"
- "gorm.io/gorm"
- )
- // SysPost 岗位表
- type SysPost struct {
- model2.Model
- PostName string `json:"postName" gorm:"size:128;not null;comment:岗位名称"`
- PostCode string `json:"postCode" gorm:"size:128;not null;comment:岗位编码"`
- Sort int `json:"sort" gorm:"size:4;default:0;comment:排序"`
- Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态 1停用 2正常"`
- Remark string `json:"remark" gorm:"size:255;comment:备注"`
- MenuIds []int `json:"menuIds" gorm:"-"`
- model2.ControlBy
- model2.ModelTime
- model2.DeptBy
- }
- func (SysPost) TableName() string {
- return "sys_post"
- }
- func (e *SysPost) Generate() model2.ActiveRecord {
- o := *e
- return &o
- }
- func (e *SysPost) GetId() interface{} {
- return e.Id
- }
- var (
- ErrForbidUpdateSysPost = errors.New("禁止修改系统岗位")
- ErrForbidDeleteSysPost = errors.New("禁止删除系统岗位")
- )
- func (e *SysPost) BeforeDelete(_ *gorm.DB) (err error) {
- if e.PostCode == "admin" {
- return ErrForbidDeleteSysPost
- }
- return
- }
- func (e *SysPost) BeforeUpdate(_ *gorm.DB) (err error) {
- if e.PostCode == "admin" {
- return ErrForbidUpdateSysPost
- }
- return
- }
|