mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-05-20 09:49:06 +08:00
feat 同步admin,dept jobs 等关联DB
This commit is contained in:
@@ -3,9 +3,9 @@ package com.mdd.admin.config.stp;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mdd.admin.LikeAdminThreadLocal;
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.entity.system.SystemMenu;
|
||||
import com.mdd.common.entity.system.SystemAuthPerm;
|
||||
import com.mdd.common.mapper.system.SystemAuthMenuMapper;
|
||||
import com.mdd.common.mapper.system.SystemMenuMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthPermMapper;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -23,7 +23,7 @@ public class StpInterConfig implements StpInterface {
|
||||
SystemAuthPermMapper systemAuthPermMapper;
|
||||
|
||||
@Resource
|
||||
SystemAuthMenuMapper systemAuthMenuMapper;
|
||||
SystemMenuMapper systemAuthMenuMapper;
|
||||
|
||||
/**
|
||||
* 返回一个账号所拥有的权限码集合
|
||||
@@ -55,15 +55,15 @@ public class StpInterConfig implements StpInterface {
|
||||
menuIds.add(systemAuthPerm.getMenuId());
|
||||
}
|
||||
|
||||
List<SystemAuthMenu> systemAuthMenus = systemAuthMenuMapper.selectList(
|
||||
new QueryWrapper<SystemAuthMenu>()
|
||||
List<SystemMenu> systemAuthMenus = systemAuthMenuMapper.selectList(
|
||||
new QueryWrapper<SystemMenu>()
|
||||
.select("id,perms")
|
||||
.eq("is_disable", 0)
|
||||
.in("id", menuIds)
|
||||
.in("menu_type", Arrays.asList("C", "A"))
|
||||
.orderByAsc(Arrays.asList("menu_sort", "id")));
|
||||
|
||||
for (SystemAuthMenu item : systemAuthMenus) {
|
||||
for (SystemMenu item : systemAuthMenus) {
|
||||
if (StringUtils.isNotNull(item.getPerms()) && StringUtils.isNotEmpty(item.getPerms())) {
|
||||
perms.add(item.getPerms().trim());
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.mdd.admin.controller.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.admin.service.system.ISystemAuthDeptService;
|
||||
import com.mdd.admin.validate.commons.IdValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthDeptVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/system/dept")
|
||||
@Api(tags = "系统部门管理")
|
||||
public class SystemAuthDeptController {
|
||||
|
||||
@Resource
|
||||
ISystemAuthDeptService iSystemAuthDeptService;
|
||||
|
||||
@NotPower
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value="部门所有")
|
||||
public AjaxResult<List<SystemAuthDeptVo>> all() {
|
||||
List<SystemAuthDeptVo> list = iSystemAuthDeptService.all();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="部门列表")
|
||||
public AjaxResult<JSONArray> list(@Validated SystemDeptSearchValidate searchValidate) {
|
||||
JSONArray list = iSystemAuthDeptService.list(searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="部门详情")
|
||||
public AjaxResult<SystemAuthDeptVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
SystemAuthDeptVo vo = iSystemAuthDeptService.detail(id);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value="部门新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody SystemDeptCreateValidate createValidate) {
|
||||
iSystemAuthDeptService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
@ApiOperation(value="部门编辑")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody SystemDeptUpdateValidate updateValidate) {
|
||||
iSystemAuthDeptService.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/del")
|
||||
@ApiOperation(value="部门删除")
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
iSystemAuthDeptService.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
|
||||
import com.mdd.admin.LikeAdminThreadLocal;
|
||||
import com.mdd.admin.aop.Log;
|
||||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.admin.service.system.ISystemAuthMenuService;
|
||||
import com.mdd.admin.service.system.ISystemMenuService;
|
||||
import com.mdd.admin.validate.commons.IdValidate;
|
||||
import com.mdd.admin.validate.system.SystemMenuCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemMenuUpdateValidate;
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
public class SystemAuthMenuController {
|
||||
|
||||
@Resource
|
||||
ISystemAuthMenuService iSystemAuthMenuService;
|
||||
ISystemMenuService iSystemAuthMenuService;
|
||||
|
||||
@NotPower
|
||||
@GetMapping("/route")
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.mdd.admin.controller.system;
|
||||
|
||||
import com.mdd.common.aop.NotPower;
|
||||
import com.mdd.admin.service.system.ISystemAuthPostService;
|
||||
import com.mdd.admin.validate.commons.IdValidate;
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthPostVo;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.validator.annotation.IDMust;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/system/post")
|
||||
@Api(tags = "系统岗位管理")
|
||||
public class SystemAuthPostController {
|
||||
|
||||
@Resource
|
||||
ISystemAuthPostService iSystemAuthPostService;
|
||||
|
||||
@NotPower
|
||||
@GetMapping("/all")
|
||||
@ApiOperation(value="所有岗位")
|
||||
public AjaxResult<List<SystemAuthPostVo>> all() {
|
||||
List<SystemAuthPostVo> list = iSystemAuthPostService.all();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="岗位列表")
|
||||
public AjaxResult<PageResult<SystemAuthPostVo>> list(@Validated PageValidate pageValidate,
|
||||
@Validated SystemPostSearchValidate searchValidate) {
|
||||
PageResult<SystemAuthPostVo> list = iSystemAuthPostService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="岗位详情")
|
||||
public AjaxResult<SystemAuthPostVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
SystemAuthPostVo vo = iSystemAuthPostService.detail(id);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value="岗位新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody SystemPostCreateValidate createValidate) {
|
||||
iSystemAuthPostService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
@ApiOperation(value="岗位编辑")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody SystemPostUpdateValidate updateValidate) {
|
||||
iSystemAuthPostService.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/del")
|
||||
@ApiOperation(value="岗位删除")
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
iSystemAuthPostService.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mdd.admin.service.admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门关联接口类
|
||||
*/
|
||||
public interface IAdminDeptService {
|
||||
|
||||
/**
|
||||
* 关联部门id
|
||||
*
|
||||
* @author damonyuan
|
||||
*/
|
||||
List<Integer> getDeptIdAttr(Integer adminId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mdd.admin.service.admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位关联接口类
|
||||
*/
|
||||
public interface IAdminJobsService {
|
||||
|
||||
/**
|
||||
* 关联岗位id
|
||||
*
|
||||
* @author damonyuan
|
||||
*/
|
||||
List<Integer> getJobIdAttr(Integer adminId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mdd.admin.service.admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限功能类
|
||||
*/
|
||||
public interface IAuthService {
|
||||
|
||||
/**
|
||||
* @notes 获取当前管理员角色按钮权限
|
||||
* @return mixed
|
||||
* @author damonyuan
|
||||
* @date 2022/7/1 16:10
|
||||
*/
|
||||
List<String> getBtnAuthByRoleId(Integer adminId);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mdd.admin.service.impl.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mdd.admin.service.admin.IAdminDeptService;
|
||||
import com.mdd.admin.service.admin.IAdminJobsService;
|
||||
import com.mdd.common.entity.admin.AdminDept;
|
||||
import com.mdd.common.entity.admin.AdminJobs;
|
||||
import com.mdd.common.mapper.admin.AdminDeptMapper;
|
||||
import com.mdd.common.mapper.admin.AdminJobsMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统部门关联实现类
|
||||
*/
|
||||
@Service
|
||||
public class AdminDeptServiceImpl implements IAdminDeptService {
|
||||
|
||||
@Resource
|
||||
AdminDeptMapper adminDeptMapper;
|
||||
@Override
|
||||
public List<Integer> getDeptIdAttr(Integer adminId) {
|
||||
List<Integer> ret = new ArrayList<Integer>();
|
||||
List<AdminDept> rolesList = adminDeptMapper.selectList(new QueryWrapper<AdminDept>().eq("admin_id", adminId).select("dept_id"));
|
||||
if (rolesList.size() > 0) {
|
||||
for (AdminDept adminDept : rolesList) {
|
||||
ret.add(adminDept.getDeptId());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mdd.admin.service.impl.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mdd.admin.service.admin.IAdminJobsService;
|
||||
import com.mdd.admin.service.admin.IAdminRoleService;
|
||||
import com.mdd.common.entity.admin.AdminJobs;
|
||||
import com.mdd.common.entity.admin.AdminRole;
|
||||
import com.mdd.common.mapper.admin.AdminJobsMapper;
|
||||
import com.mdd.common.mapper.admin.AdminRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统岗位实现类
|
||||
*/
|
||||
@Service
|
||||
public class AdminJobsServiceImpl implements IAdminJobsService {
|
||||
|
||||
@Resource
|
||||
AdminJobsMapper adminJobsMapper;
|
||||
@Override
|
||||
public List<Integer> getJobIdAttr(Integer adminId) {
|
||||
List<Integer> ret = new ArrayList<Integer>();
|
||||
List<AdminJobs> rolesList = adminJobsMapper.selectList(new QueryWrapper<AdminJobs>().eq("admin_id", adminId).select("jobs_id"));
|
||||
if (rolesList.size() > 0) {
|
||||
for (AdminJobs adminJobs : rolesList) {
|
||||
ret.add(adminJobs.getJobsId());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.mdd.admin.service.admin.IAdminService;
|
||||
import com.mdd.admin.service.admin.*;
|
||||
import com.mdd.admin.service.system.ISystemAuthPermService;
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.validate.system.SystemAdminCreateValidate;
|
||||
@@ -15,16 +15,15 @@ import com.mdd.admin.validate.system.SystemAdminSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemAdminUpInfoValidate;
|
||||
import com.mdd.admin.validate.system.SystemAdminUpdateValidate;
|
||||
import com.mdd.admin.vo.auth.AdminMySelfVo;
|
||||
import com.mdd.admin.vo.auth.AuthMySelfVo;
|
||||
import com.mdd.admin.vo.system.*;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.admin.Admin;
|
||||
import com.mdd.common.entity.system.SystemAuthDept;
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.entity.system.SystemMenu;
|
||||
import com.mdd.common.entity.system.SystemRole;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.admin.AdminMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthDeptMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthMenuMapper;
|
||||
import com.mdd.common.mapper.system.SystemMenuMapper;
|
||||
import com.mdd.common.mapper.system.SystemRoleMapper;
|
||||
import com.mdd.common.util.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -43,16 +42,21 @@ public class AdminServiceImpl implements IAdminService {
|
||||
AdminMapper systemAuthAdminMapper;
|
||||
|
||||
@Resource
|
||||
SystemAuthMenuMapper systemAuthMenuMapper;
|
||||
|
||||
@Resource
|
||||
SystemAuthDeptMapper systemAuthDeptMapper;
|
||||
SystemMenuMapper systemAuthMenuMapper;
|
||||
|
||||
@Resource
|
||||
SystemRoleMapper systemAuthRoleMapper;
|
||||
|
||||
@Resource
|
||||
ISystemAuthPermService iSystemAuthPermService;
|
||||
@Resource
|
||||
IAdminRoleService iAdminRoleService;
|
||||
@Resource
|
||||
IAdminDeptService iAdminDeptService;
|
||||
@Resource
|
||||
IAdminJobsService iAdminJobsService;
|
||||
@Resource
|
||||
IAuthService iAuthService;
|
||||
|
||||
/**
|
||||
* 管理员列表
|
||||
@@ -106,23 +110,6 @@ public class AdminServiceImpl implements IAdminService {
|
||||
vo.setRole(ListUtils.listToStringByStr(role, ","));
|
||||
}
|
||||
|
||||
if (StringUtils.isNull(vo.getDept()) || vo.getDept().equals("")) {
|
||||
vo.setDept("");
|
||||
} else {
|
||||
List<String> dept = new LinkedList<>();
|
||||
List<Integer> deptIds = ListUtils.stringToListAsInt(vo.getDept(), ",");
|
||||
if (!deptIds.isEmpty()) {
|
||||
List<SystemAuthDept> deptList = systemAuthDeptMapper.selectList(new QueryWrapper<SystemAuthDept>()
|
||||
.select("id,name")
|
||||
.in("id", deptIds)
|
||||
.eq("is_delete", 0));
|
||||
for (SystemAuthDept d : deptList) {
|
||||
dept.add(d.getName());
|
||||
}
|
||||
}
|
||||
vo.setDept(ListUtils.listToStringByStr(dept, ","));
|
||||
}
|
||||
|
||||
vo.setAvatar(UrlUtils.toAbsoluteUrl(vo.getAvatar()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(vo.getUpdateTime()));
|
||||
@@ -165,14 +152,14 @@ public class AdminServiceImpl implements IAdminService {
|
||||
List<Integer> roleIds = new ArrayList<Integer>();
|
||||
List<Integer> menuIds = iSystemAuthPermService.selectMenuIdsByRoleId(roleIds);
|
||||
if (menuIds.size() > 0) {
|
||||
List<SystemAuthMenu> systemAuthMenus = systemAuthMenuMapper.selectList(new QueryWrapper<SystemAuthMenu>()
|
||||
List<SystemMenu> systemAuthMenus = systemAuthMenuMapper.selectList(new QueryWrapper<SystemMenu>()
|
||||
.eq("is_disable", 0)
|
||||
.in("id", menuIds)
|
||||
.in("menu_type", Arrays.asList("C", "A"))
|
||||
.orderByAsc(Arrays.asList("menu_sort", "id")));
|
||||
|
||||
// 处理权限
|
||||
for (SystemAuthMenu item : systemAuthMenus) {
|
||||
for (SystemMenu item : systemAuthMenus) {
|
||||
if (StringUtils.isNotNull(item.getPerms()) && StringUtils.isNotEmpty(item.getPerms())) {
|
||||
auths.add(item.getPerms().trim());
|
||||
}
|
||||
@@ -207,10 +194,9 @@ public class AdminServiceImpl implements IAdminService {
|
||||
.select(Admin.class, info->
|
||||
!info.getColumn().equals("salt") &&
|
||||
!info.getColumn().equals("password") &&
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(sysAdmin, "账号已不存在!");
|
||||
@@ -220,7 +206,10 @@ public class AdminServiceImpl implements IAdminService {
|
||||
vo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime()));
|
||||
vo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLoginTime()));
|
||||
vo.setLoginTime(TimeUtils.timestampToDate(sysAdmin.getLoginTime()));
|
||||
vo.setRoleIds(iAdminRoleService.getRoleIdAttr(sysAdmin.getId()));
|
||||
vo.setJobIds(iAdminJobsService.getJobIdAttr(sysAdmin.getId()));
|
||||
vo.setDeptIds(iAdminDeptService.getDeptIdAttr(sysAdmin.getId()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -419,11 +408,17 @@ public class AdminServiceImpl implements IAdminService {
|
||||
@Override
|
||||
public AdminMySelfVo mySelf(Integer id) {
|
||||
AdminMySelfVo ret = new AdminMySelfVo();
|
||||
// 当前管理员角色拥有的菜单
|
||||
ret.setMenu(new JSONArray());
|
||||
ret.setPermissions(new ArrayList<String>(){{
|
||||
add("*");
|
||||
}});
|
||||
ret.setUser();
|
||||
// 当前管理员橘色拥有的按钮权限
|
||||
ret.setPermissions(iAuthService.getBtnAuthByRoleId(id));
|
||||
SystemAuthAdminDetailVo admin = detail(id);
|
||||
AuthMySelfVo user = new AuthMySelfVo();
|
||||
BeanUtils.copyProperties(admin, user);
|
||||
user.setDeptId(admin.getDeptIds());
|
||||
user.setJobsId(admin.getJobIds());
|
||||
user.setRoleId(admin.getRoleIds());
|
||||
ret.setUser(user);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mdd.admin.service.impl.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mdd.admin.service.admin.IAdminDeptService;
|
||||
import com.mdd.admin.service.admin.IAdminService;
|
||||
import com.mdd.admin.service.admin.IAuthService;
|
||||
import com.mdd.admin.vo.system.SystemAuthAdminDetailVo;
|
||||
import com.mdd.common.entity.admin.AdminDept;
|
||||
import com.mdd.common.mapper.admin.AdminDeptMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限功能类
|
||||
*/
|
||||
@Service
|
||||
public class AuthServiceImpl implements IAuthService {
|
||||
|
||||
@Resource
|
||||
IAdminService iAdminService;
|
||||
@Override
|
||||
public List<String> getBtnAuthByRoleId(Integer adminId) {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
SystemAuthAdminDetailVo admin = iAdminService.detail(adminId);
|
||||
if (admin.getRoot().equals(1)) {
|
||||
ret.add("*");
|
||||
return ret;
|
||||
} else {
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
package com.mdd.admin.service.impl.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.mdd.admin.service.system.ISystemAuthDeptService;
|
||||
import com.mdd.admin.validate.system.SystemDeptCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthDeptVo;
|
||||
import com.mdd.common.entity.admin.Admin;
|
||||
import com.mdd.common.entity.system.SystemAuthDept;
|
||||
import com.mdd.common.mapper.admin.AdminMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthDeptMapper;
|
||||
import com.mdd.common.util.ListUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 系统部门服务实现类
|
||||
*/
|
||||
@Service
|
||||
class SystemAuthDeptServiceImpl implements ISystemAuthDeptService {
|
||||
|
||||
@Resource
|
||||
SystemAuthDeptMapper systemAuthDeptMapper;
|
||||
|
||||
@Resource
|
||||
AdminMapper systemAuthAdminMapper;
|
||||
|
||||
/**
|
||||
* 岗位所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<SystemAuthDeptVo>
|
||||
*/
|
||||
@Override
|
||||
public List<SystemAuthDeptVo> all() {
|
||||
List<SystemAuthDept> systemAuthDeptList = systemAuthDeptMapper.selectList(new QueryWrapper<SystemAuthDept>()
|
||||
.gt("pid", 0)
|
||||
.eq("is_delete", 0)
|
||||
.orderByDesc((Arrays.asList("sort", "id"))));
|
||||
|
||||
List<SystemAuthDeptVo> list = new ArrayList<>();
|
||||
for (SystemAuthDept systemAuthDept : systemAuthDeptList) {
|
||||
SystemAuthDeptVo vo = new SystemAuthDeptVo();
|
||||
BeanUtils.copyProperties(systemAuthDept, vo);
|
||||
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthDept.getUpdateTime()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthDept.getCreateTime()));
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* @author fzr
|
||||
* @param searchValidate 搜索参数
|
||||
* @return JSONArray
|
||||
*/
|
||||
@Override
|
||||
public JSONArray list(SystemDeptSearchValidate searchValidate) {
|
||||
QueryWrapper<SystemAuthDept> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc(Arrays.asList("sort", "id"));
|
||||
queryWrapper.select(SystemAuthDept.class, info ->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"));
|
||||
|
||||
systemAuthDeptMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"like:name:str",
|
||||
"=:isStop@is_stop:int"
|
||||
});
|
||||
|
||||
List<SystemAuthDept> systemAuthDeptList = systemAuthDeptMapper.selectList(queryWrapper);
|
||||
|
||||
List<SystemAuthDeptVo> list = new LinkedList<>();
|
||||
for (SystemAuthDept systemAuthDept : systemAuthDeptList) {
|
||||
SystemAuthDeptVo vo = new SystemAuthDeptVo();
|
||||
BeanUtils.copyProperties(systemAuthDept, vo);
|
||||
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthDept.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthDept.getUpdateTime()));
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(list));
|
||||
return ListUtils.listToTree(jsonArray, "id", "pid", "children");
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门详情
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return SystemDeptVo
|
||||
*/
|
||||
@Override
|
||||
public SystemAuthDeptVo detail(Integer id) {
|
||||
SystemAuthDept systemAuthDept = systemAuthDeptMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthDept>()
|
||||
.select(SystemAuthDept.class, info ->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(systemAuthDept, "部门已不存在!");
|
||||
|
||||
SystemAuthDeptVo vo = new SystemAuthDeptVo();
|
||||
BeanUtils.copyProperties(systemAuthDept, vo);
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthDept.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthDept.getUpdateTime()));
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门新增
|
||||
*
|
||||
* @author fzr
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(SystemDeptCreateValidate createValidate) {
|
||||
if (createValidate.getPid().equals(0)) {
|
||||
SystemAuthDept systemAuthDept = systemAuthDeptMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthDept>()
|
||||
.select("id,pid,name")
|
||||
.eq("pid", 0)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(systemAuthDept, "顶级部门只允许有一个");
|
||||
}
|
||||
|
||||
SystemAuthDept model = new SystemAuthDept();
|
||||
model.setPid(createValidate.getPid());
|
||||
model.setName(createValidate.getName());
|
||||
model.setDuty(createValidate.getDuty());
|
||||
model.setMobile(createValidate.getMobile());
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setIsStop(createValidate.getIsStop());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthDeptMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门编辑
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(SystemDeptUpdateValidate updateValidate) {
|
||||
SystemAuthDept model = systemAuthDeptMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthDept>()
|
||||
.select(SystemAuthDept.class, info ->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "部门不存在");
|
||||
Assert.isFalse((model.getPid().equals(0) && updateValidate.getPid()>0), "顶级部门不能修改上级");
|
||||
Assert.isFalse(updateValidate.getId().equals(updateValidate.getPid()), "上级部门不能是自己");
|
||||
|
||||
model.setPid(updateValidate.getPid());
|
||||
model.setName(updateValidate.getName());
|
||||
model.setDuty(updateValidate.getDuty());
|
||||
model.setMobile(updateValidate.getMobile());
|
||||
model.setSort(updateValidate.getSort());
|
||||
model.setIsStop(updateValidate.getIsStop());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthDeptMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门删除
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
SystemAuthDept model = systemAuthDeptMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthDept>()
|
||||
.select("id,pid,name")
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "部门不存在");
|
||||
Assert.isFalse((model.getPid() == 0), "顶级部门不能删除");
|
||||
|
||||
SystemAuthDept pModel = systemAuthDeptMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthDept>()
|
||||
.select("id,pid,name")
|
||||
.eq("pid", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(pModel, "请先删除子级部门");
|
||||
|
||||
Admin systemAuthAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
|
||||
.select("id,nickname")
|
||||
.apply("find_in_set({0}, dept_ids)", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(systemAuthAdmin, "该部门已被管理员使用,请先移除");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthDeptMapper.updateById(model);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
package com.mdd.admin.service.impl.system;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mdd.admin.service.system.ISystemAuthPostService;
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthPostVo;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.admin.Admin;
|
||||
import com.mdd.common.entity.system.SystemAuthPost;
|
||||
import com.mdd.common.mapper.admin.AdminMapper;
|
||||
import com.mdd.common.mapper.system.SystemAuthPostMapper;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统岗位服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class SystemAuthPostServiceImpl implements ISystemAuthPostService {
|
||||
|
||||
@Resource
|
||||
SystemAuthPostMapper systemAuthPostMapper;
|
||||
|
||||
@Resource
|
||||
AdminMapper systemAuthAdminMapper;
|
||||
|
||||
/**
|
||||
* 岗位所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<SystemPostVo>
|
||||
*/
|
||||
@Override
|
||||
public List<SystemAuthPostVo> all() {
|
||||
List<SystemAuthPost> systemAuthPostList = systemAuthPostMapper.selectList(new QueryWrapper<SystemAuthPost>()
|
||||
.eq("is_delete", 0)
|
||||
.orderByDesc((Arrays.asList("sort", "id"))));
|
||||
|
||||
List<SystemAuthPostVo> adminVoArrayList = new ArrayList<>();
|
||||
for (SystemAuthPost systemAuthPost : systemAuthPostList) {
|
||||
SystemAuthPostVo vo = new SystemAuthPostVo();
|
||||
BeanUtils.copyProperties(systemAuthPost, vo);
|
||||
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthPost.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthPost.getUpdateTime()));
|
||||
adminVoArrayList.add(vo);
|
||||
}
|
||||
|
||||
return adminVoArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位列表
|
||||
*
|
||||
* @author fzr
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<SystemPostVo>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<SystemAuthPostVo> list(PageValidate pageValidate, SystemPostSearchValidate searchValidate) {
|
||||
Integer page = pageValidate.getPageNo();
|
||||
Integer limit = pageValidate.getPageSize();
|
||||
|
||||
QueryWrapper<SystemAuthPost> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select(SystemAuthPost.class, info->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("is_delete", 0)
|
||||
.orderByDesc(Arrays.asList("sort", "id"));
|
||||
|
||||
systemAuthPostMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"like:code:str",
|
||||
"like:name:str",
|
||||
"=:isStop@is_stop:int"
|
||||
});
|
||||
|
||||
IPage<SystemAuthPost> iPage = systemAuthPostMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||
|
||||
List<SystemAuthPostVo> list = new ArrayList<>();
|
||||
for (SystemAuthPost systemAuthPost : iPage.getRecords()) {
|
||||
SystemAuthPostVo vo = new SystemAuthPostVo();
|
||||
BeanUtils.copyProperties(systemAuthPost, vo);
|
||||
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthPost.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthPost.getUpdateTime()));
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位详情
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return SystemPostVo
|
||||
*/
|
||||
@Override
|
||||
public SystemAuthPostVo detail(Integer id) {
|
||||
SystemAuthPost systemAuthPost = systemAuthPostMapper.selectOne(new QueryWrapper<SystemAuthPost>()
|
||||
.select(SystemAuthPost.class, info ->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(systemAuthPost, "岗位不存在");
|
||||
|
||||
SystemAuthPostVo vo = new SystemAuthPostVo();
|
||||
BeanUtils.copyProperties(systemAuthPost, vo);
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(systemAuthPost.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(systemAuthPost.getUpdateTime()));
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位新增
|
||||
*
|
||||
* @author fzr
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(SystemPostCreateValidate createValidate) {
|
||||
Assert.isNull(systemAuthPostMapper.selectOne(new QueryWrapper<SystemAuthPost>()
|
||||
.select("id,code,name")
|
||||
.nested(
|
||||
wq->wq.eq("code", createValidate.getCode())
|
||||
.or()
|
||||
.eq("name", createValidate.getName())
|
||||
)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1")), "该岗位已存在");
|
||||
|
||||
SystemAuthPost model = new SystemAuthPost();
|
||||
model.setCode(createValidate.getCode());
|
||||
model.setName(createValidate.getName());
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setRemarks(createValidate.getRemarks());
|
||||
model.setIsStop(createValidate.getIsStop());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthPostMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位编辑
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(SystemPostUpdateValidate updateValidate) {
|
||||
SystemAuthPost model = systemAuthPostMapper.selectOne(new QueryWrapper<SystemAuthPost>()
|
||||
.select(SystemAuthPost.class, info ->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "岗位不存在");
|
||||
|
||||
Assert.isNull(systemAuthPostMapper.selectOne(new QueryWrapper<SystemAuthPost>()
|
||||
.select("id,code,name")
|
||||
.ne("id", updateValidate.getId())
|
||||
.nested(
|
||||
wq->wq.eq("code", updateValidate.getCode())
|
||||
.or()
|
||||
.eq("name", updateValidate.getName())
|
||||
)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1")), "该岗位已存在");
|
||||
|
||||
model.setCode(updateValidate.getCode());
|
||||
model.setName(updateValidate.getName());
|
||||
model.setSort(updateValidate.getSort());
|
||||
model.setRemarks(updateValidate.getRemarks());
|
||||
model.setIsStop(updateValidate.getIsStop());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthPostMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 岗位删除
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
SystemAuthPost model = systemAuthPostMapper.selectOne(new QueryWrapper<SystemAuthPost>()
|
||||
.select("id,code,name")
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "岗位不存在");
|
||||
|
||||
Admin systemAuthAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<Admin>()
|
||||
.select("id,nickname")
|
||||
.apply("find_in_set({0}, post_ids)", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(systemAuthAdmin, "该岗位已被管理员使用,请先移除");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthPostMapper.updateById(model);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,13 +4,13 @@ import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.mdd.admin.LikeAdminThreadLocal;
|
||||
import com.mdd.admin.service.system.ISystemAuthMenuService;
|
||||
import com.mdd.admin.service.system.ISystemMenuService;
|
||||
import com.mdd.admin.service.system.ISystemAuthPermService;
|
||||
import com.mdd.admin.validate.system.SystemMenuCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemMenuUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthMenuVo;
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.mapper.system.SystemAuthMenuMapper;
|
||||
import com.mdd.common.entity.system.SystemMenu;
|
||||
import com.mdd.common.mapper.system.SystemMenuMapper;
|
||||
import com.mdd.common.util.ListUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -25,10 +25,10 @@ import java.util.List;
|
||||
* 系统菜单服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
public class SystemMenuServiceImpl implements ISystemMenuService {
|
||||
|
||||
@Resource
|
||||
SystemAuthMenuMapper systemAuthMenuMapper;
|
||||
SystemMenuMapper systemAuthMenuMapper;
|
||||
|
||||
@Resource
|
||||
ISystemAuthPermService iSystemAuthPermService;
|
||||
@@ -45,7 +45,7 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
Integer adminId = LikeAdminThreadLocal.getAdminId();
|
||||
List<Integer> menuIds = iSystemAuthPermService.selectMenuIdsByRoleId(roleIds);
|
||||
|
||||
QueryWrapper<SystemAuthMenu> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("menu_type", Arrays.asList("M", "C"));
|
||||
queryWrapper.eq("is_disable", 0);
|
||||
queryWrapper.orderByDesc("menu_sort");
|
||||
@@ -57,10 +57,10 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
queryWrapper.in("id", menuIds);
|
||||
}
|
||||
|
||||
List<SystemAuthMenu> systemAuthMenus = systemAuthMenuMapper.selectList(queryWrapper);
|
||||
List<SystemMenu> systemAuthMenus = systemAuthMenuMapper.selectList(queryWrapper);
|
||||
|
||||
List<SystemAuthMenuVo> lists = new ArrayList<>();
|
||||
for (SystemAuthMenu systemAuthMenu : systemAuthMenus) {
|
||||
for (SystemMenu systemAuthMenu : systemAuthMenus) {
|
||||
SystemAuthMenuVo vo = new SystemAuthMenuVo();
|
||||
BeanUtils.copyProperties(systemAuthMenu, vo);
|
||||
|
||||
@@ -81,14 +81,14 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
*/
|
||||
@Override
|
||||
public JSONArray list() {
|
||||
QueryWrapper<SystemAuthMenu> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<SystemMenu> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByDesc("menu_sort");
|
||||
queryWrapper.orderByAsc("id");
|
||||
|
||||
List<SystemAuthMenu> systemAuthMenus = systemAuthMenuMapper.selectList(queryWrapper);
|
||||
List<SystemMenu> systemAuthMenus = systemAuthMenuMapper.selectList(queryWrapper);
|
||||
|
||||
List<SystemAuthMenuVo> lists = new ArrayList<>();
|
||||
for (SystemAuthMenu systemAuthMenu : systemAuthMenus) {
|
||||
for (SystemMenu systemAuthMenu : systemAuthMenus) {
|
||||
SystemAuthMenuVo vo = new SystemAuthMenuVo();
|
||||
BeanUtils.copyProperties(systemAuthMenu, vo);
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
*/
|
||||
@Override
|
||||
public SystemAuthMenuVo detail(Integer id) {
|
||||
SystemAuthMenu systemAuthMenu = systemAuthMenuMapper.selectOne(new QueryWrapper<SystemAuthMenu>().eq("id", id));
|
||||
SystemMenu systemAuthMenu = systemAuthMenuMapper.selectOne(new QueryWrapper<SystemMenu>().eq("id", id));
|
||||
Assert.notNull(systemAuthMenu, "菜单已不存在!");
|
||||
|
||||
SystemAuthMenuVo vo = new SystemAuthMenuVo();
|
||||
@@ -129,12 +129,12 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
*/
|
||||
@Override
|
||||
public void add(SystemMenuCreateValidate createValidate) {
|
||||
SystemAuthMenu model = new SystemAuthMenu();
|
||||
SystemMenu model = new SystemMenu();
|
||||
model.setPid(createValidate.getPid());
|
||||
model.setMenuType(createValidate.getMenuType());
|
||||
model.setMenuName(createValidate.getMenuName());
|
||||
model.setMenuIcon(createValidate.getMenuIcon());
|
||||
model.setMenuSort(createValidate.getMenuSort());
|
||||
model.setType(createValidate.getType());
|
||||
model.setName(createValidate.getName());
|
||||
model.setIcon(createValidate.getIcon());
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setPerms(createValidate.getPerms());
|
||||
model.setPaths(createValidate.getPaths());
|
||||
model.setComponent(createValidate.getComponent());
|
||||
@@ -156,13 +156,13 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
*/
|
||||
@Override
|
||||
public void edit(SystemMenuUpdateValidate updateValidate) {
|
||||
SystemAuthMenu model = systemAuthMenuMapper.selectOne(new QueryWrapper<SystemAuthMenu>().eq("id", updateValidate.getId()));
|
||||
SystemMenu model = systemAuthMenuMapper.selectOne(new QueryWrapper<SystemMenu>().eq("id", updateValidate.getId()));
|
||||
Assert.notNull(model, "菜单已不存在!");
|
||||
|
||||
model.setMenuType(updateValidate.getMenuType());
|
||||
model.setMenuName(updateValidate.getMenuName());
|
||||
model.setMenuIcon(updateValidate.getMenuIcon());
|
||||
model.setMenuSort(updateValidate.getMenuSort());
|
||||
model.setType(updateValidate.getType());
|
||||
model.setName(updateValidate.getName());
|
||||
model.setIcon(updateValidate.getIcon());
|
||||
model.setSort(updateValidate.getSort());
|
||||
model.setPaths(updateValidate.getPaths());
|
||||
model.setPerms(updateValidate.getPerms());
|
||||
model.setComponent(updateValidate.getComponent());
|
||||
@@ -184,15 +184,15 @@ public class SystemAuthMenuServiceImpl implements ISystemAuthMenuService {
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
SystemAuthMenu model = systemAuthMenuMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthMenu>()
|
||||
SystemMenu model = systemAuthMenuMapper.selectOne(
|
||||
new QueryWrapper<SystemMenu>()
|
||||
.select("id,pid,menu_name")
|
||||
.eq("id", id)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "菜单已不存在!");
|
||||
Assert.isNull(systemAuthMenuMapper.selectOne(
|
||||
new QueryWrapper<SystemAuthMenu>()
|
||||
new QueryWrapper<SystemMenu>()
|
||||
.eq("pid", id)
|
||||
.last("limit 1")),
|
||||
"请先删除子菜单再操作!");
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.mdd.admin.service.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.mdd.admin.validate.system.SystemDeptCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemDeptUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthDeptVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统部门服务接口类
|
||||
*/
|
||||
public interface ISystemAuthDeptService {
|
||||
|
||||
/**
|
||||
* 部门所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<SystemDeptVo>
|
||||
*/
|
||||
List<SystemAuthDeptVo> all();
|
||||
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* @author fzr
|
||||
* @param searchValidate 搜索参数
|
||||
* @return JSONArray
|
||||
*/
|
||||
JSONArray list(SystemDeptSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 部门详情
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return SysMenu
|
||||
*/
|
||||
SystemAuthDeptVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 部门新增
|
||||
*
|
||||
* @author fzr
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(SystemDeptCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 部门编辑
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(SystemDeptUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 部门删除
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.mdd.admin.service.system;
|
||||
|
||||
import com.mdd.admin.validate.commons.PageValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostCreateValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostSearchValidate;
|
||||
import com.mdd.admin.validate.system.SystemPostUpdateValidate;
|
||||
import com.mdd.admin.vo.system.SystemAuthPostVo;
|
||||
import com.mdd.common.core.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统岗位服务接口类
|
||||
*/
|
||||
public interface ISystemAuthPostService {
|
||||
|
||||
/**
|
||||
* 岗位所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<SystemPostVo>
|
||||
*/
|
||||
List<SystemAuthPostVo> all();
|
||||
|
||||
/**
|
||||
* 岗位列表
|
||||
*
|
||||
* @author fzr
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<SystemPostVo>
|
||||
*/
|
||||
PageResult<SystemAuthPostVo> list(PageValidate pageValidate, SystemPostSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 岗位详情
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
* @return SystemPostVo
|
||||
*/
|
||||
SystemAuthPostVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 岗位新增
|
||||
*
|
||||
* @author fzr
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(SystemPostCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 岗位编辑
|
||||
*
|
||||
* @author fzr
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(SystemPostUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 岗位删除
|
||||
*
|
||||
* @author fzr
|
||||
* @param id 主键
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
/**
|
||||
* 系统菜单服务接口类
|
||||
*/
|
||||
public interface ISystemAuthMenuService {
|
||||
public interface ISystemMenuService {
|
||||
|
||||
/**
|
||||
* 根据角色获取菜单
|
||||
@@ -25,21 +25,21 @@ public class SystemMenuCreateValidate implements Serializable {
|
||||
@NotNull(message = "menuType参数缺失")
|
||||
@StringContains(values = {"M", "C", "A"}, message = "菜单类型不是合法值(M,C,A)")
|
||||
@ApiModelProperty(value = "菜单类型", required = true)
|
||||
private String menuType;
|
||||
private String type;
|
||||
|
||||
@NotNull(message = "缺少参数menuName")
|
||||
@Length(min = 1, max = 30, message = "菜单名称必须在1~30个字符内")
|
||||
@ApiModelProperty(value = "菜单名称", required = true)
|
||||
private String menuName;
|
||||
private String name;
|
||||
|
||||
@Length(max = 100, message = "图标名称不能超过100个字符")
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String menuIcon;
|
||||
private String icon;
|
||||
|
||||
@NotNull(message = "排序号不能为空")
|
||||
@DecimalMin(value = "0", message = "排序号值不能少于0")
|
||||
@ApiModelProperty(value = "菜单排序")
|
||||
private Integer menuSort;
|
||||
private Integer sort;
|
||||
|
||||
@Length(max = 100, message = "权限字符不能超过100个字符")
|
||||
@ApiModelProperty(value = "权限字符")
|
||||
|
||||
@@ -30,21 +30,21 @@ public class SystemMenuUpdateValidate implements Serializable {
|
||||
@NotNull(message = "menuType参数缺失")
|
||||
@StringContains(values = {"M", "C", "A"}, message = "菜单类型不是合法值(M,C,A)")
|
||||
@ApiModelProperty(value = "菜单类型", required = true)
|
||||
private String menuType;
|
||||
private String type;
|
||||
|
||||
@NotNull(message = "缺少参数menuName")
|
||||
@Length(min = 1, max = 30, message = "菜单名称必须在1~30个字符内")
|
||||
@ApiModelProperty(value = "菜单名称", required = true)
|
||||
private String menuName;
|
||||
private String name;
|
||||
|
||||
@Length(max = 100, message = "图标名称不能超过100个字符")
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String menuIcon;
|
||||
private String icon;
|
||||
|
||||
@NotNull(message = "排序号不能为空")
|
||||
@DecimalMin(value = "0", message = "排序号值不能少于0")
|
||||
@ApiModelProperty(value = "菜单排序")
|
||||
private Integer menuSort;
|
||||
private Integer sort;
|
||||
|
||||
@Length(max = 100, message = "权限字符不能超过100个字符")
|
||||
@ApiModelProperty(value = "权限字符")
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("相册分类Vo")
|
||||
@ApiModel("adminVo")
|
||||
public class AdminMySelfVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -22,5 +22,5 @@ public class AdminMySelfVo implements Serializable {
|
||||
private List<String> permissions;
|
||||
|
||||
@ApiModelProperty(value = "user")
|
||||
private JSONObject user;
|
||||
private AuthMySelfVo user;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mdd.admin.vo.auth;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("管理员")
|
||||
public class AuthMySelfVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String avatar;
|
||||
@ApiModelProperty(value = "部门关联ID")
|
||||
@JsonProperty(value = "dept_id")
|
||||
private List<Integer> deptId;
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
private Integer disable;
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
@JsonProperty(value = "jobs_id")
|
||||
private List<Integer> jobsId;
|
||||
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
@JsonProperty(value = "multipoint_login")
|
||||
private Integer multipointLogin;
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
@JsonProperty(value = "role_id")
|
||||
private List<Integer> roleId;
|
||||
|
||||
@ApiModelProperty(value = "当前管理员角色拥有的菜单")
|
||||
private Integer root;
|
||||
}
|
||||
@@ -16,6 +16,9 @@ public class SystemAuthAdminDetailVo implements Serializable {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "是否超级管理员 0-否 1-是")
|
||||
private Integer root;
|
||||
|
||||
@ApiModelProperty(value = "角色ID")
|
||||
private List<Integer> roleIds;
|
||||
|
||||
@@ -23,28 +26,25 @@ public class SystemAuthAdminDetailVo implements Serializable {
|
||||
private List<Integer> deptIds;
|
||||
|
||||
@ApiModelProperty(value = "岗位ID")
|
||||
private List<Integer> postIds;
|
||||
private List<Integer> jobIds;
|
||||
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String username;
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "多端登录: [0=否, 1=是]")
|
||||
private Integer isMultipoint;
|
||||
|
||||
@ApiModelProperty(value = "是否禁用: [0=否, 1=是]")
|
||||
private Integer isDisable;
|
||||
private Integer disable;
|
||||
|
||||
@ApiModelProperty(value = "最后登录IP")
|
||||
private String lastLoginIp;
|
||||
private String loginIp;
|
||||
|
||||
@ApiModelProperty(value = "最后登录时间")
|
||||
private String lastLoginTime;
|
||||
private String loginTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
@@ -52,4 +52,7 @@ public class SystemAuthAdminDetailVo implements Serializable {
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "是否支持多处登录:1-是;0-否;")
|
||||
private Integer multipointLogin;
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ spring:
|
||||
max-active: 100 # 连接池最大连接数(使用负数表示没有限制,默认8)
|
||||
max-idle: 20 # 连接池中的最大空闲连接(默认8)
|
||||
min-idle: 0 # 连接池中的最小空闲连接(默认0)
|
||||
|
||||
main:
|
||||
allow-circular-references: true
|
||||
# Mybatis-plus配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/mapper/**Mapper.xml
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mdd.common.entity.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("部门关联表实体")
|
||||
public class AdminDept implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("管理员id")
|
||||
private Integer adminId;
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private Integer deptId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mdd.common.entity.admin;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("岗位关联表实体")
|
||||
public class AdminJobs implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("管理员id")
|
||||
private Integer adminId;
|
||||
|
||||
@ApiModelProperty("岗位id")
|
||||
private Integer jobsId;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mdd.common.entity.system;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("系统岗位实体")
|
||||
public class SystemAuthDept implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty("ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("上级部门")
|
||||
private Integer pid;
|
||||
|
||||
@ApiModelProperty("部门名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("负责人名")
|
||||
private String duty;
|
||||
|
||||
@ApiModelProperty("联系电话")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("排序编号")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("是否禁用: [0=否, 1=是]")
|
||||
private Integer isStop;
|
||||
|
||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty("删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mdd.common.entity.system;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("系统岗位管理")
|
||||
public class SystemAuthPost implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty("ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("岗位编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("岗位名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("岗位备注")
|
||||
private String remarks;
|
||||
|
||||
@ApiModelProperty("岗位排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("是否停用: [0=否, 1=是]")
|
||||
private Integer isStop;
|
||||
|
||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty("删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("系统菜单实体")
|
||||
public class SystemAuthMenu implements Serializable {
|
||||
public class SystemMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -22,16 +22,16 @@ public class SystemAuthMenu implements Serializable {
|
||||
private Integer pid;
|
||||
|
||||
@ApiModelProperty("权限类型: [M=目录, C=菜单, A=按钮]")
|
||||
private String menuType;
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String menuName;
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("菜单图标")
|
||||
private String menuIcon;
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty("菜单排序")
|
||||
private Integer menuSort;
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("权限标识")
|
||||
private String perms;
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mdd.common.mapper.admin;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.admin.AdminDept;
|
||||
import com.mdd.common.entity.admin.AdminRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 角色关联表Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface AdminDeptMapper extends IBaseMapper<AdminDept> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mdd.common.mapper.admin;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.admin.AdminJobs;
|
||||
import com.mdd.common.entity.admin.AdminRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 角色关联表Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface AdminJobsMapper extends IBaseMapper<AdminJobs> {
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mdd.common.mapper.system;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.system.SystemAuthDept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统岗位Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemAuthDeptMapper extends IBaseMapper<SystemAuthDept> {
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mdd.common.mapper.system;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.system.SystemAuthPost;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统岗位Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemAuthPostMapper extends IBaseMapper<SystemAuthPost> {
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.mdd.common.mapper.system;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.entity.system.SystemMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统菜单Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemAuthMenuMapper extends IBaseMapper<SystemAuthMenu> {
|
||||
public interface SystemMenuMapper extends IBaseMapper<SystemMenu> {
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.mdd.common.core.PageResult;
|
||||
|
||||
import com.mdd.common.entity.system.SystemAuthMenu;
|
||||
import com.mdd.common.entity.system.SystemMenu;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.system.SystemAuthMenuMapper;
|
||||
import com.mdd.common.mapper.system.SystemMenuMapper;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import com.mdd.generator.constant.GenConstants;
|
||||
@@ -63,7 +63,7 @@ public class GenerateServiceImpl implements IGenerateService {
|
||||
GenTableColumnMapper genTableColumnMapper;
|
||||
|
||||
@Resource
|
||||
SystemAuthMenuMapper systemAuthMenuMapper;
|
||||
SystemMenuMapper systemAuthMenuMapper;
|
||||
|
||||
/**
|
||||
* 库列表
|
||||
@@ -548,14 +548,14 @@ public class GenerateServiceImpl implements IGenerateService {
|
||||
*/
|
||||
private void genAutoMenu(GenTable table) {
|
||||
if (table.getMenuStatus().equals(1)) {
|
||||
SystemAuthMenu authMenu = new SystemAuthMenu();
|
||||
SystemMenu authMenu = new SystemMenu();
|
||||
authMenu.setPid(table.getMenuPid());
|
||||
authMenu.setMenuType("C");
|
||||
authMenu.setMenuName(table.getMenuName());
|
||||
authMenu.setType("C");
|
||||
authMenu.setName(table.getMenuName());
|
||||
authMenu.setPaths(table.getModuleName());
|
||||
authMenu.setPerms(table.getModuleName() + ":list");
|
||||
authMenu.setComponent(table.getModuleName() + "/index");
|
||||
authMenu.setMenuName(table.getMenuName());
|
||||
authMenu.setName(table.getMenuName());
|
||||
authMenu.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
authMenu.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthMenuMapper.insert(authMenu);
|
||||
@@ -576,11 +576,11 @@ public class GenerateServiceImpl implements IGenerateService {
|
||||
menuName = "删除";
|
||||
}
|
||||
String perms = table.getModuleName() + ":" + op;
|
||||
SystemAuthMenu systemAuthMenu = new SystemAuthMenu();
|
||||
SystemMenu systemAuthMenu = new SystemMenu();
|
||||
systemAuthMenu.setPid(authMenu.getId());
|
||||
systemAuthMenu.setMenuType("A");
|
||||
systemAuthMenu.setType("A");
|
||||
systemAuthMenu.setPerms(perms);
|
||||
systemAuthMenu.setMenuName(table.getMenuName() + menuName);
|
||||
systemAuthMenu.setName(table.getMenuName() + menuName);
|
||||
systemAuthMenu.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthMenu.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
systemAuthMenuMapper.insert(systemAuthMenu);
|
||||
|
||||
Reference in New Issue
Block a user