From 2075c4bbdeae1f53a1625cdd205f08358af4999e Mon Sep 17 00:00:00 2001 From: hupeng Date: Tue, 27 Apr 2021 16:54:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=BB=9F=E4=B8=80=E9=A9=BC?= =?UTF-8?q?=E5=B3=B0=E6=96=B9=E5=BC=8F,sql=E6=96=B0=E5=A2=9Esys=5F?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/{base.go => BaseController.go} | 0 .../admin/{dept.go => DeptController.go} | 4 +- .../admin/{dict.go => DictController.go} | 4 +- .../admin/{job.go => JobController.go} | 4 +- .../admin/{login.go => LoginController.go} | 0 .../admin/{menu.go => MenuController.go} | 4 +- .../admin/{role.go => RoleController.go} | 4 +- .../admin/{tools.go => ToolsController.go} | 0 .../admin/{user.go => UserController.go} | 4 +- controllers/admin/dict_detail.go | 4 +- dto/{auth_user.go => AuthUser.go} | 0 dto/{base.go => BasePage.go} | 0 dto/{dict_post.go => DictPost.go} | 0 dto/{dict_query.go => DictQuery.go} | 0 dto/{role_menu.go => RoleMenu.go} | 0 dto/{user_pass.go => UserPass.go} | 0 dto/{user_post.go => UserPost.go} | 0 dto/{user_query.go => UserQuery.go} | 0 jwt/jwt.go | 6 +- main.go | 2 +- models/{base.go => BaseModel.go} | 0 models/{dept.go => SysDept.go} | 22 +- models/{dict.go => SysDict.go} | 16 +- models/{dict_detail.go => SysDictDetail.go} | 16 +- models/{job.go => SysJob.go} | 18 +- models/{log.go => SysLog.go} | 4 +- models/{menu.go => SysMenu.go} | 70 +-- models/{picture.go => SysPicture.go} | 4 +- models/SysRole.go | 75 +++ models/SysRoleDepts.go | 13 + models/SysRoleMenus.go | 30 ++ models/{user.go => SysUser.go} | 54 +-- models/SysUsersRoles.go | 23 + models/role.go | 75 --- models/role_depts.go | 13 - models/role_menus.go | 30 -- models/user.go-bak | 151 ------ models/users_roles.go | 23 - sql/yshop_go.sql | 429 +++++++++--------- vo/{jwt_user.go => JwtUser.go} | 0 vo/{login_vo.go => LoginVo.go} | 2 +- vo/{result_list.go => ResultList.go} | 0 vo/menu/{menu_vo.go => MenuVo.go} | 0 43 files changed, 479 insertions(+), 625 deletions(-) rename controllers/{base.go => BaseController.go} (100%) rename controllers/admin/{dept.go => DeptController.go} (97%) rename controllers/admin/{dict.go => DictController.go} (97%) rename controllers/admin/{job.go => JobController.go} (97%) rename controllers/admin/{login.go => LoginController.go} (100%) rename controllers/admin/{menu.go => MenuController.go} (98%) rename controllers/admin/{role.go => RoleController.go} (98%) rename controllers/admin/{tools.go => ToolsController.go} (100%) rename controllers/admin/{user.go => UserController.go} (98%) rename dto/{auth_user.go => AuthUser.go} (100%) rename dto/{base.go => BasePage.go} (100%) rename dto/{dict_post.go => DictPost.go} (100%) rename dto/{dict_query.go => DictQuery.go} (100%) rename dto/{role_menu.go => RoleMenu.go} (100%) rename dto/{user_pass.go => UserPass.go} (100%) rename dto/{user_post.go => UserPost.go} (100%) rename dto/{user_query.go => UserQuery.go} (100%) rename models/{base.go => BaseModel.go} (100%) rename models/{dept.go => SysDept.go} (65%) rename models/{dict.go => SysDict.go} (68%) rename models/{dict_detail.go => SysDictDetail.go} (75%) rename models/{job.go => SysJob.go} (70%) rename models/{log.go => SysLog.go} (84%) rename models/{menu.go => SysMenu.go} (65%) rename models/{picture.go => SysPicture.go} (78%) create mode 100644 models/SysRole.go create mode 100644 models/SysRoleDepts.go create mode 100644 models/SysRoleMenus.go rename models/{user.go => SysUser.go} (66%) create mode 100644 models/SysUsersRoles.go delete mode 100644 models/role.go delete mode 100644 models/role_depts.go delete mode 100644 models/role_menus.go delete mode 100644 models/user.go-bak delete mode 100644 models/users_roles.go rename vo/{jwt_user.go => JwtUser.go} (100%) rename vo/{login_vo.go => LoginVo.go} (73%) rename vo/{result_list.go => ResultList.go} (100%) rename vo/menu/{menu_vo.go => MenuVo.go} (100%) diff --git a/controllers/base.go b/controllers/BaseController.go similarity index 100% rename from controllers/base.go rename to controllers/BaseController.go diff --git a/controllers/admin/dept.go b/controllers/admin/DeptController.go similarity index 97% rename from controllers/admin/dept.go rename to controllers/admin/DeptController.go index b507586..a1ffed3 100644 --- a/controllers/admin/dept.go +++ b/controllers/admin/DeptController.go @@ -37,7 +37,7 @@ func (c *DeptController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *DeptController) Post() { - var model models.Dept + var model models.SysDept valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) @@ -59,7 +59,7 @@ func (c *DeptController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *DeptController) Put() { - var model models.Dept + var model models.SysDept valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) diff --git a/controllers/admin/dict.go b/controllers/admin/DictController.go similarity index 97% rename from controllers/admin/dict.go rename to controllers/admin/DictController.go index 78c247d..afc7229 100644 --- a/controllers/admin/dict.go +++ b/controllers/admin/DictController.go @@ -36,7 +36,7 @@ func (c *DictController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *DictController) Post() { - var dictModel models.Dict + var dictModel models.SysDict valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) b, _ := valid.Valid(&dictModel) @@ -58,7 +58,7 @@ func (c *DictController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *DictController) Put() { - var dictModel models.Dict + var dictModel models.SysDict valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) b, _ := valid.Valid(&dictModel) diff --git a/controllers/admin/job.go b/controllers/admin/JobController.go similarity index 97% rename from controllers/admin/job.go rename to controllers/admin/JobController.go index fb41499..4139827 100644 --- a/controllers/admin/job.go +++ b/controllers/admin/JobController.go @@ -37,7 +37,7 @@ func (c *JobController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *JobController) Post() { - var model models.Job + var model models.SysJob valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) @@ -59,7 +59,7 @@ func (c *JobController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *JobController) Put() { - var model models.Job + var model models.SysJob valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) diff --git a/controllers/admin/login.go b/controllers/admin/LoginController.go similarity index 100% rename from controllers/admin/login.go rename to controllers/admin/LoginController.go diff --git a/controllers/admin/menu.go b/controllers/admin/MenuController.go similarity index 98% rename from controllers/admin/menu.go rename to controllers/admin/MenuController.go index 7664552..d12055f 100644 --- a/controllers/admin/menu.go +++ b/controllers/admin/MenuController.go @@ -38,7 +38,7 @@ func (c *MenuController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *MenuController) Post() { - var model models.Menu + var model models.SysMenu valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) @@ -60,7 +60,7 @@ func (c *MenuController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *MenuController) Put() { - var model models.Menu + var model models.SysMenu valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) diff --git a/controllers/admin/role.go b/controllers/admin/RoleController.go similarity index 98% rename from controllers/admin/role.go rename to controllers/admin/RoleController.go index f0c06e8..2ca4588 100644 --- a/controllers/admin/role.go +++ b/controllers/admin/RoleController.go @@ -50,7 +50,7 @@ func (c *RoleController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *RoleController) Post() { - var model models.Role + var model models.SysRole valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) @@ -69,7 +69,7 @@ func (c *RoleController) Post() { // @router / [put] func (c *RoleController) Put() { - var model models.Role + var model models.SysRole valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) diff --git a/controllers/admin/tools.go b/controllers/admin/ToolsController.go similarity index 100% rename from controllers/admin/tools.go rename to controllers/admin/ToolsController.go diff --git a/controllers/admin/user.go b/controllers/admin/UserController.go similarity index 98% rename from controllers/admin/user.go rename to controllers/admin/UserController.go index 0dca2e8..fcb75ff 100644 --- a/controllers/admin/user.go +++ b/controllers/admin/UserController.go @@ -42,7 +42,7 @@ func (c *UserController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *UserController) Post() { - var model models.User + var model models.SysUser valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) @@ -64,7 +64,7 @@ func (c *UserController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *UserController) Put() { - var model models.User + var model models.SysUser valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) logs.Info("======start======") diff --git a/controllers/admin/dict_detail.go b/controllers/admin/dict_detail.go index 7ff3191..2942ee4 100644 --- a/controllers/admin/dict_detail.go +++ b/controllers/admin/dict_detail.go @@ -38,7 +38,7 @@ func (c *DictDetailController) GetAll() { // @Success 200 {object} controllers.Result // @router / [post] func (c *DictDetailController) Post() { - var model models.DictDetail + var model models.SysDictDetail valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) logs.Info(model) @@ -61,7 +61,7 @@ func (c *DictDetailController) Post() { // @Success 200 {object} controllers.Result // @router / [put] func (c *DictDetailController) Put() { - var model models.DictDetail + var model models.SysDictDetail valid := validation.Validation{} json.Unmarshal(c.Ctx.Input.RequestBody, &model) b, _ := valid.Valid(&model) diff --git a/dto/auth_user.go b/dto/AuthUser.go similarity index 100% rename from dto/auth_user.go rename to dto/AuthUser.go diff --git a/dto/base.go b/dto/BasePage.go similarity index 100% rename from dto/base.go rename to dto/BasePage.go diff --git a/dto/dict_post.go b/dto/DictPost.go similarity index 100% rename from dto/dict_post.go rename to dto/DictPost.go diff --git a/dto/dict_query.go b/dto/DictQuery.go similarity index 100% rename from dto/dict_query.go rename to dto/DictQuery.go diff --git a/dto/role_menu.go b/dto/RoleMenu.go similarity index 100% rename from dto/role_menu.go rename to dto/RoleMenu.go diff --git a/dto/user_pass.go b/dto/UserPass.go similarity index 100% rename from dto/user_pass.go rename to dto/UserPass.go diff --git a/dto/user_post.go b/dto/UserPost.go similarity index 100% rename from dto/user_post.go rename to dto/UserPost.go diff --git a/dto/user_query.go b/dto/UserQuery.go similarity index 100% rename from dto/user_query.go rename to dto/UserQuery.go diff --git a/jwt/jwt.go b/jwt/jwt.go index 5492af0..bd8f80f 100644 --- a/jwt/jwt.go +++ b/jwt/jwt.go @@ -37,7 +37,7 @@ func init() { verifyKey,_ = beego.AppConfig.String("jwt_token") } -func GenerateToken(m *models.User,d time.Duration) (string,error) { +func GenerateToken(m *models.SysUser,d time.Duration) (string,error) { m.Password = "" //m.Permissions = []string{} expireTime := time.Now().Add(d) @@ -123,13 +123,13 @@ func GetAdminUser(c *context.BeegoInput) (*vo.JwtUser, error) { } //返回 detail user -func GetAdminDetailUser(c *context.BeegoInput) *models.User { +func GetAdminDetailUser(c *context.BeegoInput) *models.SysUser { mytoken := c.Header("Authorization") token := strings.TrimSpace(mytoken[bearerLength:]) var key = common.REDIS_PREFIX_AUTH + token userMap, _:= redis.Get(key) jsonStr := userMap[key] - user := &models.User{} + user := &models.SysUser{} json.Unmarshal([]byte(jsonStr),user) return user } diff --git a/main.go b/main.go index 114c8b3..68d6bb6 100644 --- a/main.go +++ b/main.go @@ -122,7 +122,7 @@ func checkPermission(url string, method string, token string) int { var key = common.REDIS_PREFIX_AUTH + token userMap, _:= redis.Get(key) jsonStr := userMap[key] - user := &models.User{} + user := &models.SysUser{} json.Unmarshal([]byte(jsonStr),user) index := untils.Contains(user.Permissions,permission) diff --git a/models/base.go b/models/BaseModel.go similarity index 100% rename from models/base.go rename to models/BaseModel.go diff --git a/models/dept.go b/models/SysDept.go similarity index 65% rename from models/dept.go rename to models/SysDept.go index 275f2f7..dfef6b0 100644 --- a/models/dept.go +++ b/models/SysDept.go @@ -6,24 +6,24 @@ import ( "yixiang.co/yshop/untils" ) -type Dept struct { +type SysDept struct { Id int64 `json:"id"` Name string `json:"name" valid:"Required;"` Pid int64 `json:"pid"` Enabled int8 `json:"enabled" valid:"Required;"` - Children []Dept `orm:"-" json:"children"` + Children []SysDept `orm:"-" json:"children"` Label string `orm:"-" json:"label"` BaseModel } func init() { - orm.RegisterModel(new(Dept)) + orm.RegisterModel(new(SysDept)) } -func GetAllDepts(name string, enabled int8) []Dept { - var depts []Dept +func GetAllDepts(name string, enabled int8) []SysDept { + var depts []SysDept o := orm.NewOrm() - qs := o.QueryTable("dept").Filter("is_del",0) + qs := o.QueryTable("sys_dept").Filter("is_del",0) if name != "" { qs = qs.Filter("name",name) } @@ -35,8 +35,8 @@ func GetAllDepts(name string, enabled int8) []Dept { } //递归函数 -func RecursionDeptList(data []Dept, pid int64) []Dept { - var listTree = make([]Dept,0) +func RecursionDeptList(data []SysDept, pid int64) []SysDept { + var listTree = make([]SysDept,0) for _, value := range data { value.Label = value.Name if value.Pid == pid { @@ -47,13 +47,13 @@ func RecursionDeptList(data []Dept, pid int64) []Dept { return listTree } -func AddDept(m *Dept) (id int64, err error) { +func AddDept(m *SysDept) (id int64, err error) { o := orm.NewOrm() id, err = o.Insert(m) return } -func UpdateByDept(m *Dept) (err error) { +func UpdateByDept(m *SysDept) (err error) { o := orm.NewOrm() _, err = o.Update(m) return @@ -63,6 +63,6 @@ func DelByDept(ids []int64) (err error) { str := untils.ReturnQ(len(ids)) logs.Info(str) o := orm.NewOrm() - _, err = o.Raw("UPDATE dept SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() + _, err = o.Raw("UPDATE sys_dept SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() return } diff --git a/models/dict.go b/models/SysDict.go similarity index 68% rename from models/dict.go rename to models/SysDict.go index 08f503f..2c2e19d 100644 --- a/models/dict.go +++ b/models/SysDict.go @@ -6,7 +6,7 @@ import ( "yixiang.co/yshop/dto" ) -type Dict struct { +type SysDict struct { Id int64 `json:"id"` Name string `json:"name" valid:"Required;"` Remark string `json:"remark" valid:"Required;"` @@ -14,14 +14,14 @@ type Dict struct { } func init() { - orm.RegisterModel(new(Dict)) + orm.RegisterModel(new(SysDict)) } // get all -func GetAllDict(base dto.BasePage,query ...interface{}) (int,[]Dict) { +func GetAllDict(base dto.BasePage,query ...interface{}) (int,[]SysDict) { var ( - tableName = "dict" - dicts []Dict + tableName = "sys_dict" + dicts []SysDict condition = "" ) if base.Blurry != "" { @@ -37,13 +37,13 @@ func GetAllDict(base dto.BasePage,query ...interface{}) (int,[]Dict) { } // last inserted Id on success. -func AddDict(m *Dict) (id int64, err error) { +func AddDict(m *SysDict) (id int64, err error) { o := orm.NewOrm() id, err = o.Insert(m) return } -func UpdateByDict(m *Dict) (err error) { +func UpdateByDict(m *SysDict) (err error) { o := orm.NewOrm() _, err = o.Update(m) return @@ -51,6 +51,6 @@ func UpdateByDict(m *Dict) (err error) { func DelByDict(id int64) (err error) { o := orm.NewOrm() - _, err = o.Raw("UPDATE dict SET is_del = ? WHERE id = ?", 1, id).Exec() + _, err = o.Raw("UPDATE sys_dict SET is_del = ? WHERE id = ?", 1, id).Exec() return } \ No newline at end of file diff --git a/models/dict_detail.go b/models/SysDictDetail.go similarity index 75% rename from models/dict_detail.go rename to models/SysDictDetail.go index cb94ccf..77ccd16 100644 --- a/models/dict_detail.go +++ b/models/SysDictDetail.go @@ -6,7 +6,7 @@ import ( "yixiang.co/yshop/dto" ) -type DictDetail struct { +type SysDictDetail struct { Id int64 `json:"id"` Label string `json:"label" valid:"Required;"` Value string `json:"value" valid:"Required;"` @@ -17,14 +17,14 @@ type DictDetail struct { } func init() { - orm.RegisterModel(new(DictDetail)) + orm.RegisterModel(new(SysDictDetail)) } // get all -func GetAllDictDetail(base dto.BasePage,query ...interface{}) (int,[]DictDetail) { +func GetAllDictDetail(base dto.BasePage,query ...interface{}) (int,[]SysDictDetail) { var ( - tableName = "dict_detail" - lists []DictDetail + tableName = "sys_dict_detail" + lists []SysDictDetail condition = "" ) if base.Blurry != "" { @@ -47,13 +47,13 @@ func GetAllDictDetail(base dto.BasePage,query ...interface{}) (int,[]DictDetail) return total,lists } -func AddDictDetail(m *DictDetail) (id int64, err error) { +func AddDictDetail(m *SysDictDetail) (id int64, err error) { o := orm.NewOrm() id, err = o.Insert(m) return } -func UpdateByDictDetail(m *DictDetail) (err error) { +func UpdateByDictDetail(m *SysDictDetail) (err error) { o := orm.NewOrm() _, err = o.Update(m) return @@ -61,7 +61,7 @@ func UpdateByDictDetail(m *DictDetail) (err error) { func DelByDictDetail(id int64) (err error) { o := orm.NewOrm() - _, err = o.Raw("UPDATE dict_detail SET is_del = ? WHERE id = ?", 1, id).Exec() + _, err = o.Raw("UPDATE sys_dict_detail SET is_del = ? WHERE id = ?", 1, id).Exec() return } diff --git a/models/job.go b/models/SysJob.go similarity index 70% rename from models/job.go rename to models/SysJob.go index 41ec5e0..b68a76c 100644 --- a/models/job.go +++ b/models/SysJob.go @@ -7,26 +7,26 @@ import ( "yixiang.co/yshop/untils" ) -type Job struct { +type SysJob struct { Id int64 `json:"id"` Name string `json:"name" valid:"Required;"` Enabled int8 `json:"enabled"` Sort int8 `json:"sort"` //DeptId int64 `json:"deptId"` - Dept *Dept `json:"dept" orm:"column(dept_id);bigint;rel(one)""` + Dept *SysDept `json:"dept" orm:"column(dept_id);bigint;rel(one)""` BaseModel } func init() { - orm.RegisterModel(new(Job)) + orm.RegisterModel(new(SysJob)) } // get all -func GetAllJob(base dto.BasePage,query ...interface{}) (int,[]Job) { +func GetAllJob(base dto.BasePage,query ...interface{}) (int,[]SysJob) { var ( - tableName = "job" - lists []Job + tableName = "sys_job" + lists []SysJob condition = "" ) if base.Blurry != "" { @@ -51,13 +51,13 @@ func GetAllJob(base dto.BasePage,query ...interface{}) (int,[]Job) { return total,lists } -func AddJob(m *Job) (id int64, err error) { +func AddJob(m *SysJob) (id int64, err error) { o := orm.NewOrm() id, err = o.Insert(m) return } -func UpdateByJob(m *Job) (err error) { +func UpdateByJob(m *SysJob) (err error) { o := orm.NewOrm() _, err = o.Update(m) return @@ -66,6 +66,6 @@ func UpdateByJob(m *Job) (err error) { func DelByJob(ids []int64) (err error) { str := untils.ReturnQ(len(ids)) o := orm.NewOrm() - _, err = o.Raw("UPDATE job SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() + _, err = o.Raw("UPDATE sys_job SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() return } diff --git a/models/log.go b/models/SysLog.go similarity index 84% rename from models/log.go rename to models/SysLog.go index cbb8761..9e72c2d 100644 --- a/models/log.go +++ b/models/SysLog.go @@ -2,7 +2,7 @@ package models import "github.com/beego/beego/v2/client/orm" -type Log struct { +type SysLog struct { Id int64 Description string ExceptionDetail string @@ -19,5 +19,5 @@ type Log struct { } func init() { - orm.RegisterModel(new(Log)) + orm.RegisterModel(new(SysLog)) } \ No newline at end of file diff --git a/models/menu.go b/models/SysMenu.go similarity index 65% rename from models/menu.go rename to models/SysMenu.go index 79066fb..6c4514a 100644 --- a/models/menu.go +++ b/models/SysMenu.go @@ -7,36 +7,36 @@ import ( "yixiang.co/yshop/vo/menu" ) -type Menu struct { - Id int64 `json:"id"` - Name string `json:"name" valid:"Required;"` - IFrame int8 `json:"iframe"` - Component string `json:"component"` - Pid int64 `json:"pid"` - Sort int32 `json:"sort"` - Icon string `json:"icon"` - Path string `json:"path"` - Cache int8 `json:"cache"` - Hidden int8 `json:"hidden"` +type SysMenu struct { + Id int64 `json:"id"` + Name string `json:"name" valid:"Required;"` + IFrame int8 `json:"iframe"` + Component string `json:"component"` + Pid int64 `json:"pid"` + Sort int32 `json:"sort"` + Icon string `json:"icon"` + Path string `json:"path"` + Cache int8 `json:"cache"` + Hidden int8 `json:"hidden"` ComponentName string `json:"componentName"` - Permission string `json:"permission"` - Type int32 `json:"type"` - Router string `json:"router"` + Permission string `json:"permission"` + Type int32 `json:"type"` + Router string `json:"router"` RouterMethod string `json:"routerMethod"` - Children []Menu `json:"children" orm:"-"` - Label string `orm:"-" json:"label"` + Children []SysMenu `json:"children" orm:"-"` + Label string `orm:"-" json:"label"` BaseModel } func init() { - orm.RegisterModel(new(Menu)) + orm.RegisterModel(new(SysMenu)) } -func GetAllMenus(name string) []Menu { - var menus []Menu +func GetAllMenus(name string) []SysMenu { + var menus []SysMenu o := orm.NewOrm() - qs := o.QueryTable("menu").Filter("is_del",0) + qs := o.QueryTable("sys_menu").Filter("is_del",0) if name != "" { qs = qs.Filter("name",name) } @@ -46,8 +46,8 @@ func GetAllMenus(name string) []Menu { } //递归函数 -func RecursionMenuList(data []Menu, pid int64) []Menu { - var listTree = make([]Menu,0) +func RecursionMenuList(data []SysMenu, pid int64) []SysMenu { + var listTree = make([]SysMenu,0) for _, value := range data { value.Label = value.Name if value.Pid == pid { @@ -58,13 +58,13 @@ func RecursionMenuList(data []Menu, pid int64) []Menu { return listTree } -func AddMenu(m *Menu) (id int64, err error) { +func AddMenu(m *SysMenu) (id int64, err error) { o := orm.NewOrm() id, err = o.Insert(m) return } -func UpdateByMenu(m *Menu) (err error) { +func UpdateByMenu(m *SysMenu) (err error) { o := orm.NewOrm() _, err = o.Update(m) return @@ -74,15 +74,15 @@ func DelByMenu(ids []int64) (err error) { str := untils.ReturnQ(len(ids)) logs.Info(str) o := orm.NewOrm() - _, err = o.Raw("UPDATE menu SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() + _, err = o.Raw("UPDATE sys_menu SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() return } //获取权限string func FindByRouterAndMethod(url string, method string) (permission string) { o := orm.NewOrm() - var menu Menu - err := o.QueryTable(new(Menu)).Filter("router",url).Filter("router_method",method).One(&menu) + var menu SysMenu + err := o.QueryTable(new(SysMenu)).Filter("router",url).Filter("router_method",method).One(&menu) if err != nil { return "" } @@ -92,16 +92,16 @@ func FindByRouterAndMethod(url string, method string) (permission string) { func BuildMenus(uid int64) []menu.MenuVo { o := orm.NewOrm() var lists orm.ParamsList - _, err := o.Raw("SELECT r.* FROM role r, users_roles u " + + _, err := o.Raw("SELECT r.* FROM sys_role r, sys_users_roles u " + "WHERE r.id = u.role_id AND u.user_id = ?",uid).ValuesFlat(&lists,"id") if err != nil { logs.Error(err) } idsStr := untils.Convert(lists) logs.Info(idsStr) - var menus []Menu - _, e := o.Raw("select m.* from menu m LEFT OUTER JOIN roles_menus t on m.id= t.menu_id " + - "LEFT OUTER JOIN role r on r.id = t.role_id where m.is_del=0 and m.hidden=0 and m.type!=2 and r.id in (?)", + var menus []SysMenu + _, e := o.Raw("select m.* from sys_menu m LEFT OUTER JOIN sys_roles_menus t on m.id= t.menu_id " + + "LEFT OUTER JOIN sys_role r on r.id = t.role_id where m.is_del=0 and m.hidden=0 and m.type!=2 and r.id in (?)", idsStr).QueryRows(&menus) if e != nil { @@ -112,8 +112,8 @@ func BuildMenus(uid int64) []menu.MenuVo { } -func buildTree(menus []Menu) ([]Menu) { - var trees []Menu +func buildTree(menus []SysMenu) ([]SysMenu) { + var trees []SysMenu for _, menu := range menus { if menu.Pid == 0 { trees = append(trees, menu) @@ -121,7 +121,7 @@ func buildTree(menus []Menu) ([]Menu) { } for k, tree := range trees { - var child []Menu + var child []SysMenu for _, it := range menus { if it.Pid == tree.Id { child = append(child,it) @@ -134,7 +134,7 @@ func buildTree(menus []Menu) ([]Menu) { } -func buildMenus(menus []Menu) []menu.MenuVo { +func buildMenus(menus []SysMenu) []menu.MenuVo { var list []menu.MenuVo for _ , menuO := range menus { menuList := menuO.Children diff --git a/models/picture.go b/models/SysPicture.go similarity index 78% rename from models/picture.go rename to models/SysPicture.go index 82f5e45..f33c051 100644 --- a/models/picture.go +++ b/models/SysPicture.go @@ -2,7 +2,7 @@ package models import "github.com/beego/beego/v2/client/orm" -type Picture struct { +type SysPicture struct { Id int64 DeleteUrl string Filename string @@ -16,5 +16,5 @@ type Picture struct { } func init() { - orm.RegisterModel(new(Picture)) + orm.RegisterModel(new(SysPicture)) } diff --git a/models/SysRole.go b/models/SysRole.go new file mode 100644 index 0000000..b9eafbd --- /dev/null +++ b/models/SysRole.go @@ -0,0 +1,75 @@ +package models + +import ( + "github.com/beego/beego/v2/client/orm" + "yixiang.co/yshop/dto" + "yixiang.co/yshop/untils" +) + +type SysRole struct { + Id int64 `json:"id"` + Name string `json:"name" valid:"Required;"` + Remark string `json:"remark"` + DataScope string `json:"dataScope"` + Level int32 `json:"level"` + Permission string `json:"permission"` + Users []*SysUser `orm:"reverse(many)"` + Menus []*SysMenu `json:"menus" orm:"rel(m2m);rel_through(yixiang.co/yshop/models.SysRolesMenus)"` + Depts []*SysDept `orm:"rel(m2m);rel_through(yixiang.co/yshop/models.SysRolesDepts)"` + BaseModel +} + +func init() { + orm.RegisterModel(new(SysRole)) +} + +func GetOneRole(id int64) SysRole { + o := orm.NewOrm() + role := SysRole{Id: id} + o.Read(&role) + _, _ = o.LoadRelated(&role, "Menus") + return role +} + +// get all +func GetAllRole(base dto.BasePage,query ...interface{}) (int,[]SysRole) { + var ( + tableName = "sys_role" + lists []SysRole + condition = "" + ) + if base.Blurry != "" { + condition = " and name= '" + base.Blurry + "'" + } + + + total, _, rs := GetPagesInfo(tableName, base.Page, base.Size, condition) + rs.QueryRows(&lists) + + o := orm.NewOrm() + for k, _ := range lists { + _, _ = o.LoadRelated(&lists[k], "Menus") + } + + + return total,lists +} + +func AddRole(m *SysRole) (id int64, err error) { + o := orm.NewOrm() + id, err = o.Insert(m) + return +} + +func UpdateByRole(m *SysRole) (err error) { + o := orm.NewOrm() + _, err = o.Update(m) + return +} + +func DelByRole(ids []int64) (err error) { + str := untils.ReturnQ(len(ids)) + o := orm.NewOrm() + _, err = o.Raw("UPDATE sys_role SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() + return +} diff --git a/models/SysRoleDepts.go b/models/SysRoleDepts.go new file mode 100644 index 0000000..ff904b3 --- /dev/null +++ b/models/SysRoleDepts.go @@ -0,0 +1,13 @@ +package models + +import "github.com/beego/beego/v2/client/orm" + +type SysRolesDepts struct { + Id int64 + RoleId *SysRole `orm:"column(role_id);rel(fk)"` + DeptId *SysDept `orm:"column(dept_id);rel(fk)"` +} + +func init() { + orm.RegisterModel(new(SysRolesDepts)) +} diff --git a/models/SysRoleMenus.go b/models/SysRoleMenus.go new file mode 100644 index 0000000..cfe5b26 --- /dev/null +++ b/models/SysRoleMenus.go @@ -0,0 +1,30 @@ +package models + +import ( + "github.com/beego/beego/v2/client/orm" + "yixiang.co/yshop/dto" +) + +type SysRolesMenus struct { + Id int64 + MenuId *SysMenu `orm:"column(menu_id);rel(fk)"` + RoleId *SysRole `orm:"column(role_id);rel(fk)"` +} + +func init() { + orm.RegisterModel(new(SysRolesMenus)) +} + +func BatchRoleMenuAdd(menu dto.RoleMenu) { + o := orm.NewOrm() + o.Raw("delete from sys_roles_menus WHERE role_id = ?", menu.Id).Exec() + + var roleMenus []SysRolesMenus + for _, val := range menu.Menus { + var menus = SysMenu{Id: val.Id} + var roles = SysRole{Id:menu.Id} + roleMenus = append(roleMenus,SysRolesMenus{MenuId: &menus,RoleId: &roles}) + } + + o.InsertMulti(100,roleMenus) +} diff --git a/models/user.go b/models/SysUser.go similarity index 66% rename from models/user.go rename to models/SysUser.go index 8fe8f4e..49b2852 100644 --- a/models/user.go +++ b/models/SysUser.go @@ -9,7 +9,7 @@ import ( "yixiang.co/yshop/untils" ) -type User struct { +type SysUser struct { Id int64 `json:"id"` Avatar string `json:"avatar"` Email string `json:"email"` @@ -19,13 +19,13 @@ type User struct { //DeptId int32 Phone string `json:"phone"` //JobId int32 - NickName string `json:"nickName"` - Sex string `json:"sex"` - Roles []*Role `json:"roles" orm:"rel(m2m);rel_through(yixiang.co/yshop/models.UsersRoles)"` - Jobs *Job `json:"job" orm:"column(job_id);bigint;rel(one)""` - Depts *Dept `json:"dept" orm:"column(dept_id);bigint;rel(one)""` + NickName string `json:"nickName"` + Sex string `json:"sex"` + Roles []*SysRole `json:"roles" orm:"rel(m2m);rel_through(yixiang.co/yshop/models.SysUsersRoles)"` + Jobs *SysJob `json:"job" orm:"column(job_id);bigint;rel(one)""` + Depts *SysDept `json:"dept" orm:"column(dept_id);bigint;rel(one)""` Permissions []string `orm:"-"` - RoleIds []int64 `json:"roleIds" orm:"-"` + RoleIds []int64 `json:"roleIds" orm:"-"` BaseModel } @@ -35,14 +35,14 @@ type RoleId struct { func init() { - orm.RegisterModel(new(User)) + orm.RegisterModel(new(SysUser)) } func FindByUserId(id int64) ([]string,error) { o := orm.NewOrm() - var roles []Role - _, err := o.Raw("SELECT r.* FROM role r, users_roles u " + + var roles []SysRole + _, err := o.Raw("SELECT r.* FROM sys_role r, sys_users_roles u " + "WHERE r.id = u.role_id AND u.user_id = ?", id).QueryRows(&roles) for k, _ := range roles { _, err = o.LoadRelated(&roles[k], "Menus") @@ -64,10 +64,10 @@ func FindByUserId(id int64) ([]string,error) { } //根据用户名返回 -func GetUserByUsername(name string) (v *User, err error) { +func GetUserByUsername(name string) (v *SysUser, err error) { o := orm.NewOrm() - user := &User{} - err = o.QueryTable(new(User)).Filter("username",name).RelatedSel().One(user) + user := &SysUser{} + err = o.QueryTable(new(SysUser)).Filter("username",name).RelatedSel().One(user) if _, err = o.LoadRelated(user, "Roles");err != nil{ return nil, err } @@ -82,12 +82,12 @@ func GetUserByUsername(name string) (v *User, err error) { // GetUserById retrieves User by Id. Returns error if // Id doesn't exist -func GetUserById(id int64) (v *User, err error) { +func GetUserById(id int64) (v *SysUser, err error) { //var userlist []User o := orm.NewOrm() - v = &User{Id: id} + v = &SysUser{Id: id} - err = o.QueryTable(new(User)).Filter("Id", id).RelatedSel().One(v) + err = o.QueryTable(new(SysUser)).Filter("Id", id).RelatedSel().One(v) if _, err = o.LoadRelated(v, "Roles");err!=nil{ @@ -103,10 +103,10 @@ func GetUserById(id int64) (v *User, err error) { } // get all -func GetAllUser(base dto.BasePage,query ...interface{}) (int,[]User) { +func GetAllUser(base dto.BasePage,query ...interface{}) (int,[]SysUser) { var ( - tableName = "user" - users []User + tableName = "sys_user" + users []SysUser condition = "" ) if base.Blurry != "" { @@ -135,14 +135,14 @@ func GetAllUser(base dto.BasePage,query ...interface{}) (int,[]User) { return total,users } -func UpdateCurrentUser(m *User) ( err error) { +func UpdateCurrentUser(m *SysUser) ( err error) { o := orm.NewOrm() _, err = o.Update(m) return } -func AddUser(m *User) (id int64, err error) { +func AddUser(m *SysUser) (id int64, err error) { o := orm.NewOrm() //transaction err = o.DoTx(func(ctx context.Context, txOrm orm.TxOrmer) error { @@ -155,14 +155,14 @@ func AddUser(m *User) (id int64, err error) { var ee error // add user_role for _, roleId := range m.RoleIds { - _, ee = txOrm.Raw("INSERT INTO users_roles (user_id,role_id) VALUES (?,?)", id, roleId).Exec() + _, ee = txOrm.Raw("INSERT INTO sys_users_roles (user_id,role_id) VALUES (?,?)", id, roleId).Exec() } return ee }) return 0,err } -func UpdateByUser(m *User) (err error) { +func UpdateByUser(m *SysUser) (err error) { o := orm.NewOrm() //transaction err = o.DoTx(func(ctx context.Context, txOrm orm.TxOrmer) error { @@ -172,14 +172,14 @@ func UpdateByUser(m *User) (err error) { return e } //先删除 - _, eee := txOrm.Raw("delete from users_roles WHERE user_id = ?", m.Id).Exec() + _, eee := txOrm.Raw("delete from sys_users_roles WHERE user_id = ?", m.Id).Exec() if eee != nil { return eee } var ee error for _, roleId := range m.RoleIds { - _, ee = txOrm.Raw("INSERT INTO users_roles (user_id,role_id) VALUES (?,?)", m.Id, roleId).Exec() + _, ee = txOrm.Raw("INSERT INTO sys_users_roles (user_id,role_id) VALUES (?,?)", m.Id, roleId).Exec() } return ee @@ -194,8 +194,8 @@ func DelByUser(ids []int64) (err error) { str := untils.ReturnQ(len(ids)) o := orm.NewOrm() err = o.DoTx(func(ctx context.Context, txOrm orm.TxOrmer) error { - _, e1 := txOrm.Raw("UPDATE user SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() - _, e2 := txOrm.Raw("delete from users_roles WHERE user_id in("+str+")", ids).Exec() + _, e1 := txOrm.Raw("UPDATE sys_user SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() + _, e2 := txOrm.Raw("delete from sys_users_roles WHERE user_id in("+str+")", ids).Exec() if e1 != nil { return e1 diff --git a/models/SysUsersRoles.go b/models/SysUsersRoles.go new file mode 100644 index 0000000..ca188b7 --- /dev/null +++ b/models/SysUsersRoles.go @@ -0,0 +1,23 @@ +package models + +import ( + "github.com/beego/beego/v2/client/orm" +) + +type SysUsersRoles struct { + Id int64 + UserId *SysUser `orm:"column(user_id);rel(fk)"` + RoleId *SysRole `orm:"column(role_id);rel(fk)"` +} + +func init() { + orm.RegisterModel(new(SysUsersRoles)) +} + +func AddUserRole(m *SysUsersRoles) (id int64, err error) { + o := orm.NewOrm() + id, err = o.Insert(m) + return +} + + diff --git a/models/role.go b/models/role.go deleted file mode 100644 index f6edb43..0000000 --- a/models/role.go +++ /dev/null @@ -1,75 +0,0 @@ -package models - -import ( - "github.com/beego/beego/v2/client/orm" - "yixiang.co/yshop/dto" - "yixiang.co/yshop/untils" -) - -type Role struct { - Id int64 `json:"id"` - Name string `json:"name" valid:"Required;"` - Remark string `json:"remark"` - DataScope string `json:"dataScope"` - Level int32 `json:"level"` - Permission string `json:"permission"` - Users []*User `orm:"reverse(many)"` - Menus []*Menu `json:"menus" orm:"rel(m2m);rel_through(yixiang.co/yshop/models.RolesMenus)"` - Depts []*Dept `orm:"rel(m2m);rel_through(yixiang.co/yshop/models.RolesDepts)"` - BaseModel -} - -func init() { - orm.RegisterModel(new(Role)) -} - -func GetOneRole(id int64) Role { - o := orm.NewOrm() - role := Role{Id: id} - o.Read(&role) - _, _ = o.LoadRelated(&role, "Menus") - return role -} - -// get all -func GetAllRole(base dto.BasePage,query ...interface{}) (int,[]Role) { - var ( - tableName = "role" - lists []Role - condition = "" - ) - if base.Blurry != "" { - condition = " and name= '" + base.Blurry + "'" - } - - - total, _, rs := GetPagesInfo(tableName, base.Page, base.Size, condition) - rs.QueryRows(&lists) - - o := orm.NewOrm() - for k, _ := range lists { - _, _ = o.LoadRelated(&lists[k], "Menus") - } - - - return total,lists -} - -func AddRole(m *Role) (id int64, err error) { - o := orm.NewOrm() - id, err = o.Insert(m) - return -} - -func UpdateByRole(m *Role) (err error) { - o := orm.NewOrm() - _, err = o.Update(m) - return -} - -func DelByRole(ids []int64) (err error) { - str := untils.ReturnQ(len(ids)) - o := orm.NewOrm() - _, err = o.Raw("UPDATE role SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() - return -} diff --git a/models/role_depts.go b/models/role_depts.go deleted file mode 100644 index f44477d..0000000 --- a/models/role_depts.go +++ /dev/null @@ -1,13 +0,0 @@ -package models - -import "github.com/beego/beego/v2/client/orm" - -type RolesDepts struct { - Id int64 - RoleId *Role `orm:"column(role_id);rel(fk)"` - DeptId *Dept `orm:"column(dept_id);rel(fk)"` -} - -func init() { - orm.RegisterModel(new(RolesDepts)) -} diff --git a/models/role_menus.go b/models/role_menus.go deleted file mode 100644 index ca28d0a..0000000 --- a/models/role_menus.go +++ /dev/null @@ -1,30 +0,0 @@ -package models - -import ( - "github.com/beego/beego/v2/client/orm" - "yixiang.co/yshop/dto" -) - -type RolesMenus struct { - Id int64 - MenuId *Menu `orm:"column(menu_id);rel(fk)"` - RoleId *Role `orm:"column(role_id);rel(fk)"` -} - -func init() { - orm.RegisterModel(new(RolesMenus)) -} - -func BatchRoleMenuAdd(menu dto.RoleMenu) { - o := orm.NewOrm() - o.Raw("delete from roles_menus WHERE role_id = ?", menu.Id).Exec() - - var roleMenus []RolesMenus - for _, val := range menu.Menus { - var menus = Menu{Id: val.Id} - var roles = Role{Id:menu.Id} - roleMenus = append(roleMenus,RolesMenus{MenuId: &menus,RoleId: &roles}) - } - - o.InsertMulti(100,roleMenus) -} diff --git a/models/user.go-bak b/models/user.go-bak deleted file mode 100644 index 9a17264..0000000 --- a/models/user.go-bak +++ /dev/null @@ -1,151 +0,0 @@ -package models - -import ( - "errors" - "fmt" - "github.com/beego/beego/v2/client/orm" - "reflect" - "strings" -) - -type User struct { - Id int64 - Avatar string - Email string - Enabled int8 - Password string - Username string - DeptId int32 - Phone string - JobId int32 - NickName string - Sex string - BaseModel -} - -func init() { - orm.RegisterModel(new(User)) -} - -// AddUser insert a new User into database and returns -// last inserted Id on success. -func AddUser(m *User) (id int64, err error) { - o := orm.NewOrm() - id, err = o.Insert(m) - return -} - -// GetUserById retrieves User by Id. Returns error if -// Id doesn't exist -func GetUserById(id int64) (v *User, err error) { - o := orm.NewOrm() - v = &User{Id: id} - if err = o.QueryTable(new(User)).Filter("Id", id).RelatedSel().One(v); err == nil { - return v, nil - } - return nil, err -} - -// GetAllUser retrieves all User matches certain condition. Returns empty list if -// no records exist -func GetAllUser(query map[string]string, fields []string, sortby []string, order []string, - offset int64, limit int64) (ml []interface{}, err error) { - o := orm.NewOrm() - qs := o.QueryTable(new(User)) - // query k=v - for k, v := range query { - // rewrite dot-notation to Object__Attribute - k = strings.Replace(k, ".", "__", -1) - qs = qs.Filter(k, v) - } - // order by: - var sortFields []string - if len(sortby) != 0 { - if len(sortby) == len(order) { - // 1) for each sort field, there is an associated order - for i, v := range sortby { - orderby := "" - if order[i] == "desc" { - orderby = "-" + v - } else if order[i] == "asc" { - orderby = v - } else { - return nil, errors.New("Error: Invalid order. Must be either [asc|desc]") - } - sortFields = append(sortFields, orderby) - } - qs = qs.OrderBy(sortFields...) - } else if len(sortby) != len(order) && len(order) == 1 { - // 2) there is exactly one order, all the sorted fields will be sorted by this order - for _, v := range sortby { - orderby := "" - if order[0] == "desc" { - orderby = "-" + v - } else if order[0] == "asc" { - orderby = v - } else { - return nil, errors.New("Error: Invalid order. Must be either [asc|desc]") - } - sortFields = append(sortFields, orderby) - } - } else if len(sortby) != len(order) && len(order) != 1 { - return nil, errors.New("Error: 'sortby', 'order' sizes mismatch or 'order' size is not 1") - } - } else { - if len(order) != 0 { - return nil, errors.New("Error: unused 'order' fields") - } - } - - var l []User - qs = qs.OrderBy(sortFields...).RelatedSel() - if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil { - if len(fields) == 0 { - for _, v := range l { - ml = append(ml, v) - } - } else { - // trim unused fields - for _, v := range l { - m := make(map[string]interface{}) - val := reflect.ValueOf(v) - for _, fname := range fields { - m[fname] = val.FieldByName(fname).Interface() - } - ml = append(ml, m) - } - } - return ml, nil - } - return nil, err -} - -// UpdateUser updates User by Id and returns error if -// the record to be updated doesn't exist -func UpdateUserById(m *User) (err error) { - o := orm.NewOrm() - v := User{Id: m.Id} - // ascertain id exists in the database - if err = o.Read(&v); err == nil { - var num int64 - if num, err = o.Update(m); err == nil { - fmt.Println("Number of records updated in database:", num) - } - } - return -} - -// DeleteUser deletes User by Id and returns error if -// the record to be deleted doesn't exist -func DeleteUser(id int64) (err error) { - o := orm.NewOrm() - v := User{Id: id} - // ascertain id exists in the database - if err = o.Read(&v); err == nil { - var num int64 - if num, err = o.Delete(&User{Id: id}); err == nil { - fmt.Println("Number of records deleted in database:", num) - } - } - return -} diff --git a/models/users_roles.go b/models/users_roles.go deleted file mode 100644 index 38ed3c2..0000000 --- a/models/users_roles.go +++ /dev/null @@ -1,23 +0,0 @@ -package models - -import ( - "github.com/beego/beego/v2/client/orm" -) - -type UsersRoles struct { - Id int64 - UserId *User `orm:"column(user_id);rel(fk)"` - RoleId *Role `orm:"column(role_id);rel(fk)"` -} - -func init() { - orm.RegisterModel(new(UsersRoles)) -} - -func AddUserRole(m *UsersRoles) (id int64, err error) { - o := orm.NewOrm() - id, err = o.Insert(m) - return -} - - diff --git a/sql/yshop_go.sql b/sql/yshop_go.sql index 443989e..12d07e4 100644 --- a/sql/yshop_go.sql +++ b/sql/yshop_go.sql @@ -11,17 +11,17 @@ Target Server Version : 80021 File Encoding : 65001 - Date: 07/03/2021 10:38:07 + Date: 27/04/2021 16:53:40 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for dept +-- Table structure for sys_dept -- ---------------------------- -DROP TABLE IF EXISTS `dept`; -CREATE TABLE `dept` ( +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', `pid` bigint NOT NULL COMMENT '上级部门', @@ -33,26 +33,26 @@ CREATE TABLE `dept` ( ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门'; -- ---------------------------- --- Records of dept +-- Records of sys_dept -- ---------------------------- BEGIN; -INSERT INTO `dept` VALUES (1, 'YSHOP', 0, 1, '2021-02-26 14:51:14', NULL, 0); -INSERT INTO `dept` VALUES (2, '研发部', 7, 1, '2019-03-25 09:15:32', NULL, 0); -INSERT INTO `dept` VALUES (5, '运维部', 7, 1, '2019-03-25 09:20:44', NULL, 0); -INSERT INTO `dept` VALUES (6, '测试部', 8, 0, '2021-02-25 16:22:53', NULL, 0); -INSERT INTO `dept` VALUES (7, '华南分部', 1, 1, '2019-03-25 11:04:50', NULL, 0); -INSERT INTO `dept` VALUES (8, '华北分部', 1, 1, '2019-03-25 11:04:53', NULL, 0); -INSERT INTO `dept` VALUES (11, '人事部', 8, 1, '2019-03-25 11:07:58', NULL, 0); -INSERT INTO `dept` VALUES (12, '7773888', 1, 1, '2021-02-26 15:04:43', NULL, 1); -INSERT INTO `dept` VALUES (13, '333', 1, 0, '2021-02-26 14:28:26', '2021-02-26 14:28:26', 1); -INSERT INTO `dept` VALUES (14, '9922', 13, 1, '2021-02-26 15:05:05', '2021-02-26 14:29:17', 1); +INSERT INTO `sys_dept` VALUES (1, 'YSHOP', 0, 1, '2021-02-26 14:51:14', NULL, 0); +INSERT INTO `sys_dept` VALUES (2, '研发部', 7, 1, '2019-03-25 09:15:32', NULL, 0); +INSERT INTO `sys_dept` VALUES (5, '运维部', 7, 1, '2019-03-25 09:20:44', NULL, 0); +INSERT INTO `sys_dept` VALUES (6, '测试部', 8, 0, '2021-02-25 16:22:53', NULL, 0); +INSERT INTO `sys_dept` VALUES (7, '华南分部', 1, 1, '2019-03-25 11:04:50', NULL, 0); +INSERT INTO `sys_dept` VALUES (8, '华北分部', 1, 1, '2019-03-25 11:04:53', NULL, 0); +INSERT INTO `sys_dept` VALUES (11, '人事部', 8, 1, '2019-03-25 11:07:58', NULL, 0); +INSERT INTO `sys_dept` VALUES (12, '7773888', 1, 1, '2021-02-26 15:04:43', NULL, 1); +INSERT INTO `sys_dept` VALUES (13, '333', 1, 0, '2021-02-26 14:28:26', '2021-02-26 14:28:26', 1); +INSERT INTO `sys_dept` VALUES (14, '9922', 13, 1, '2021-02-26 15:05:05', '2021-02-26 14:29:17', 1); COMMIT; -- ---------------------------- --- Table structure for dict +-- Table structure for sys_dict -- ---------------------------- -DROP TABLE IF EXISTS `dict`; -CREATE TABLE `dict` ( +DROP TABLE IF EXISTS `sys_dict`; +CREATE TABLE `sys_dict` ( `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典名称', `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述', @@ -63,24 +63,24 @@ CREATE TABLE `dict` ( ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='数据字典'; -- ---------------------------- --- Records of dict +-- Records of sys_dict -- ---------------------------- BEGIN; -INSERT INTO `dict` VALUES (1, 'user_status', '用户状态', '2019-10-27 20:31:36', NULL, 0); -INSERT INTO `dict` VALUES (4, 'dept_status', '部门状态', '2019-10-27 20:31:36', NULL, 0); -INSERT INTO `dict` VALUES (5, 'job_status', '岗位状态', '2019-10-27 20:31:36', NULL, 0); -INSERT INTO `dict` VALUES (6, '33', '3', '2020-05-18 19:55:49', NULL, 1); -INSERT INTO `dict` VALUES (16, 'force_update', '强制升级', '2020-12-09 11:13:21', NULL, 0); -INSERT INTO `dict` VALUES (17, 'is_enable', '是否启用', '2020-12-10 12:02:57', NULL, 0); -INSERT INTO `dict` VALUES (18, 'sex2', '性别', '2021-02-23 15:20:40', '2021-02-23 14:12:04', 0); -INSERT INTO `dict` VALUES (19, 'sex4', '性别', '2021-02-23 15:20:20', '2021-02-23 14:14:29', 0); +INSERT INTO `sys_dict` VALUES (1, 'user_status', '用户状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `sys_dict` VALUES (4, 'dept_status', '部门状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `sys_dict` VALUES (5, 'job_status', '岗位状态', '2019-10-27 20:31:36', NULL, 0); +INSERT INTO `sys_dict` VALUES (6, '33', '3', '2020-05-18 19:55:49', NULL, 1); +INSERT INTO `sys_dict` VALUES (16, 'force_update', '强制升级', '2020-12-09 11:13:21', NULL, 0); +INSERT INTO `sys_dict` VALUES (17, 'is_enable', '是否启用', '2020-12-10 12:02:57', NULL, 0); +INSERT INTO `sys_dict` VALUES (18, 'sex2', '性别', '2021-02-23 15:20:40', '2021-02-23 14:12:04', 0); +INSERT INTO `sys_dict` VALUES (19, 'sex4', '性别', '2021-02-23 15:20:20', '2021-02-23 14:14:29', 0); COMMIT; -- ---------------------------- --- Table structure for dict_detail +-- Table structure for sys_dict_detail -- ---------------------------- -DROP TABLE IF EXISTS `dict_detail`; -CREATE TABLE `dict_detail` ( +DROP TABLE IF EXISTS `sys_dict_detail`; +CREATE TABLE `sys_dict_detail` ( `id` bigint NOT NULL AUTO_INCREMENT, `label` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典标签', `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典值', @@ -92,30 +92,30 @@ CREATE TABLE `dict_detail` ( `dict_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, KEY `FK5tpkputc6d9nboxojdbgnpmyb` (`dict_id`) USING BTREE, - CONSTRAINT `FK5tpkputc6d9nboxojdbgnpmyb` FOREIGN KEY (`dict_id`) REFERENCES `dict` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT + CONSTRAINT `FK5tpkputc6d9nboxojdbgnpmyb` FOREIGN KEY (`dict_id`) REFERENCES `sys_dict` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='数据字典详情'; -- ---------------------------- --- Records of dict_detail +-- Records of sys_dict_detail -- ---------------------------- BEGIN; -INSERT INTO `dict_detail` VALUES (1, '激活', '1', 1, 1, '2021-03-04 13:48:42', NULL, 0, 'user_status'); -INSERT INTO `dict_detail` VALUES (2, '禁用', '0', 2, 1, '2021-03-04 13:48:49', NULL, 0, 'user_status'); -INSERT INTO `dict_detail` VALUES (3, '启用', '1', 1, 4, '2021-02-25 16:12:46', NULL, 0, 'dept_status'); -INSERT INTO `dict_detail` VALUES (4, '停用', '0', 2, 4, '2021-02-25 16:12:51', NULL, 0, 'dept_status'); -INSERT INTO `dict_detail` VALUES (5, '启用', '1', 1, 5, '2021-02-26 16:23:39', NULL, 0, 'job_status'); -INSERT INTO `dict_detail` VALUES (6, '停用', '0', 2, 5, '2021-02-26 16:23:46', NULL, 0, 'job_status'); -INSERT INTO `dict_detail` VALUES (20, '是', '1', 999, 16, '2020-12-09 11:41:30', NULL, 0, 'force_update'); -INSERT INTO `dict_detail` VALUES (21, '否', '0', 999, 16, '2020-12-09 11:41:36', NULL, 0, 'force_update'); -INSERT INTO `dict_detail` VALUES (22, '是', '1', 999, 17, '2021-02-25 15:32:00', NULL, 0, 'is_enable'); -INSERT INTO `dict_detail` VALUES (23, '否', '0', 999, 17, '2020-12-10 12:03:16', NULL, 0, 'is_enable'); +INSERT INTO `sys_dict_detail` VALUES (1, '激活', '1', 1, 1, '2021-03-04 13:48:42', NULL, 0, 'user_status'); +INSERT INTO `sys_dict_detail` VALUES (2, '禁用', '0', 2, 1, '2021-03-04 13:48:49', NULL, 0, 'user_status'); +INSERT INTO `sys_dict_detail` VALUES (3, '启用', '1', 1, 4, '2021-02-25 16:12:46', NULL, 0, 'dept_status'); +INSERT INTO `sys_dict_detail` VALUES (4, '停用', '0', 2, 4, '2021-02-25 16:12:51', NULL, 0, 'dept_status'); +INSERT INTO `sys_dict_detail` VALUES (5, '启用', '1', 1, 5, '2021-02-26 16:23:39', NULL, 0, 'job_status'); +INSERT INTO `sys_dict_detail` VALUES (6, '停用', '0', 2, 5, '2021-02-26 16:23:46', NULL, 0, 'job_status'); +INSERT INTO `sys_dict_detail` VALUES (20, '是', '1', 999, 16, '2020-12-09 11:41:30', NULL, 0, 'force_update'); +INSERT INTO `sys_dict_detail` VALUES (21, '否', '0', 999, 16, '2020-12-09 11:41:36', NULL, 0, 'force_update'); +INSERT INTO `sys_dict_detail` VALUES (22, '是', '1', 999, 17, '2021-02-25 15:32:00', NULL, 0, 'is_enable'); +INSERT INTO `sys_dict_detail` VALUES (23, '否', '0', 999, 17, '2020-12-10 12:03:16', NULL, 0, 'is_enable'); COMMIT; -- ---------------------------- --- Table structure for job +-- Table structure for sys_job -- ---------------------------- -DROP TABLE IF EXISTS `job`; -CREATE TABLE `job` ( +DROP TABLE IF EXISTS `sys_job`; +CREATE TABLE `sys_job` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位名称', `enabled` tinyint(1) NOT NULL COMMENT '岗位状态', @@ -126,26 +126,26 @@ CREATE TABLE `job` ( `is_del` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) USING BTREE, KEY `FKmvhj0rogastlctflsxf1d6k3i` (`dept_id`) USING BTREE, - CONSTRAINT `FKmvhj0rogastlctflsxf1d6k3i` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT + CONSTRAINT `FKmvhj0rogastlctflsxf1d6k3i` FOREIGN KEY (`dept_id`) REFERENCES `sys_dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='岗位'; -- ---------------------------- --- Records of job +-- Records of sys_job -- ---------------------------- BEGIN; -INSERT INTO `job` VALUES (8, '人事专员', 1, 3, 11, '2021-03-07 10:15:49', NULL, 0); -INSERT INTO `job` VALUES (10, '产品经理', 1, 4, 2, '2019-03-29 14:55:51', NULL, 0); -INSERT INTO `job` VALUES (11, '全栈开发2', 1, 2, 2, '2019-03-31 13:39:30', NULL, 0); -INSERT INTO `job` VALUES (12, '软件测试', 1, 5, 2, '2019-03-31 13:39:43', NULL, 0); -INSERT INTO `job` VALUES (13, '6665', 1, 0, 1, '2021-03-02 15:45:16', '2021-03-02 15:42:55', 1); -INSERT INTO `job` VALUES (14, '99', 1, 0, 5, '2021-03-02 15:44:05', '2021-03-02 15:44:05', 1); +INSERT INTO `sys_job` VALUES (8, '人事专员', 1, 3, 11, '2021-03-07 10:15:49', NULL, 0); +INSERT INTO `sys_job` VALUES (10, '产品经理', 1, 4, 2, '2019-03-29 14:55:51', NULL, 0); +INSERT INTO `sys_job` VALUES (11, '全栈开发2', 1, 2, 2, '2019-03-31 13:39:30', NULL, 0); +INSERT INTO `sys_job` VALUES (12, '软件测试', 1, 5, 2, '2019-03-31 13:39:43', NULL, 0); +INSERT INTO `sys_job` VALUES (13, '6665', 1, 0, 1, '2021-03-02 15:45:16', '2021-03-02 15:42:55', 1); +INSERT INTO `sys_job` VALUES (14, '99', 1, 0, 5, '2021-03-02 15:44:05', '2021-03-02 15:44:05', 1); COMMIT; -- ---------------------------- --- Table structure for menu +-- Table structure for sys_menu -- ---------------------------- -DROP TABLE IF EXISTS `menu`; -CREATE TABLE `menu` ( +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', `i_frame` tinyint(1) DEFAULT NULL COMMENT '是否外链', `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '菜单名称', @@ -169,58 +169,58 @@ CREATE TABLE `menu` ( ) ENGINE=InnoDB AUTO_INCREMENT=279 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; -- ---------------------------- --- Records of menu +-- Records of sys_menu -- ---------------------------- BEGIN; -INSERT INTO `menu` VALUES (1, 0, '系统管理', NULL, 0, 99, 'system', 'system', 0, 0, NULL, '2018-12-18 15:11:29', NULL, 1, '2020-07-16 20:05:34', 0, NULL, NULL); -INSERT INTO `menu` VALUES (2, 0, '用户管理', 'system/user/index', 1, 2, 'peoples', 'user', 0, 0, 'User', '2021-03-06 10:24:34', 'user:list', 1, NULL, 0, '/admin/user', 'get'); -INSERT INTO `menu` VALUES (3, 0, '角色管理', 'system/role/index', 1, 3, 'role', 'role', 0, 0, 'Role', '2021-03-06 10:31:55', 'roles:list', 1, NULL, 0, '/admin/roles', 'get'); -INSERT INTO `menu` VALUES (5, 0, '菜单管理', 'system/menu/index', 1, 5, 'menu', 'menu', 0, 0, 'Menu', '2021-03-06 10:33:17', 'menu:list', 1, NULL, 0, '/admin/menu', 'get'); -INSERT INTO `menu` VALUES (35, 0, '部门管理', 'system/dept/index', 1, 6, 'dept', 'dept', 0, 0, 'Dept', '2021-03-06 10:34:35', 'dept:list', 1, NULL, 0, '/admin/dept', 'get'); -INSERT INTO `menu` VALUES (36, 0, '系统工具', '', 0, 101, 'sys-tools', 'sys-tools', 0, 0, NULL, '2019-03-29 10:57:35', NULL, 1, NULL, 0, NULL, NULL); -INSERT INTO `menu` VALUES (37, 0, '岗位管理', 'system/job/index', 1, 7, 'Steve-Jobs', 'job', 0, 0, 'Job', '2021-03-06 10:35:42', 'user:list', 1, NULL, 0, '/admin/job', 'get'); -INSERT INTO `menu` VALUES (39, 0, '字典管理', 'system/dict/index', 1, 8, 'dictionary', 'dict', 0, 0, 'Dict', '2021-03-06 12:54:29', 'dict:list', 1, NULL, 0, '/admin/dict', 'get'); -INSERT INTO `menu` VALUES (117, 0, '图表库', 'components/Echarts', 10, 50, 'chart', 'echarts', 1, 0, 'Echarts', '2019-11-21 09:04:32', '', 1, NULL, 0, NULL, NULL); -INSERT INTO `menu` VALUES (120, 0, '商品删除', NULL, 45, 4, NULL, NULL, 0, 0, NULL, '2019-12-24 13:03:51', 'YXSTOREPRODUCT_DELETE', 2, '2020-07-10 16:22:51', 0, NULL, NULL); -INSERT INTO `menu` VALUES (123, 0, '后台接口文档', 'tools/swagger/index', 36, 31, 'swagger', 'swagger2', 0, 0, 'Swagger', '2020-01-07 18:05:52', NULL, 1, NULL, 0, NULL, NULL); -INSERT INTO `menu` VALUES (126, 0, '编辑', NULL, 54, 1, NULL, NULL, 0, 0, NULL, '2020-02-14 21:05:28', 'YXSTOREORDER_EDIT', 2, NULL, 0, NULL, NULL); -INSERT INTO `menu` VALUES (127, 0, '用户新增', '', 2, 2, '', '', 0, 0, '', '2021-03-06 10:30:11', 'user:add', 2, NULL, 0, '/admin/user', 'post'); -INSERT INTO `menu` VALUES (128, 0, '用户编辑', '', 2, 3, '', '', 0, 0, '', '2021-03-06 10:30:38', 'user:edit', 2, NULL, 0, '/admin/user', 'edit'); -INSERT INTO `menu` VALUES (129, 0, '用户删除', '', 2, 4, '', '', 0, 0, '', '2021-03-06 10:30:48', 'user:del', 2, NULL, 0, '/admin/user', 'delete'); -INSERT INTO `menu` VALUES (130, 0, '角色创建', '', 3, 2, '', '', 0, 0, '', '2021-03-06 10:32:15', 'roles:add', 2, NULL, 0, '/admin/roles', 'post'); -INSERT INTO `menu` VALUES (131, 0, '角色修改', '', 3, 3, '', '', 0, 0, '', '2021-03-06 10:32:27', 'roles:edit', 2, NULL, 0, '/admin/roles', 'put'); -INSERT INTO `menu` VALUES (132, 0, '角色删除', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:32:40', 'roles:del', 2, NULL, 0, '/admin/roles', 'delete'); -INSERT INTO `menu` VALUES (133, 0, '菜单新增', '', 5, 2, '', '', 0, 0, '', '2021-03-06 10:33:27', 'menu:add', 2, NULL, 0, '/admin/menu', 'post'); -INSERT INTO `menu` VALUES (134, 0, '菜单编辑', '', 5, 3, '', '', 0, 0, '', '2021-03-06 10:33:37', 'menu:edit', 2, NULL, 0, '/admin/menu', 'put'); -INSERT INTO `menu` VALUES (135, 0, '菜单删除', '', 5, 4, '', '', 0, 0, '', '2021-03-06 10:33:47', 'menu:del', 2, NULL, 0, '/admin/menu', 'delete'); -INSERT INTO `menu` VALUES (136, 0, '部门新增', '', 35, 2, '', '', 0, 0, '', '2021-03-06 10:34:58', 'dept:add', 2, NULL, 0, '/admin/dept', 'post'); -INSERT INTO `menu` VALUES (137, 0, '部门编辑', '', 35, 3, '', '', 0, 0, '', '2021-03-06 10:35:07', 'dept:edit', 2, NULL, 0, '/admin/dept', 'put'); -INSERT INTO `menu` VALUES (138, 0, '部门删除', '', 35, 4, '', '', 0, 0, '', '2021-03-06 10:35:16', 'dept:del', 2, NULL, 0, '/admin/dept', 'delete'); -INSERT INTO `menu` VALUES (139, 0, '岗位新增', '', 37, 2, '', '', 0, 0, '', '2021-03-06 10:35:53', 'job:add', 2, NULL, 0, '/admin/job', 'post'); -INSERT INTO `menu` VALUES (140, 0, '岗位编辑', '', 37, 3, '', '', 0, 0, '', '2021-03-06 10:36:02', 'job:edit', 2, NULL, 0, '/admin/job', 'put'); -INSERT INTO `menu` VALUES (141, 0, '岗位删除', '', 37, 4, '', '', 0, 0, '', '2021-03-06 10:36:10', 'job:del', 2, NULL, 0, '/admin/job', 'delete'); -INSERT INTO `menu` VALUES (142, 0, '字典新增', '', 39, 2, '', '', 0, 0, '', '2021-03-06 10:36:51', 'dict:add', 2, NULL, 0, '/admin/dict', 'post'); -INSERT INTO `menu` VALUES (143, 0, '字典编辑', '', 39, 3, '', '', 0, 0, '', '2021-03-06 10:36:59', 'dict:edit', 2, NULL, 0, '/admin/dict', 'put'); -INSERT INTO `menu` VALUES (144, 0, '字典删除', '', 39, 4, '', '', 0, 0, '', '2021-03-06 10:37:10', 'dict:del', 2, NULL, 0, '/admin/dict', 'delete'); -INSERT INTO `menu` VALUES (184, 0, '新增菜单', NULL, 49, 0, 'add', NULL, 0, 0, NULL, '2020-06-14 20:10:02', 'YxWechatMenu_CREATE', 2, NULL, 0, NULL, NULL); -INSERT INTO `menu` VALUES (265, 0, '顶级2', 'top/aa', 264, 999, 'alipay', 'top2', 0, 0, 'TOp', '2021-03-03 16:09:42', 'top2', 1, '2021-03-03 16:00:39', 0, '/top', 'get'); -INSERT INTO `menu` VALUES (269, 0, '字典详情列表', '', 1, 999, 'configure', '/no', 0, 1, '', '2021-03-06 12:59:31', 'dict_detail:list', 1, '2021-03-06 10:40:50', 0, '/admin/dictDetail', 'get'); -INSERT INTO `menu` VALUES (270, 0, '字典详情增加', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:17', 'dict_detail:add', 2, '2021-03-06 10:42:14', 0, '/admin/dictDetail', 'post'); -INSERT INTO `menu` VALUES (271, 0, '字典详情编辑', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:25', 'dict_detail:edit', 2, '2021-03-06 10:43:33', 0, '/admin/dictDetail', 'put'); -INSERT INTO `menu` VALUES (272, 0, '字典详情删除', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:33', 'dict_detail:delete', 2, '2021-03-06 10:44:09', 0, '/admin/dictDetail', 'delete'); -INSERT INTO `menu` VALUES (273, 0, '角色菜单数', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'role_menu:tree', 2, '2021-03-06 10:46:21', 0, '/admin/menu/tree', 'get'); -INSERT INTO `menu` VALUES (274, 0, '角色菜单保存', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'role_menu:save', 2, '2021-03-06 10:49:47', 0, '/admin/roles/menu', 'put'); -INSERT INTO `menu` VALUES (275, 0, '单个角色', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'roles:one', 2, '2021-03-06 11:18:28', 0, '/admin/roles/*', 'get'); -INSERT INTO `menu` VALUES (276, 0, '用户个人信息', '', 2, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'user:info', 2, '2021-03-06 11:20:25', 0, '/admin/auth/info', 'get'); -INSERT INTO `menu` VALUES (277, 0, '用户头像', '', 2, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'user:avatar', 2, '2021-03-06 11:21:41', 0, '/admin/user/updateAvatar', 'post'); -INSERT INTO `menu` VALUES (278, 0, '用户退出', '', 2, 999, '', '', 0, 0, '', '2021-03-06 11:25:00', 'user:logout', 2, '2021-03-06 11:25:00', 0, '/admin/auth/logout', 'delete'); +INSERT INTO `sys_menu` VALUES (1, 0, '系统管理', NULL, 0, 99, 'system', 'system', 0, 0, NULL, '2018-12-18 15:11:29', NULL, 1, '2020-07-16 20:05:34', 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (2, 0, '用户管理', 'system/user/index', 1, 2, 'peoples', 'user', 0, 0, 'User', '2021-03-06 10:24:34', 'user:list', 1, NULL, 0, '/admin/user', 'get'); +INSERT INTO `sys_menu` VALUES (3, 0, '角色管理', 'system/role/index', 1, 3, 'role', 'role', 0, 0, 'Role', '2021-03-06 10:31:55', 'roles:list', 1, NULL, 0, '/admin/roles', 'get'); +INSERT INTO `sys_menu` VALUES (5, 0, '菜单管理', 'system/menu/index', 1, 5, 'menu', 'menu', 0, 0, 'Menu', '2021-03-06 10:33:17', 'menu:list', 1, NULL, 0, '/admin/menu', 'get'); +INSERT INTO `sys_menu` VALUES (35, 0, '部门管理', 'system/dept/index', 1, 6, 'dept', 'dept', 0, 0, 'Dept', '2021-03-06 10:34:35', 'dept:list', 1, NULL, 0, '/admin/dept', 'get'); +INSERT INTO `sys_menu` VALUES (36, 0, '系统工具', '', 0, 101, 'sys-tools', 'sys-tools', 0, 0, NULL, '2019-03-29 10:57:35', NULL, 1, NULL, 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (37, 0, '岗位管理', 'system/job/index', 1, 7, 'Steve-Jobs', 'job', 0, 0, 'Job', '2021-03-06 10:35:42', 'user:list', 1, NULL, 0, '/admin/job', 'get'); +INSERT INTO `sys_menu` VALUES (39, 0, '字典管理', 'system/dict/index', 1, 8, 'dictionary', 'dict', 0, 0, 'Dict', '2021-03-06 12:54:29', 'dict:list', 1, NULL, 0, '/admin/dict', 'get'); +INSERT INTO `sys_menu` VALUES (117, 0, '图表库', 'components/Echarts', 10, 50, 'chart', 'echarts', 1, 0, 'Echarts', '2019-11-21 09:04:32', '', 1, NULL, 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (120, 0, '商品删除', NULL, 45, 4, NULL, NULL, 0, 0, NULL, '2019-12-24 13:03:51', 'YXSTOREPRODUCT_DELETE', 2, '2020-07-10 16:22:51', 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (123, 0, '后台接口文档', 'tools/swagger/index', 36, 31, 'swagger', 'swagger2', 0, 0, 'Swagger', '2020-01-07 18:05:52', NULL, 1, NULL, 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (126, 0, '编辑', NULL, 54, 1, NULL, NULL, 0, 0, NULL, '2020-02-14 21:05:28', 'YXSTOREORDER_EDIT', 2, NULL, 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (127, 0, '用户新增', '', 2, 2, '', '', 0, 0, '', '2021-03-06 10:30:11', 'user:add', 2, NULL, 0, '/admin/user', 'post'); +INSERT INTO `sys_menu` VALUES (128, 0, '用户编辑', '', 2, 3, '', '', 0, 0, '', '2021-03-06 10:30:38', 'user:edit', 2, NULL, 0, '/admin/user', 'edit'); +INSERT INTO `sys_menu` VALUES (129, 0, '用户删除', '', 2, 4, '', '', 0, 0, '', '2021-03-06 10:30:48', 'user:del', 2, NULL, 0, '/admin/user', 'delete'); +INSERT INTO `sys_menu` VALUES (130, 0, '角色创建', '', 3, 2, '', '', 0, 0, '', '2021-03-06 10:32:15', 'roles:add', 2, NULL, 0, '/admin/roles', 'post'); +INSERT INTO `sys_menu` VALUES (131, 0, '角色修改', '', 3, 3, '', '', 0, 0, '', '2021-03-06 10:32:27', 'roles:edit', 2, NULL, 0, '/admin/roles', 'put'); +INSERT INTO `sys_menu` VALUES (132, 0, '角色删除', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:32:40', 'roles:del', 2, NULL, 0, '/admin/roles', 'delete'); +INSERT INTO `sys_menu` VALUES (133, 0, '菜单新增', '', 5, 2, '', '', 0, 0, '', '2021-03-06 10:33:27', 'menu:add', 2, NULL, 0, '/admin/menu', 'post'); +INSERT INTO `sys_menu` VALUES (134, 0, '菜单编辑', '', 5, 3, '', '', 0, 0, '', '2021-03-06 10:33:37', 'menu:edit', 2, NULL, 0, '/admin/menu', 'put'); +INSERT INTO `sys_menu` VALUES (135, 0, '菜单删除', '', 5, 4, '', '', 0, 0, '', '2021-03-06 10:33:47', 'menu:del', 2, NULL, 0, '/admin/menu', 'delete'); +INSERT INTO `sys_menu` VALUES (136, 0, '部门新增', '', 35, 2, '', '', 0, 0, '', '2021-03-06 10:34:58', 'dept:add', 2, NULL, 0, '/admin/dept', 'post'); +INSERT INTO `sys_menu` VALUES (137, 0, '部门编辑', '', 35, 3, '', '', 0, 0, '', '2021-03-06 10:35:07', 'dept:edit', 2, NULL, 0, '/admin/dept', 'put'); +INSERT INTO `sys_menu` VALUES (138, 0, '部门删除', '', 35, 4, '', '', 0, 0, '', '2021-03-06 10:35:16', 'dept:del', 2, NULL, 0, '/admin/dept', 'delete'); +INSERT INTO `sys_menu` VALUES (139, 0, '岗位新增', '', 37, 2, '', '', 0, 0, '', '2021-03-06 10:35:53', 'job:add', 2, NULL, 0, '/admin/job', 'post'); +INSERT INTO `sys_menu` VALUES (140, 0, '岗位编辑', '', 37, 3, '', '', 0, 0, '', '2021-03-06 10:36:02', 'job:edit', 2, NULL, 0, '/admin/job', 'put'); +INSERT INTO `sys_menu` VALUES (141, 0, '岗位删除', '', 37, 4, '', '', 0, 0, '', '2021-03-06 10:36:10', 'job:del', 2, NULL, 0, '/admin/job', 'delete'); +INSERT INTO `sys_menu` VALUES (142, 0, '字典新增', '', 39, 2, '', '', 0, 0, '', '2021-03-06 10:36:51', 'dict:add', 2, NULL, 0, '/admin/dict', 'post'); +INSERT INTO `sys_menu` VALUES (143, 0, '字典编辑', '', 39, 3, '', '', 0, 0, '', '2021-03-06 10:36:59', 'dict:edit', 2, NULL, 0, '/admin/dict', 'put'); +INSERT INTO `sys_menu` VALUES (144, 0, '字典删除', '', 39, 4, '', '', 0, 0, '', '2021-03-06 10:37:10', 'dict:del', 2, NULL, 0, '/admin/dict', 'delete'); +INSERT INTO `sys_menu` VALUES (184, 0, '新增菜单', NULL, 49, 0, 'add', NULL, 0, 0, NULL, '2020-06-14 20:10:02', 'YxWechatMenu_CREATE', 2, NULL, 0, NULL, NULL); +INSERT INTO `sys_menu` VALUES (265, 0, '顶级2', 'top/aa', 264, 999, 'alipay', 'top2', 0, 0, 'TOp', '2021-03-03 16:09:42', 'top2', 1, '2021-03-03 16:00:39', 0, '/top', 'get'); +INSERT INTO `sys_menu` VALUES (269, 0, '字典详情列表', '', 1, 999, 'configure', '/no', 0, 1, '', '2021-03-06 12:59:31', 'dict_detail:list', 1, '2021-03-06 10:40:50', 0, '/admin/dictDetail', 'get'); +INSERT INTO `sys_menu` VALUES (270, 0, '字典详情增加', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:17', 'dict_detail:add', 2, '2021-03-06 10:42:14', 0, '/admin/dictDetail', 'post'); +INSERT INTO `sys_menu` VALUES (271, 0, '字典详情编辑', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:25', 'dict_detail:edit', 2, '2021-03-06 10:43:33', 0, '/admin/dictDetail', 'put'); +INSERT INTO `sys_menu` VALUES (272, 0, '字典详情删除', '', 269, 999, '', '', 0, 0, '', '2021-03-06 12:57:33', 'dict_detail:delete', 2, '2021-03-06 10:44:09', 0, '/admin/dictDetail', 'delete'); +INSERT INTO `sys_menu` VALUES (273, 0, '角色菜单数', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'role_menu:tree', 2, '2021-03-06 10:46:21', 0, '/admin/menu/tree', 'get'); +INSERT INTO `sys_menu` VALUES (274, 0, '角色菜单保存', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'role_menu:save', 2, '2021-03-06 10:49:47', 0, '/admin/roles/menu', 'put'); +INSERT INTO `sys_menu` VALUES (275, 0, '单个角色', '', 3, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'roles:one', 2, '2021-03-06 11:18:28', 0, '/admin/roles/*', 'get'); +INSERT INTO `sys_menu` VALUES (276, 0, '用户个人信息', '', 2, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'user:info', 2, '2021-03-06 11:20:25', 0, '/admin/auth/info', 'get'); +INSERT INTO `sys_menu` VALUES (277, 0, '用户头像', '', 2, 999, '', '', 0, 0, '', '2021-03-06 10:36:41', 'user:avatar', 2, '2021-03-06 11:21:41', 0, '/admin/user/updateAvatar', 'post'); +INSERT INTO `sys_menu` VALUES (278, 0, '用户退出', '', 2, 999, '', '', 0, 0, '', '2021-03-06 11:25:00', 'user:logout', 2, '2021-03-06 11:25:00', 0, '/admin/auth/logout', 'delete'); COMMIT; -- ---------------------------- --- Table structure for role +-- Table structure for sys_role -- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注', @@ -234,21 +234,21 @@ CREATE TABLE `role` ( ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表'; -- ---------------------------- --- Records of role +-- Records of sys_role -- ---------------------------- BEGIN; -INSERT INTO `role` VALUES (1, '超级管理员', '-', '全部', 1, '2018-11-23 11:04:37', 'admin', NULL, 0); -INSERT INTO `role` VALUES (2, '普通用户', '-555', '本级', 2, '2021-03-07 10:09:08', 'common', NULL, 0); -INSERT INTO `role` VALUES (3, '管理员2', '222', '全部', 3, '2020-01-31 16:53:25', '22', NULL, 0); -INSERT INTO `role` VALUES (4, '667', '66', '全部', 3, '2021-03-02 16:16:43', '666', '2021-03-02 16:15:20', 1); -INSERT INTO `role` VALUES (5, '99', '9', '全部', 3, '2021-03-02 16:16:35', '9', '2021-03-02 16:16:35', 1); +INSERT INTO `sys_role` VALUES (1, '超级管理员', '-', '全部', 1, '2018-11-23 11:04:37', 'admin', NULL, 0); +INSERT INTO `sys_role` VALUES (2, '普通用户', '-555', '本级', 2, '2021-03-07 10:09:08', 'common', NULL, 0); +INSERT INTO `sys_role` VALUES (3, '管理员2', '222', '全部', 3, '2020-01-31 16:53:25', '22', NULL, 0); +INSERT INTO `sys_role` VALUES (4, '667', '66', '全部', 3, '2021-03-02 16:16:43', '666', '2021-03-02 16:15:20', 1); +INSERT INTO `sys_role` VALUES (5, '99', '9', '全部', 3, '2021-03-02 16:16:35', '9', '2021-03-02 16:16:35', 1); COMMIT; -- ---------------------------- --- Table structure for roles_depts +-- Table structure for sys_roles_depts -- ---------------------------- -DROP TABLE IF EXISTS `roles_depts`; -CREATE TABLE `roles_depts` ( +DROP TABLE IF EXISTS `sys_roles_depts`; +CREATE TABLE `sys_roles_depts` ( `role_id` bigint NOT NULL, `dept_id` bigint NOT NULL, `id` bigint NOT NULL AUTO_INCREMENT, @@ -257,107 +257,113 @@ CREATE TABLE `roles_depts` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色部门关联'; -- ---------------------------- --- Records of roles_depts +-- Records of sys_roles_depts -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- --- Table structure for roles_menus +-- Table structure for sys_roles_menus -- ---------------------------- -DROP TABLE IF EXISTS `roles_menus`; -CREATE TABLE `roles_menus` ( +DROP TABLE IF EXISTS `sys_roles_menus`; +CREATE TABLE `sys_roles_menus` ( `menu_id` bigint NOT NULL COMMENT '菜单ID', `role_id` bigint NOT NULL COMMENT '角色ID', `id` bigint NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=472 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色菜单关联'; +) ENGINE=InnoDB AUTO_INCREMENT=503 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色菜单关联'; -- ---------------------------- --- Records of roles_menus +-- Records of sys_roles_menus -- ---------------------------- BEGIN; -INSERT INTO `roles_menus` VALUES (1, 3, 199); -INSERT INTO `roles_menus` VALUES (2, 3, 200); -INSERT INTO `roles_menus` VALUES (127, 3, 201); -INSERT INTO `roles_menus` VALUES (128, 3, 202); -INSERT INTO `roles_menus` VALUES (129, 3, 203); -INSERT INTO `roles_menus` VALUES (3, 3, 204); -INSERT INTO `roles_menus` VALUES (130, 3, 205); -INSERT INTO `roles_menus` VALUES (131, 3, 206); -INSERT INTO `roles_menus` VALUES (132, 3, 207); -INSERT INTO `roles_menus` VALUES (5, 3, 208); -INSERT INTO `roles_menus` VALUES (133, 3, 209); -INSERT INTO `roles_menus` VALUES (134, 3, 210); -INSERT INTO `roles_menus` VALUES (135, 3, 211); -INSERT INTO `roles_menus` VALUES (35, 3, 212); -INSERT INTO `roles_menus` VALUES (136, 3, 213); -INSERT INTO `roles_menus` VALUES (137, 3, 214); -INSERT INTO `roles_menus` VALUES (138, 3, 215); -INSERT INTO `roles_menus` VALUES (37, 3, 216); -INSERT INTO `roles_menus` VALUES (139, 3, 217); -INSERT INTO `roles_menus` VALUES (140, 3, 218); -INSERT INTO `roles_menus` VALUES (141, 3, 219); -INSERT INTO `roles_menus` VALUES (39, 3, 220); -INSERT INTO `roles_menus` VALUES (142, 3, 221); -INSERT INTO `roles_menus` VALUES (143, 3, 222); -INSERT INTO `roles_menus` VALUES (144, 3, 223); -INSERT INTO `roles_menus` VALUES (1, 1, 411); -INSERT INTO `roles_menus` VALUES (2, 1, 412); -INSERT INTO `roles_menus` VALUES (127, 1, 413); -INSERT INTO `roles_menus` VALUES (128, 1, 414); -INSERT INTO `roles_menus` VALUES (129, 1, 415); -INSERT INTO `roles_menus` VALUES (276, 1, 416); -INSERT INTO `roles_menus` VALUES (277, 1, 417); -INSERT INTO `roles_menus` VALUES (278, 1, 418); -INSERT INTO `roles_menus` VALUES (3, 1, 419); -INSERT INTO `roles_menus` VALUES (130, 1, 420); -INSERT INTO `roles_menus` VALUES (131, 1, 421); -INSERT INTO `roles_menus` VALUES (132, 1, 422); -INSERT INTO `roles_menus` VALUES (273, 1, 423); -INSERT INTO `roles_menus` VALUES (274, 1, 424); -INSERT INTO `roles_menus` VALUES (275, 1, 425); -INSERT INTO `roles_menus` VALUES (5, 1, 426); -INSERT INTO `roles_menus` VALUES (133, 1, 427); -INSERT INTO `roles_menus` VALUES (134, 1, 428); -INSERT INTO `roles_menus` VALUES (135, 1, 429); -INSERT INTO `roles_menus` VALUES (35, 1, 430); -INSERT INTO `roles_menus` VALUES (136, 1, 431); -INSERT INTO `roles_menus` VALUES (137, 1, 432); -INSERT INTO `roles_menus` VALUES (138, 1, 433); -INSERT INTO `roles_menus` VALUES (37, 1, 434); -INSERT INTO `roles_menus` VALUES (139, 1, 435); -INSERT INTO `roles_menus` VALUES (140, 1, 436); -INSERT INTO `roles_menus` VALUES (141, 1, 437); -INSERT INTO `roles_menus` VALUES (39, 1, 438); -INSERT INTO `roles_menus` VALUES (142, 1, 439); -INSERT INTO `roles_menus` VALUES (143, 1, 440); -INSERT INTO `roles_menus` VALUES (144, 1, 441); -INSERT INTO `roles_menus` VALUES (269, 1, 442); -INSERT INTO `roles_menus` VALUES (270, 1, 443); -INSERT INTO `roles_menus` VALUES (271, 1, 444); -INSERT INTO `roles_menus` VALUES (272, 1, 445); -INSERT INTO `roles_menus` VALUES (36, 1, 446); -INSERT INTO `roles_menus` VALUES (123, 1, 447); -INSERT INTO `roles_menus` VALUES (1, 2, 461); -INSERT INTO `roles_menus` VALUES (35, 2, 462); -INSERT INTO `roles_menus` VALUES (37, 2, 463); -INSERT INTO `roles_menus` VALUES (136, 2, 464); -INSERT INTO `roles_menus` VALUES (137, 2, 465); -INSERT INTO `roles_menus` VALUES (139, 2, 466); -INSERT INTO `roles_menus` VALUES (140, 2, 467); -INSERT INTO `roles_menus` VALUES (269, 2, 468); -INSERT INTO `roles_menus` VALUES (270, 2, 469); -INSERT INTO `roles_menus` VALUES (271, 2, 470); -INSERT INTO `roles_menus` VALUES (272, 2, 471); +INSERT INTO `sys_roles_menus` VALUES (1, 1, 411); +INSERT INTO `sys_roles_menus` VALUES (2, 1, 412); +INSERT INTO `sys_roles_menus` VALUES (127, 1, 413); +INSERT INTO `sys_roles_menus` VALUES (128, 1, 414); +INSERT INTO `sys_roles_menus` VALUES (129, 1, 415); +INSERT INTO `sys_roles_menus` VALUES (276, 1, 416); +INSERT INTO `sys_roles_menus` VALUES (277, 1, 417); +INSERT INTO `sys_roles_menus` VALUES (278, 1, 418); +INSERT INTO `sys_roles_menus` VALUES (3, 1, 419); +INSERT INTO `sys_roles_menus` VALUES (130, 1, 420); +INSERT INTO `sys_roles_menus` VALUES (131, 1, 421); +INSERT INTO `sys_roles_menus` VALUES (132, 1, 422); +INSERT INTO `sys_roles_menus` VALUES (273, 1, 423); +INSERT INTO `sys_roles_menus` VALUES (274, 1, 424); +INSERT INTO `sys_roles_menus` VALUES (275, 1, 425); +INSERT INTO `sys_roles_menus` VALUES (5, 1, 426); +INSERT INTO `sys_roles_menus` VALUES (133, 1, 427); +INSERT INTO `sys_roles_menus` VALUES (134, 1, 428); +INSERT INTO `sys_roles_menus` VALUES (135, 1, 429); +INSERT INTO `sys_roles_menus` VALUES (35, 1, 430); +INSERT INTO `sys_roles_menus` VALUES (136, 1, 431); +INSERT INTO `sys_roles_menus` VALUES (137, 1, 432); +INSERT INTO `sys_roles_menus` VALUES (138, 1, 433); +INSERT INTO `sys_roles_menus` VALUES (37, 1, 434); +INSERT INTO `sys_roles_menus` VALUES (139, 1, 435); +INSERT INTO `sys_roles_menus` VALUES (140, 1, 436); +INSERT INTO `sys_roles_menus` VALUES (141, 1, 437); +INSERT INTO `sys_roles_menus` VALUES (39, 1, 438); +INSERT INTO `sys_roles_menus` VALUES (142, 1, 439); +INSERT INTO `sys_roles_menus` VALUES (143, 1, 440); +INSERT INTO `sys_roles_menus` VALUES (144, 1, 441); +INSERT INTO `sys_roles_menus` VALUES (269, 1, 442); +INSERT INTO `sys_roles_menus` VALUES (270, 1, 443); +INSERT INTO `sys_roles_menus` VALUES (271, 1, 444); +INSERT INTO `sys_roles_menus` VALUES (272, 1, 445); +INSERT INTO `sys_roles_menus` VALUES (36, 1, 446); +INSERT INTO `sys_roles_menus` VALUES (123, 1, 447); +INSERT INTO `sys_roles_menus` VALUES (1, 2, 461); +INSERT INTO `sys_roles_menus` VALUES (35, 2, 462); +INSERT INTO `sys_roles_menus` VALUES (37, 2, 463); +INSERT INTO `sys_roles_menus` VALUES (136, 2, 464); +INSERT INTO `sys_roles_menus` VALUES (137, 2, 465); +INSERT INTO `sys_roles_menus` VALUES (139, 2, 466); +INSERT INTO `sys_roles_menus` VALUES (140, 2, 467); +INSERT INTO `sys_roles_menus` VALUES (269, 2, 468); +INSERT INTO `sys_roles_menus` VALUES (270, 2, 469); +INSERT INTO `sys_roles_menus` VALUES (271, 2, 470); +INSERT INTO `sys_roles_menus` VALUES (272, 2, 471); +INSERT INTO `sys_roles_menus` VALUES (1, 3, 472); +INSERT INTO `sys_roles_menus` VALUES (2, 3, 473); +INSERT INTO `sys_roles_menus` VALUES (127, 3, 474); +INSERT INTO `sys_roles_menus` VALUES (128, 3, 475); +INSERT INTO `sys_roles_menus` VALUES (129, 3, 476); +INSERT INTO `sys_roles_menus` VALUES (276, 3, 477); +INSERT INTO `sys_roles_menus` VALUES (277, 3, 478); +INSERT INTO `sys_roles_menus` VALUES (278, 3, 479); +INSERT INTO `sys_roles_menus` VALUES (3, 3, 480); +INSERT INTO `sys_roles_menus` VALUES (130, 3, 481); +INSERT INTO `sys_roles_menus` VALUES (131, 3, 482); +INSERT INTO `sys_roles_menus` VALUES (132, 3, 483); +INSERT INTO `sys_roles_menus` VALUES (273, 3, 484); +INSERT INTO `sys_roles_menus` VALUES (274, 3, 485); +INSERT INTO `sys_roles_menus` VALUES (275, 3, 486); +INSERT INTO `sys_roles_menus` VALUES (5, 3, 487); +INSERT INTO `sys_roles_menus` VALUES (133, 3, 488); +INSERT INTO `sys_roles_menus` VALUES (134, 3, 489); +INSERT INTO `sys_roles_menus` VALUES (135, 3, 490); +INSERT INTO `sys_roles_menus` VALUES (35, 3, 491); +INSERT INTO `sys_roles_menus` VALUES (136, 3, 492); +INSERT INTO `sys_roles_menus` VALUES (137, 3, 493); +INSERT INTO `sys_roles_menus` VALUES (138, 3, 494); +INSERT INTO `sys_roles_menus` VALUES (37, 3, 495); +INSERT INTO `sys_roles_menus` VALUES (139, 3, 496); +INSERT INTO `sys_roles_menus` VALUES (140, 3, 497); +INSERT INTO `sys_roles_menus` VALUES (141, 3, 498); +INSERT INTO `sys_roles_menus` VALUES (39, 3, 499); +INSERT INTO `sys_roles_menus` VALUES (142, 3, 500); +INSERT INTO `sys_roles_menus` VALUES (143, 3, 501); +INSERT INTO `sys_roles_menus` VALUES (144, 3, 502); COMMIT; -- ---------------------------- --- Table structure for user +-- Table structure for sys_user -- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', `avatar` varchar(200) DEFAULT NULL COMMENT '头像', `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱', @@ -377,29 +383,29 @@ CREATE TABLE `user` ( KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`) USING BTREE, KEY `FKfftoc2abhot8f2wu6cl9a5iky` (`job_id`) USING BTREE, KEY `FKpq2dhypk2qgt68nauh2by22jb` (`avatar`) USING BTREE, - CONSTRAINT `FK5rwmryny6jthaaxkogownknqp` FOREIGN KEY (`dept_id`) REFERENCES `dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FKfftoc2abhot8f2wu6cl9a5iky` FOREIGN KEY (`job_id`) REFERENCES `job` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT + CONSTRAINT `FK5rwmryny6jthaaxkogownknqp` FOREIGN KEY (`dept_id`) REFERENCES `sys_dept` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `FKfftoc2abhot8f2wu6cl9a5iky` FOREIGN KEY (`job_id`) REFERENCES `sys_job` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE=InnoDB AUTO_INCREMENT=9998 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户'; -- ---------------------------- --- Records of user +-- Records of sys_user -- ---------------------------- BEGIN; -INSERT INTO `user` VALUES (1, 'https://goapi.yixiang.co/static/upload/1.jpg', 'yshop@qq.com', 1, '$2a$10$fP.426qKaTmix50Oln8L.uav55gELhAd0Eg66Av4oG86u8km7D/Ky', 'admin', 2, '18888888888', 11, '2021-03-07 10:08:30', '管理员', '男', '2020-06-27 12:05:56', 0); -INSERT INTO `user` VALUES (3, '', 'test@yshopnet', 1, '$2a$04$tw0sZ2EOqt7y.tkrnWHdgeyTG6ku7iv0vAACBTBwym5lNr2oQkG.y', 'test', 2, '17777777777', 12, '2021-03-06 12:46:08', '测试2', '男', NULL, 0); -INSERT INTO `user` VALUES (4, NULL, 'test2@qq.com', 1, '$2a$10$IjehtV8MiXb8ni.Qz0wBteE7FjVn49cEcsSj2.ZBUqqHjnC3umSh.', 'test2', 2, '15136175247', 11, '2020-02-15 20:39:16', 'test2', '男', NULL, 0); -INSERT INTO `user` VALUES (5, '', '444@qq.com', 1, '$2a$10$f/VH35NBOBszycV9KEA1HenQ0qVjazDm8LacQU9PO.A4UizFxLMuq', 'qqqqq', 11, '15136175249', 8, '2021-03-04 16:22:56', 'eeeeee', '男', NULL, 0); -INSERT INTO `user` VALUES (6, '', '666@qq.com', 0, '$2a$10$3Vlo24eOmHHW7.3vAjqPSusfIINNo4JiujzxgqsaoWLx/d5de/jEm', '7777', 8, '15136175246', 8, '2021-03-04 15:31:40', '777', '男', NULL, 1); -INSERT INTO `user` VALUES (9992, '', '66@qq.com', 1, '$2a$04$zI7VSH/WspYF9Kea1lCMkO/0pMh.d0U72EO6T0YinOxs.d97dTImi', 'hupeng33333', 7, '18888888888', 8, '2021-03-05 10:42:42', 'hu', '男', '2021-03-04 15:07:36', 1); -INSERT INTO `user` VALUES (9993, '', '44@qq.com', 1, '$2a$04$IBgD8Un9Xgbi0lzbklZlC.uK1srn5w1Y5ntN1qfpzDgcipLLRp1aG', 'hupeng2', 11, '', 10, '2021-03-04 15:28:40', 'hu2', '男', '2021-03-04 15:09:11', 1); -INSERT INTO `user` VALUES (9996, '', '777@qq.com', 0, '$2a$04$Ep/UAK2kmJKPto6efG9qyOYlwQ5NGL0T/PkLVrUcXJxTcq6WG5Zca', 'zhang', 5, '18888888888', 11, '2021-03-04 16:23:49', 'zhang', '男', '2021-03-04 16:14:59', 1); +INSERT INTO `sys_user` VALUES (1, 'https://goapi.yixiang.co/static/upload/1.jpg', 'yshop@qq.com', 1, '$2a$10$fP.426qKaTmix50Oln8L.uav55gELhAd0Eg66Av4oG86u8km7D/Ky', 'admin', 2, '18888888888', 11, '2021-03-07 10:08:30', '管理员', '男', '2020-06-27 12:05:56', 0); +INSERT INTO `sys_user` VALUES (3, '', 'test@yshopnet', 1, '$2a$04$tw0sZ2EOqt7y.tkrnWHdgeyTG6ku7iv0vAACBTBwym5lNr2oQkG.y', 'test', 2, '17777777777', 12, '2021-03-06 12:46:08', '测试2', '男', NULL, 0); +INSERT INTO `sys_user` VALUES (4, NULL, 'test2@qq.com', 1, '$2a$10$IjehtV8MiXb8ni.Qz0wBteE7FjVn49cEcsSj2.ZBUqqHjnC3umSh.', 'test2', 2, '15136175247', 11, '2020-02-15 20:39:16', 'test2', '男', NULL, 0); +INSERT INTO `sys_user` VALUES (5, '', '444@qq.com', 1, '$2a$10$f/VH35NBOBszycV9KEA1HenQ0qVjazDm8LacQU9PO.A4UizFxLMuq', 'qqqqq', 11, '15136175249', 8, '2021-03-04 16:22:56', 'eeeeee', '男', NULL, 1); +INSERT INTO `sys_user` VALUES (6, '', '666@qq.com', 0, '$2a$10$3Vlo24eOmHHW7.3vAjqPSusfIINNo4JiujzxgqsaoWLx/d5de/jEm', '7777', 8, '15136175246', 8, '2021-03-04 15:31:40', '777', '男', NULL, 1); +INSERT INTO `sys_user` VALUES (9992, '', '66@qq.com', 1, '$2a$04$zI7VSH/WspYF9Kea1lCMkO/0pMh.d0U72EO6T0YinOxs.d97dTImi', 'hupeng33333', 7, '18888888888', 8, '2021-03-05 10:42:42', 'hu', '男', '2021-03-04 15:07:36', 1); +INSERT INTO `sys_user` VALUES (9993, '', '44@qq.com', 1, '$2a$04$IBgD8Un9Xgbi0lzbklZlC.uK1srn5w1Y5ntN1qfpzDgcipLLRp1aG', 'hupeng2', 11, '', 10, '2021-03-04 15:28:40', 'hu2', '男', '2021-03-04 15:09:11', 1); +INSERT INTO `sys_user` VALUES (9996, '', '777@qq.com', 0, '$2a$04$Ep/UAK2kmJKPto6efG9qyOYlwQ5NGL0T/PkLVrUcXJxTcq6WG5Zca', 'zhang', 5, '18888888888', 11, '2021-03-04 16:23:49', 'zhang', '男', '2021-03-04 16:14:59', 1); COMMIT; -- ---------------------------- --- Table structure for users_roles +-- Table structure for sys_users_roles -- ---------------------------- -DROP TABLE IF EXISTS `users_roles`; -CREATE TABLE `users_roles` ( +DROP TABLE IF EXISTS `sys_users_roles`; +CREATE TABLE `sys_users_roles` ( `user_id` bigint NOT NULL COMMENT '用户ID', `role_id` bigint NOT NULL COMMENT '角色ID', `id` bigint NOT NULL AUTO_INCREMENT, @@ -407,13 +413,12 @@ CREATE TABLE `users_roles` ( ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户角色关联'; -- ---------------------------- --- Records of users_roles +-- Records of sys_users_roles -- ---------------------------- BEGIN; -INSERT INTO `users_roles` VALUES (1, 1, 1); -INSERT INTO `users_roles` VALUES (3, 2, 2); -INSERT INTO `users_roles` VALUES (4, 2, 3); -INSERT INTO `users_roles` VALUES (5, 2, 4); +INSERT INTO `sys_users_roles` VALUES (1, 1, 1); +INSERT INTO `sys_users_roles` VALUES (3, 2, 2); +INSERT INTO `sys_users_roles` VALUES (4, 2, 3); COMMIT; SET FOREIGN_KEY_CHECKS = 1; diff --git a/vo/jwt_user.go b/vo/JwtUser.go similarity index 100% rename from vo/jwt_user.go rename to vo/JwtUser.go diff --git a/vo/login_vo.go b/vo/LoginVo.go similarity index 73% rename from vo/login_vo.go rename to vo/LoginVo.go index 8022946..1714c92 100644 --- a/vo/login_vo.go +++ b/vo/LoginVo.go @@ -4,5 +4,5 @@ import "yixiang.co/yshop/models" type LoginVo struct { Token string `json:"token"` - User *models.User `json:"user"` + User *models.SysUser `json:"user"` } diff --git a/vo/result_list.go b/vo/ResultList.go similarity index 100% rename from vo/result_list.go rename to vo/ResultList.go diff --git a/vo/menu/menu_vo.go b/vo/menu/MenuVo.go similarity index 100% rename from vo/menu/menu_vo.go rename to vo/menu/MenuVo.go